Majic-Jungle / sapiens-mod-creation

Official tools and examples for mod creation in the game Sapiens
MIT License
54 stars 12 forks source link

Don't cache allowedPlansPerFollower #11

Closed SirLich closed 1 year ago

SirLich commented 2 years ago

In planManager.lua you have this line: local allowedPlansPerFollower = gameConstants.allowedPlansPerFollower.

It would be very nice if instead of caching this line, you could just call the gameConstants.allowedPlansPerFollower each time. This allows mods to dynamically edit this value, rather than requiring it to be set statically (hard coded in a gameConstants shadow).

image

So the idea is instead of having multiple mods that hard-code particular game constant values, instead my 'Vanilla Tweaks' mod would let them do it dynamically, in game. This kind requires the data not to be cached though.

Potential Workaround: The potential workaround is to build some kind of data storage system (json file on disk?) that actually can be accessed "as early as possible", and therefor can be called from a gameConstants shadow.

SirLich commented 2 years ago

I actually found another work-around. I essentially modify the number of sapiens rather than the number of orders: https://github.com/SirLich/sapiens-vanilla-tweaks/blob/main/scripts/server/planManager.lua

mjdave commented 1 year ago

I've changed it to not cache that value in b21 anyway, thanks