-
Disease:setActive(active)
active: boolean (true if active, false if not active) It will set the disease as active, it will just mutate it’s internal data in order to set it as active, all the behavior must be defined in the derived class you’ll see later. -
Disease:getActive()
It will return the activity status of the disease -
Disease:getData()
It will return the data object of the disease, generally you won’t need to use this -
Disease:setData(data)
It will set the data of the disease, generally you won’t need to use this and it’s recommended not to use it since it is used for internal code.
-
name
(read only) Disease display name, the one that gets shown in the UI. It gets its value from the config passed in the constructor. -
config
(read only) Contains all the disease config information, useful to get parameters to be used by the disease later. -
_data
The data object contains all the persistent disease data, since it will be saved in the database. You can store there everything you need. Do not abuse it and do not store there temporary data. Also, try to use it as little as possible since the data will be synced between the client and the server each time it will be updated, too much data could degrade performance significantly.
Disease module definition
As an example, we will call our disease “bleeding”. All the module’s code is surrounded by an if statement, this will ensure that the module will only be activated if the config is present in the aforementioned config file. So the module will initially look like thispaused
inside the _data
object. It is a flag that can be used in different ways based on how you intend to write the script, mainly it is used to pause the symptoms issued by the effect function without curing the disease.
At the end of the file there’s a line that simply registers the disease module to the DiseasesManager system, it’s requried to do so at the end of the file in order to make the disease module work.