From e42952469dadfb3535633c66c881050ac128703c Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Mon, 5 Oct 2026 17:05:14 -0400 Subject: fix: gather verbs, walk oom, admin path bypass, roulette refund --- internal/player/player.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'internal/player/player.go') diff --git a/internal/player/player.go b/internal/player/player.go index aad0b8e..92b017a 100644 --- a/internal/player/player.go +++ b/internal/player/player.go @@ -205,7 +205,7 @@ type Player struct { Options map[string]any `yaml:"-"` Flags map[string]any `yaml:"flags"` PendingSequence *PendingSequence `yaml:"pending_sequence,omitempty"` - RegenerateTick int + RegenerateTick int `yaml:"-"` AmmoQty int `yaml:"ammo_qty,omitempty"` Action *behavior.Action `yaml:"-"` BackgroundAction *behavior.Action `yaml:"-"` @@ -525,6 +525,11 @@ func (p *Player) RemoveItem(itemID string, qty int) bool { if qty <= 0 { return false } + // All-or-nothing: a caller that rolls back on false must not find the + // inventory already drained. Check the total first, then remove. + if p.CountItem(itemID) < qty { + return false + } remaining := qty for i, slot := range p.Inventory { if slot == nil || slot.ItemID != itemID { -- cgit v1.2.3