Barrels don't work!

Specifically, they have no impact on the lifetime before spoiling of items when loading a save file that has buildings already with barrels.

The game correctly applies the change to spoiling rate when a new barrel is added (or removed) from a storage building but not when loading a save file. So the first time you produce them all is well, but if you save that game and reload it later they’ll do nothing in a building for years (until the first one decays, prompting the game to recalculate the effects of the remaining ones in that building).

This is not obvious at all from the game, I had to look into the values of StorageBuilding.lifetimeModifierPercent and StorageBuilding.storage.lifetimeModifierPercent at run time to figure it out. The easiest fix is probably to call StorageBuilding.UpdateStorageLifetimeModifier() within StorageBuilding.Start() [Edit: Putting it in Awake doesn’t work, but Start does]. Or to save and load ReservableItemStorage._lifetimeModifierPercent and ItemStorage._lifetimeModifierPercent so that those values are persistent.

6 Likes

Wouldn’t StorageBuilding.lifetimeModifierPercent be more related to the condition of the building? They do wear down over time and need builders to do upkeep maintenance on them. A modifier could have to do with the rate of decay in various seasons or weather conditions. Then StorageBuilding.storage.lifetimeModiferPercent would relate directly to the contents of the building and this is where the barrels would have affect.

Like your other reply, I’m not sure that second guessing what you reckon a variable might do is very helpful when the alternative is actually reading the code, inspecting the state of the game’s memory at runtime, and then testing it.

1 Like

As usual Olleus, good find.

We’re back to going through some of these reported bugs now that we’ve completed many of the new v1.0.0 features. You assessment is 100% correct. Storage buildings only update their storage modifiers when the number of barrels change, and not at load.

I’ve implemented a fix for this (v1.0.0p4). Thanks for all your continued sleuthing!

4 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.