regions get logged in proper order

This commit is contained in:
duncathan 2020-02-28 15:52:01 -06:00
parent 2189bee2f5
commit e1811934d4
3 changed files with 13 additions and 1 deletions

View file

@ -4,6 +4,8 @@ function C:new(worldGraph, name)
self.locations = {}
self.world = worldGraph
self.name = name
self.order = worldGraph.order
worldGraph.order = worldGraph.order + 1
end
function C:canAccess(items)

View file

@ -409,6 +409,7 @@ local worldGraph = Class:extend()
function worldGraph:new(items)
self.items = items
self.order = 0
self.regions = {
firstCave = firstCave(self),
@ -550,7 +551,15 @@ function worldGraph.locationsArray(locations)
end
function worldGraph:logLocations()
for k,r in pairs(self.regions) do
local array = {}
for k,v in pairs(self.regions) do
table.insert(array, v)
end
local function sort(a,b)
return a.order < b.order
end
for k,r in ipairs(_.sort(array,sort)) do
if next(r.locations) then
logSpoiler("")
logSpoiler("Region: " .. r.name)

View file

@ -37,6 +37,7 @@ function C:new()
self.obj = ""
self.sharecode = ""
self.mychar = ""
self.spawn = ""
end
function C:setPath(path)