Ven0maus / SOD.Common

A common library for shadows of doubt modding.
MIT License
4 stars 4 forks source link

[FEATURE] Illegal Action Status Management #25

Closed ReveredRedHood closed 4 months ago

ReveredRedHood commented 5 months ago

Introduction Add a central structure to safely manage illegal status between multiple mods.

Description of the feature From Discord:

I think we need to add something like this to SOD.Common: AddIllegalStatusTimer(string key, float duration) and CancelIllegalStatusTimer(string key) because there's a bunch of bugs that can come up if you set illegal status and something prevents you from un-setting it, or if multiple mods are trying to manage illegal status at once

On further thought, also add the ability to check active illegal status timers.

void AddIllegalStatus(string key, float duration?); // auto removes if duration is specified
void RemoveIllegalStatus(string key);

Feature usage Use this feature instead of forcing the status to be illegal or not illegal in-game, which is prone to causing errors, especially when multiple mods are trying to manage it at once.

Dependencies and Prerequisites No.

Implementation details Discussed further on Discord, will use a simple Dictionary.

ReveredRedHood commented 5 months ago

Edited the issue, and I will assign myself and make a PR.

Ven0maus commented 4 months ago

Available in V1.1.8