-
Notifications
You must be signed in to change notification settings - Fork 22
Effect Plugins
Vexatos edited this page Jun 27, 2023
·
20 revisions
Below is a list of all fields that an effect plugin may contain. Some fields may contain either values directly, or a function returning an equivalent value.
Almost all functions are optional and should only be used to overwrite default behaviour if necessary.
Some functions specified below make use of the effect
object. It contains a few important fields:
-
_name:string
The name of the effect. -
_type:string
The type of the object. This is always"effect"
for custom effects.
Most functions make use of the style
object. It is simply a table of objects specifying the current list of effects, applies, and parallaxes in the map. An apply
is a struct with the _type
field set to "apply"
, and a parallax
is a struct with the _type
set to "parallax"
.
-
name:string
The internal name of the effect as defined in the mod -
canForeground:boolean
canForeground(style):boolean
Allows the effect to be in the foreground iftrue
. -
canBackground:boolean
canBackground(style):boolean
Allows the effect to be in the background iftrue
.
-
defaultData:table
defaultData(style):table
Key-value pairs of effect attributes. Each key specifies an attribute name and its value determines the default value that that attribute will have upon adding the effect. -
ignoredFields:table
ignoredFields(style):table
A list of effect attributes that should not be displayed in the styleground menu. -
fieldOrder:table
fieldOrder(style):table
A list of effect attributes specifying the order that these attributes will be displayed in in the styleground menu. Any attribute not specified in this table will be added to the end of the menu in alphabetical order. -
fieldInformation:table
fieldInformation(style):table
Key-value pairs of effect attributes. Each key is an attribute name as specified indefaultData
and its value is a table specifying additional metadata relevant for displaying the attribute's value. Custom form fields may add their own options here.-
fieldType:string
Determines the type of field used to display and validate the attribute. May be"integer"
,"color"
,"boolean"
,"number"
, or"string"
. Only"integer"
and"color"
are usually useful as the other types will typically be guessed from the attribute's current value. -
minimumValue:integer or number
Used with the"integer"
and"number"
field types. Determines the minimum allowed value for that attribute. Defaults to negative infinity (-math.huge
) -
maximumValue:integer or number
Used with the"integer"
and"number"
field types. Determines the maximum allowed value for that attribute. Defaults to positive infinity (math.huge
) -
validator(string):boolean
Used with the"string"
field type. Returnstrue
if the input string is valid for the attribute. Defaults to accepting any string. -
valueTransformer(string):string
Used with the"string"
field type. Converts the string from what is displayed in the property field into the stored attribute data. Defaults to the identity. -
displayTransformer(string):string
Used with the"string"
field type. Converts the string from the the stored attribute data into a string used for display in the property field. Defaults to the identity. -
options:table
Used with any textfield-type field and turns it into a dropdown. Contains key-value pairs where each key is the option as displayed in the styleground window and its value is the value written to the attribute. Options are sorted alphabetically. If custom order is needed, may also be a list of pairs in the form{text, value}
. -
editable:boolean
Used with any textfield-type field ifoptions
is defined. Turns the dropdown into an editable dropdown iftrue
, allowing manual entry of values that are not part ofoptions
. Defaults tofalse
. -
allowXNAColors:boolean
Used with the"color"
field type. Determines whether the"color"
field can accept XNA Color names rather than only numerical colors. Defaults tofalse
.
-