mutators

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNewMutatorSpec added in v0.9.8

func CreateNewMutatorSpec(spec MutatorSpec) (string, error)

func DeleteMutatorSpec added in v0.9.8

func DeleteMutatorSpec(mutatorId string) error

func GetAllMutatorIds

func GetAllMutatorIds() []string

func IsMutator

func IsMutator(mutName string) bool

func LoadDataFiles

func LoadDataFiles()

file self loads due to init()

func RegisterFS added in v0.9.8

func RegisterFS(f ...fileloader.ReadableGroupFS)

RegisterFS registers a plugin file system to be searched when loading mutator data files. Must be called before LoadDataFiles().

func SaveMutatorSpec added in v0.9.8

func SaveMutatorSpec(spec *MutatorSpec) error

func ValidateBuffIds added in v0.9.8

func ValidateBuffIds(ids []int) error

func ValidateMutatorId added in v0.9.8

func ValidateMutatorId(id string) error

func ValidateSpec added in v0.9.8

func ValidateSpec(spec *MutatorSpec) error

Types

type Mutator

type Mutator struct {
	MutatorId      string `yaml:"mutatorid,omitempty"`      // Short text that will uniquely identify this modifier ("dusty")
	SpawnedRound   uint64 `yaml:"spawnedround,omitempty"`   // Tracks when this mutator was created (useful for decay)
	DespawnedRound uint64 `yaml:"despawnedround,omitempty"` // Track when it decayed to nothing.
}

func (*Mutator) GetSpec

func (m *Mutator) GetSpec() *MutatorSpec

func (*Mutator) Live

func (m *Mutator) Live() bool

func (*Mutator) Removable

func (m *Mutator) Removable() bool

Returns true if mutator can be removed since it won't become anything or respawn

func (*Mutator) Update

func (m *Mutator) Update(currentRound uint64)

Checks whether it decays or respawns Returns true if it has changed somehow?

type MutatorList

type MutatorList []Mutator

func (*MutatorList) Add

func (ml *MutatorList) Add(mutName string) bool

func (*MutatorList) GetActive

func (ml *MutatorList) GetActive() MutatorList

Returns a new list containing only active mutators

func (*MutatorList) Has

func (ml *MutatorList) Has(mutName string) bool

func (*MutatorList) Remove

func (ml *MutatorList) Remove(mutName string) bool

func (*MutatorList) Update

func (ml *MutatorList) Update(roundNow uint64)

type MutatorSpec

type MutatorSpec struct {
	MutatorId string `yaml:"mutatorid,omitempty"` // Short text that will uniquely identify this modifier ("dusty")
	// Text based changes
	NameModifier        *TextModifier `yaml:"namemodifier,omitempty"`
	DescriptionModifier *TextModifier `yaml:"descriptionmodifier,omitempty"`
	AlertModifier       *TextModifier `yaml:"alertmodifier,omitempty"` // These can only append.
	// End text based changes
	DecayIntoId   string                   `yaml:"decayintoid,omitempty"`   // Id of another Mutator that replaces this one when it decays. This can be a circular behavior.
	PlayerBuffIds []int                    `yaml:"playerbuffids,omitempty"` // buffId's that apply conditionally TO PLAYERS AND PLAYER FOLLOWERS
	MobBuffIds    []int                    `yaml:"mobbuffids,omitempty"`    // buffId's that apply conditionally TO MOBS
	NativeBuffIds []int                    `yaml:"nativebuffids,omitempty"` // buffId's that apply conditionally TO MOBS THAT SPAWNED IN THIS ROOM
	DecayRate     string                   `yaml:"decayrate,omitempty"`     // how long until it is gone
	RespawnRate   string                   `yaml:"respawnrate,omitempty"`   // daily, weekly, 1 day, 3 day, monthly, etc.
	LightMod      int                      `yaml:"lightmod,omitempty"`      //  -2 to 2 (change). If result is 0 = none. 1 = can see this room. 2 = can see this room and all exits
	Exits         map[string]exit.RoomExit `yaml:"exits,omitempty"`         // name/roomId pairs of exits only available while mutator is live.
	Pvp           PvpOverride              `yaml:"pvp,omitempty"`           // optionally force room pvp attributes.
	Tags          []string                 `yaml:"tags,omitempty"`          // tags applied to the room while this mutator is active.
}

func GetAllMutatorSpecs

func GetAllMutatorSpecs() []MutatorSpec

func GetMutatorSpec

func GetMutatorSpec(mutatorId string) *MutatorSpec

func (*MutatorSpec) Filename

func (m *MutatorSpec) Filename() string

func (*MutatorSpec) Filepath

func (m *MutatorSpec) Filepath() string

func (*MutatorSpec) Id

func (m *MutatorSpec) Id() string

func (*MutatorSpec) Save

func (m *MutatorSpec) Save() error

func (*MutatorSpec) Validate

func (m *MutatorSpec) Validate() error

type PvpOverride

type PvpOverride struct {
	Enabled  bool `yaml:"enabled,omitempty"`  // force enabled?
	Disabled bool `yaml:"disabled,omitempty"` // force disabled?
}

type TextBehavior

type TextBehavior string
const (
	TextPrepend TextBehavior = `prepend`
	TextAppend  TextBehavior = `append` // Default behavior is replace
	TextReplace TextBehavior = `replace`
	TextDefault TextBehavior = TextReplace
)

func (TextBehavior) IsValid

func (tb TextBehavior) IsValid() bool

type TextModifier

type TextModifier struct {
	Behavior     TextBehavior `yaml:"behavior,omitempty"`     // prepend, append or replace?
	Text         string       `yaml:"text,omitempty"`         // The text that will be injected somehow
	ColorPattern string       `yaml:"colorpattern,omitempty"` // An optional color pattern name to apply
}

Jump to

Keyboard shortcuts

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