- [FIX] Al cambiar d'habitacions durante el joc se creaba algun item extra

This commit is contained in:
2025-11-15 09:43:28 +01:00
parent cd27490426
commit 72f4cd04ce

View File

@@ -17,17 +17,18 @@ sprites = {
end, end,
remove_out_of_room = function() remove_out_of_room = function()
print("Current room: "..rooms.current()) --print("Current room: "..rooms.current())
for i,v in ipairs(sprites.list) do --for i,v in ipairs(sprites.list) do
if v.room ~= rooms.current() then -- if v.room ~= rooms.current() then
table.remove(sprites.list, i) -- table.remove(sprites.list, i)
local room = v.room or 0 -- local room = v.room or 0
print("Sprite at room "..room.." removed: "..v.type) -- print("Sprite at room "..room.." removed: "..v.type)
end -- end
end --end
end, end,
add_from_room = function(rx,ry) add_from_room = function(rx,ry)
sprites.list = {}
map.surf(rooms.surf_items) map.surf(rooms.surf_items)
for y = ry, ry+11 do for y = ry, ry+11 do
for x = rx, rx+19 do for x = rx, rx+19 do