modifier

package
v1.8.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 1 Imported by: 1

Documentation

Overview

package modifier provides a universal way of handling a slice of modifiers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add[K Mod](slice *[]K, mod K, f int) (overwrote bool, evt glog.Event)

Add adds a modifier. Returns true if overwritten and the original evt (if overwritten) TODO: consider adding a map here to track the index to assist with faster lookups

func Find

func Find[K Mod](slice *[]K, key string) int

func FindCheckExpiry

func FindCheckExpiry[K Mod](slice *[]K, key string, f int) (int, bool)

func LogAdd

func LogAdd[K Mod](prefix string, index int, mod K, logger glog.Logger, overwrote bool, oldEvt glog.Event)

LogAdd is a helper that logs mod add events

Types

type Base

type Base struct {
	ModKey    string
	Dur       int
	Hitlag    bool
	ModExpiry int
	// contains filtered or unexported fields
}

func NewBase

func NewBase(key string, dur int) Base

func NewBaseWithHitlag

func NewBaseWithHitlag(key string, dur int) Base

func (*Base) AffectedByHitlag

func (t *Base) AffectedByHitlag() bool

func (*Base) Event

func (t *Base) Event() glog.Event

func (*Base) Expiry

func (t *Base) Expiry() int

func (*Base) Extend

func (t *Base) Extend(amt int)

func (*Base) Key

func (t *Base) Key() string

func (*Base) SetEvent

func (t *Base) SetEvent(evt glog.Event)

func (*Base) SetExpiry

func (t *Base) SetExpiry(f int)

type Mod

type Mod interface {
	Key() string
	Expiry() int
	Event() glog.Event
	SetEvent(glog.Event)
	AffectedByHitlag() bool
	Extend(int)
}

func Delete

func Delete[K Mod](slice *[]K, key string) (m Mod)

Delete removes a modifier. Returns true if deleted ok

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL