Class Effect
Methods
effect:init (effect_type, anything) | Initiates an effect. |
effect:get_name (full) | Returns the name of the effect. |
effect:delete (map) | Delete an effect from the map |
effect:cleanup (map) | Perform an effect's cleanup() callback, if applicable. |
effect:get_description () | Returns the name and description of the effect |
effect:advance () | Called every turn. |
effect:update (dt) | This function is run every tick and updates various things. |
effect:refresh_image_name () | Refresh the image name of an effect. |
effect:is_hazardous_for (ctype) | Checks if an effect is hazardous for a certain creature type. |
effect:moveTo (x, y, tweenLength) | Move an effect between tiles. |
effect:has_tag (tag) | Checks if a feature has a descriptive tag. |
effect:combust (skip_basic, source) | Checks a effect's combust() callback, if applicable, and then lights it on fire if applicable. |
effect:apply_cold (source) | Checks a effect's apply_cold() callback, if applicable, or its cold_feature flag, if applicable |
effect:apply_heat (source) | Checks a effect's apply_heat() callback, if applicable, or its heat_feature flag, if applicable |
Methods
- effect:init (effect_type, anything)
-
Initiates an effect. Don't call this explicitly, it's called when you create a new effect with Effect('effectID').
Parameters:
- effect_type String. The ID of the effect you want to create.
- anything Anything. The arguments to pass to the effect's new() callback. Can be any number of arguments.
Returns:
-
Effect. The effect itself.
- effect:get_name (full)
-
Returns the name of the effect.
Parameters:
- full Boolean. Whether to return the name in uppercase and without an article.
Returns:
-
String. The name.
- effect:delete (map)
-
Delete an effect from the map
Parameters:
- map The map that the effect is on. If blank, defaults to the current map. (optional)
- effect:cleanup (map)
-
Perform an effect's cleanup() callback, if applicable.
Parameters:
- map Map. The map the effect is on
- effect:get_description ()
- Returns the name and description of the effect
- effect:advance ()
- Called every turn. Calls the advance() function of the effect.
- effect:update (dt)
-
This function is run every tick and updates various things. You probably shouldn't call it yourself
Parameters:
- dt Number. The number of seconds since the last time update() was run. Most likely less than 1.
- effect:refresh_image_name ()
- Refresh the image name of an effect. Used for effects that look different if they're next to each other, when its surrounding has changed.
- effect:is_hazardous_for (ctype)
-
Checks if an effect is hazardous for a certain creature type.
Parameters:
- ctype String. The creature type we're checking for. If blank, just checks if it's generally hazardous. (optional)
Returns:
-
Boolean. Whether or not the effectis hazardous.
- effect:moveTo (x, y, tweenLength)
-
Move an effect between tiles.
Parameters:
- x Number. The x coordinate
- y Number. The y coordinate
- tweenLength Number. How long it takes to animate the movement between the tiles. If left blank, instantaneous. (optional)
Returns:
- Number. The x-coordinate (in pixels) of the effect's movement.
- Number. The y-coordinate (in pixels) of the effect's movement.
- effect:has_tag (tag)
-
Checks if a feature has a descriptive tag.
Parameters:
- tag String. The tag to check for
Returns:
-
Boolean. Whether or not it has the tag.
- effect:combust (skip_basic, source)
-
Checks a effect's combust() callback, if applicable, and then lights it on fire if applicable.
Parameters:
- skip_basic Boolean. Whether to skip the combust() callback and just go ahead and light the fire. (optional)
- source Entity. The cause of the combustion
- effect:apply_cold (source)
-
Checks a effect's apply_cold() callback, if applicable, or its cold_feature flag, if applicable
Parameters:
- source Entity. The cause of the freezing
- effect:apply_heat (source)
-
Checks a effect's apply_heat() callback, if applicable, or its heat_feature flag, if applicable
Parameters:
- source Entity. The cause of the melting