Commit graph

1 commit

Author SHA1 Message Date
524b11e084 fix(trol): stop the log weapon's hidden slot from crashing InventoryGrid
TrolLogWeapon.GrabLog gave the picked-up log an out-of-bounds grid
position ((99, 99)) to keep it off the visible inventory grid.
InventoryGrid.UpdateGui maps every item to a cell with y * width + x
and no bounds check, so that position threw ArgumentOutOfRangeException
every frame the inventory screen was open - for the player holding it,
or anyone else who ever had it in their own pack or a chest. Visible
as endless console spam, a frame stall/freeze, and corrupted icons on
every other slot for the rest of that update.

Now uses Inventory.FindEmptySlot like every other picked-up item, so
it renders in a real slot with the normal equipped indicator.

Also adds InventoryGridSafetyPatch as a general safety net: any item
already sitting at an invalid grid position (existing saves from
before this fix, or one handed off through a chest) gets moved to a
real slot - or dropped if there's no room - instead of crashing the
grid the next time it renders.
2026-08-09 10:48:47 +02:00