Cultist Simulator

Cultist Simulator

The Roost Machine
 This topic has been pinned, so it's probably important
Chelnoque  [developer] 11 Jan, 2022 @ 8:47am
THE BEACHCOMBER - Custom Properties and Classes
Won't be of any use to you if you aren't writing your own DLL mod. Otherwise, allows to load custom ♥♥♥♥♥♥ entities and custom properties for existing ♥♥♥♥♥♥ entities.
(I kid you not, Steam supresses the word F-u-c-i-n-e).

To add property:
Roost.Machine.ClaimProperty<EntityType, PropertyType>(string propertyName);
After that, property name will be correctly parsed from JSONs of a specified entity type and can be retrieved with:
entity.RetrieveProperty<PropertyType>(propertyName);

For example:
Roost.Machine.ClaimProperty<Verb, string>("comments"); someVerb.RetrieveProperty<string>("comments");

Supports all reasonable value types, collections (including any depth of nesting), other entities (a la LinkedRecipeDetails and MorphEffects) and structs. On how to load entities and structs refer to the example link below. The property can be marked as localizable by passing an optional bool value in ClaimProperty method. In that case the property be overwritten by corresponding loc data from any of the enabled mods.

Sometimes one can want to create an entirely separate entity type that loads from its own JSON instead of being confined inside a property of currently existing entity. In this case, refer to this example[bitbucket.org].

Obviously, you'll still need to implement an application of your custom properties and classes.



Oh, by the way, you now can load lists that consist of a single entity without using square brackets. I.e. these two are equal definitions:
"list": "singleEntry",
"list": ["singleEntry"],
Last edited by Chelnoque; 3 Mar, 2022 @ 6:41am