Hi really enjoying the mod thank you so much for updating it, we ran into an issue during a warptorio playthrough with rampart fixed
6934.610 Error MainLoop.cpp:1468: Exception at tick 6118440: The mod Rampant, fixed (2.2.6) caused a non-recoverable error.
Please report this error to the mod author.
Error while running event RampantFixed::on_tick (ID 0)
invalid key to 'next'
stack traceback:
[C]: in function 'next'
RampantFixed/libs/BaseUtils.lua:541: in function 'recycleBases'
RampantFixed/control.lua:1470: in function <RampantFixed/control.lua:1425>
6934.610 Error ServerMultiplayerManager.cpp:84: MultiplayerManager failed: "The mod Rampant, fixed (2.2.6) caused a non-recoverable error.
Please report this error to the mod author.
Error while running event RampantFixed::on_tick (ID 0)
invalid key to 'next'
stack traceback:
[C]: in function 'next'
RampantFixed/libs/BaseUtils.lua:541: in function 'recycleBases'
RampantFixed/control.lua:1470: in function <RampantFixed/control.lua:1425>"
6934.610 Info ServerMultiplayerManager.cpp:808: updateTick(6118440) changing state from(InGame) to(Failed)
6934.624 Quitting: multiplayer error.
We found a quick solution
Before:
local chunk = next(base.chunks, nil)
if not chunk then
--game.print("recycled base [gps=" .. base.x .. "," .. base.y .."]".. serpent.dump(base.chunks)) -- debug
universe.growingBases[id] = nil
if universe.growingBasesIterator == id then
universe.growingBasesIterator = nil
end
map.basesToGrow[id] = nil
bases[id] = nil
end
end
universe.recycleBaseIterator = next(bases, id)
After:
local nextId = next(bases, id)
local chunk = next(base.chunks, nil)
if not chunk then
--game.print("recycled base [gps=" .. base.x .. "," .. base.y .."]".. serpent.dump(base.chunks)) -- debug
universe.growingBases[id] = nil
if universe.growingBasesIterator == id then
universe.growingBasesIterator = nil
end
map.basesToGrow[id] = nil
bases[id] = nil
end
universe.recycleBaseIterator = nextId
end
In libs/BaseUtils.lua:530
The code was calling next(bases, id) after potentially deleting bases[id], which causes a runtime error because next() was being called with a key that no longer exists in the table.