Aoldri / anomaly-hf

Hideout Furniture: An Attempt at Primitive Base Building
4 stars 2 forks source link

feature(light-tools): Add CSV List Of Tools For Lights #5

Closed nltp-ashes closed 4 months ago

nltp-ashes commented 4 months ago

This MR adds the ability to define viable tools to light up Hideout Furniture's lights, as opposed to them being hard-coded in ui_furniture_light.script.

Now, it is possible to define tools in a light config the following way :

[my_light_config]
require_tool                             = matches, box_matches

It is also possible to externally add new tools to the list, with DLTX :

![someone_elses_light_config]
>require_tool                           = my_first_tool, my_second_tool

Given we do not know the type of tool that will be used, the script now checks if the item is degradable, and will degrade or discharge the tool accordingly.

To ensure backwards compatibility, if the old key require_matches is found, matches and box_matches are forcefully added to the list of required tools. There is a chance for this to make it so a tool is listed twice, but this is benign and will not cause issues.