Page 1 of 1

[Modding API] Character modifier handling enhansment

Posted: Mon Jul 03, 2017 2:41 pm
by psihius
TL;DR
When character modifier changes are coming from multiple sources, keeping track of modifications becomes impossible if it's not a monolithic code base

What ?
I suggest an addition to modding API and/or change how character modifiers are handled by adding an API that can be used to add/modify/remove modifiers on player stats instead of just globally overriding the value.
On the developer side I think this might be something like

Code: Select all

player.addModifier({"type":"speed","value":0.5,"tag":"rpg"});
player.removeModifier({"type":"speed","value":0.5,"tag":"rpg"});
player.changeModifier({"type":"speed","value":0.1,"tag":"rpg"});
Where "tag" is optional and may default to "factorio" or something.

In the long run it might be a nice idea to discourage direct writing into modifiers and make them read only for public side.
Why ?
With 3RA and FactorioMMO tools we run into an issue when using our admin powers in various scenarios we get our player stats reset. In particular that's relevant for our current RPG server where unless you level up or change a class - you can't restore your RPG stats unless you run a command (not advisable by the author). If more scenarios/mods are getting involved, that might escalate the issue even more.
I haven't checked if it will also affect equipment bonuses, or are equipment bonuses applied on top internally.

Re: [Modding API] Character modifier handling enhansment

Posted: Mon Jul 03, 2017 2:50 pm
by Tekky
You may want to ask a moderator to move this thread to the Modding interface requests sub-forum.