Actions

From Cosmoteer Wiki
< Modding(Redirected from Actions)
Modding/Actions
Jump to navigation Jump to search


The primary way to modify the game is through «Actions».

Actions are little commands that modify the game's .rules files after they have been loaded into memory. (The actual .rules files in the Data folder are never modified and so disabling a mod will cause the game to revert back to its vanilla state).

First, the game loads the vanilla .rules files normally. Then, for every mod that is enabled, that mod's «actions» are run on top of the loaded .rules files, modifying them in memory.

Using this technique, mods can make almost any change to the game that could be made by modifying the .rules files directly, but without actually having to make any permanent changes to the game files.

There are a small number of .rules files that can't be modified using actions. The most prominent example is the language string files (such as en.rules) which are modified using the StringsFolder setting.

Actions
Add Add a data field to an existing [] list or to a named data field.
AddMany This is similar to the Add action but it can be used to add multiple data fields to a single [] list, but it can't add named data fields. The Overrides Action should be used to add multiple named data fields.
AddBase The "AddBase" action adds a reference to the inheritance list of an existing {} group or [] list.
Replace The "Replace" action changes a vanilla data field to a modded data field. This works with single values (like below), but you can also replace entire {} groups, [] lists, and file references as well.
Overrides The "Overrides" action allows multiple named data fields to be modified, or new named fields to be added. Note that Overrides can only be used on named data fields inside a file or {} group. For unnamed data fields inside a [] group, use the "Replace" Action.
Remove The "Remove" action deletes a vanilla data field from the game data. Note that if the removed data field has any dependencies you may get crashing errors.
RemoveMany The "RemoveMany" action is just like the "Remove" action, but it allows you to remove multiple data fields without having to create a separate action for each data field you want to remove.