Skip to content

v2.0.0.3 — Hotfix: economicTickHandler + PhysicsUtils double-init

Choose a tag to compare

@TheCodingDad-TisonK TheCodingDad-TisonK released this 28 Feb 18:04
· 114 commits to master since this release

Bug Fixes

economicEvents.lua — Tick handler was never registered (Lua scoping bug)

economicTickHandler was declared after registerEconomicEvents in the source file. In Lua, a local variable is only visible to code that appears after its declaration — so the reference inside registerEconomicEvents resolved to nil at runtime. The call g_RandomWorldEvents:registerTickHandler("economicEvents", nil) was a silent no-op: the handler was never stored and never executed. Moved the function definition above registerEconomicEvents so it is a valid upvalue.

RandomWorldEvents.lua — PhysicsUtils initialised twice on every load

loadEventModules() drained the pendingRegistrations queue (which already runs PhysicsUtils = PhysicsUtils:new()), then immediately called PhysicsUtils = PhysicsUtils:new() a second time. Both calls succeeded but the second silently discarded the first instance and emitted a duplicate log line, making it look like two separate PhysicsUtils objects were alive. Removed the redundant explicit call; PhysicsUtils self-manages initialisation through the pending registration mechanism.


What this does NOT fix

Events that set EVENT_STATE flags (marketBonus, seedDiscount, yieldBonus, etc.) still do not alter actual FS25 prices or yields — those flags are not yet wired to the game's economy and field APIs. Events that directly call addMoney (subsidies, expenses, vet bills, etc.) continue to work as before. Full price/yield API integration is planned for a future update.