MO2 mod for STALKER GAMMA. On 21:9 and 32:9 screens the last column of item grids (bag, trader, stash, debug spawn menu) sticks out past the scrollbar. This fixes the column count.
All those grids are utils_ui.UICellContainer. A cell is a 41-unit icon plus a 2-unit gap. Placing a cell
(UICellItem:Set) narrows the icon by the screen ratio ((4/3) / aspect) but not the gap, while
SetGridSpecs counts columns as if the gap shrank too:
- counted:
cols = floor(width / ratio / (41 + 2)) - placed: each column takes
41 * ratio + 2
At 4:3 the two agree; at 16:9 the error stays inside the leftover at the edge; at 3840x1600 the 606-wide
bag gets 25 columns that need ~619. zz_ultrawide_grid_fix.script replaces SetGridSpecs to count with
the real pitch, floor(width / (41 * ratio + 2)): one column fewer where it overflowed. Placement is left
alone because several mods (Utjan's Item UI Improvements, the aaa_rax_icon_override copies) replace
UICellItem:Set with the same maths, and they all read the column count.
AdjustWidthToCell (auto-width grids, e.g. tooltip part boxes) has the same mismatch; nothing seen
depends on it, so it is untouched.
Copy gamedata into GAMMA/mods/Ultrawide inventory grid fix and enable it in MO2 (any position:
nothing else replaces SetGridSpecs).
nix-shell -p luajit --command 'luajit test/check.lua gamedata/scripts/zz_ultrawide_grid_fix.script'Fails on GAMMA's original count. Tested in game on 2026-11-22 (GAMMA + ROMEO 1.0.0, 3840x1600): overflow gone.