diff options
| author | historia <[not public]> | 2026-09-18 01:50:17 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 01:50:17 -0400 |
| commit | 87d08f0151e643951769e323995f1c5ed89ee200 (patch) | |
| tree | dc42a0b30ebb5a00dd7ba505cc4eaa44f4f308bc /internal/world | |
| parent | 32a3c59cebf2a16277e54d715a67adfdbe00b456 (diff) | |
| download | thehouseoficarus-87d08f0151e643951769e323995f1c5ed89ee200.tar.gz | |
fix: harden economy recovery, shutdown concurrency, world validation, and inventory-loss paths
Diffstat (limited to 'internal/world')
| -rw-r--r-- | internal/world/mob.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/internal/world/mob.go b/internal/world/mob.go index a794bdd..b004643 100644 --- a/internal/world/mob.go +++ b/internal/world/mob.go @@ -665,7 +665,15 @@ func (s *MobStore) SpawnTransient(def *MobDef, cfg *behavior.SpawnMobConfig, roo s.mu.Lock() defer s.mu.Unlock() - instID := fmt.Sprintf("trigger_%s_%d_%d", cfg.ID, roomID, len(s.instances)) + instID := "" + base := fmt.Sprintf("trigger_%s_%d", cfg.ID, roomID) + for n := 0; ; n++ { + candidate := fmt.Sprintf("%s_%d", base, n) + if _, exists := s.instances[candidate]; !exists { + instID = candidate + break + } + } inst := NewMobInstance(def, instID, roomID, nil, 0) inst.Owner = owner inst.OwnerOnly = cfg.OwnerOnly |
