summaryrefslogtreecommitdiff
path: root/objects/room.lua
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-02-23 10:25:54 +0800
committerEltrac <hi@guhub.cn>2025-02-23 10:25:54 +0800
commitd7156f8787caf167fd4ac5ea11be5cc5c71e5108 (patch)
treebcb95d5a9283285f70e87846683f7248b50e0b69 /objects/room.lua
parenta3a4040662f6a562d59e2b25462c63aeab99b87f (diff)
fix: some rooms spawns with no enemies
Due to incorrect reference to room date directly, killing enemies in one room means killing enemies in other rooms of the same kind. The problem is now fixed by copying room data instead of referencing it.
Diffstat (limited to 'objects/room.lua')
-rw-r--r--objects/room.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/objects/room.lua b/objects/room.lua
index 07f5aa2..984a436 100644
--- a/objects/room.lua
+++ b/objects/room.lua
@@ -8,8 +8,8 @@ function Room:new(name, w, h)
type = data.type or roomType.INITIAL,
width = data.width or 0.85,
height = data.height or 0.8,
- enemies = data.enemies or {},
- obstacles = data.obstacles or {},
+ enemies = utils.copy(data.enemies or {}),
+ obstacles = utils.copy(data.obstacles or {}),
doors = {},
isCleared = false,