diff options
Diffstat (limited to 'internal/game/room_reconcile.go')
| -rw-r--r-- | internal/game/room_reconcile.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/game/room_reconcile.go b/internal/game/room_reconcile.go new file mode 100644 index 0000000..7491776 --- /dev/null +++ b/internal/game/room_reconcile.go @@ -0,0 +1,21 @@ +package game + +// ReconcileRoom refreshes a room's live runtime state from its on-disk +// definition after a content edit, without a restart. Object instances and +// item-spawn ground entries are reconciled by World; mob instances are dropped +// and reseeded here because MobStore is owned by the game layer. Player-dropped +// ground items and live reservations are preserved. +// +// It runs on the owner goroutine (the admin callbacks that call it already do) +// and must not redispatch. +func (g *Game) ReconcileRoom(roomID int) { + room, err := g.World.LoadRoom(roomID) + if err != nil { + return + } + g.World.ReconcileRoomState(roomID, room) + if g.MobStore != nil { + g.MobStore.RemoveMobsInRoom(roomID) + g.MobStore.SeedMobs(roomID, room.Mobs) + } +} |
