AgriCraft

AgriCraft

30M Downloads

JSON Crop Actions

RlonRyan opened this issue ยท 2 comments

commented

Since some crops have special actions when they are harvested, crops should be able to fire off commands set in their JSON files. Otherwise they should be able to perform actions, as defined in the API, or compound actions as defined by a new action JSON file type.

This is a good idea as it would allow for end users to have almost total control over the mod's compatibility, with little to no work done by us, freeing us to work on perfecting the mod.

commented

It may be necessary to write a DSL for the actions, as JSON files are not technically turing complete, making them limited in their application.

If writing a DSL is too involved, we could start a partnership with a mod that provides user scripting.

Notice: The major issue with allowing scripting is the possibility of user error corrupting something. As such we would need to do our best to validate the scripts, or otherwise have them rely on fail-safe interfaces only.

commented

We need some predefined crop behaviours in the jsons, such as hurting on collision (cactus), emitting light (nitor wart), etc.
We can have default implementations of these with IDs to be defined in the jsons.

For these callbacks specifically: https://github.com/AgriCraft/AgriCraft/blob/master/src/main/java/com/infinityraider/agricraft/api/v1/plant/IAgriPlant.java#L202-L253