From d7156f8787caf167fd4ac5ea11be5cc5c71e5108 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Sun, 23 Feb 2025 10:25:54 +0800 Subject: 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. --- utils/utils.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'utils/utils.lua') diff --git a/utils/utils.lua b/utils/utils.lua index 3a2dd05..4913385 100644 --- a/utils/utils.lua +++ b/utils/utils.lua @@ -60,3 +60,17 @@ end function utils.resetGraphics() love.graphics.setColor(1,1,1) end + +function utils.copy(t, deep) + local copy = {} + + for k, v in pairs(t) do + if deep and type(v) == "table" then + copy[k] = utils.copy(v, true) + else + copy[k] = v + end + end + + return copy +end -- cgit v1.2.3