From 918c63c535ae220c81c9b54c046e9ee12c6b56c6 Mon Sep 17 00:00:00 2001 From: binarycat Date: Wed, 16 Mar 2022 14:37:19 -0400 Subject: [PATCH] removed file on the wrong branch --- code/chunk.lua | 66 -------------------------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 code/chunk.lua diff --git a/code/chunk.lua b/code/chunk.lua deleted file mode 100644 index 11f2b05..0000000 --- a/code/chunk.lua +++ /dev/null @@ -1,66 +0,0 @@ --- pieces of levels - -Chunk = { - -- set of all chunks in the level. - -- chunks are the keys, for easier removal. - all = {}, -} -Chunk.__index = Chunk - ---[[ -instance fields: - -[string] filename -[Rect or nil] box -[table or nil] data - data loaded from the chunks file. may be nil. -[table or nil] loaded - entities that exist in the chunk. -]] - --- CLASS METHODS - --- box == nil for global chunks -function Chunk:new(filename, box) - local o = { filename = filename, box = box } - setmetatable(o, self) - self.all[o] = true -end - -function Chunk:getExportList() - local r = {} - for chunk in pairs(self.all) do - table.insert(r, {chunk.filename, chunk.box}) - end - return r -end - --- INSTANCE METHODS - -function Chunk:containsPoint(pt) - return self.box == nil or self.box:containsPoint(pt) -end - -function Chunk:load() - if self.loaded then - return - end - logPrint("loading chunk "..self.filename) - self.data = dofile(level_current.."/chunks/"..self.filename) - self.loaded = { rooms = {}, collisions = {} } - LevelTiles = self.data.tiles - indexLevelTiles() - optimizeTileObjects(self.loaded.collisions) - - for _, v in ipairs(self.data.rooms or {}) do - local room = Collision:new(v[1],v[2],v[3],v[4]) - table.insert(self.data.rooms, room) - table.insert(LoadedObjects.Rooms, room) - end - logPrint("loaded chunk with "..#self.loaded.collisions.." collisions") -end - -function Chunk:save(chunkdir) - return love.filesystem.write(chunkdir.."/"..self.filename, "return "..serialize_lua_value(self.data)) -end -