Skip to content

Commit b9831e2

Browse files
committed
adapt to canonicalized structures
1 parent 8fe33f2 commit b9831e2

16 files changed

Lines changed: 43 additions & 43 deletions

colonies.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function findVermin(target_verm)
3030
end
3131

3232
function list_colonies()
33-
for idx, col in pairs(df.global.world.vermin.colonies) do
33+
for idx, col in pairs(df.global.world.event.vermin_colonies) do
3434
local race = df.global.world.raws.creatures.all[col.race].creature_id
3535
print(race..' at '..col.pos.x..', '..col.pos.y..', '..col.pos.z)
3636
end
@@ -39,7 +39,7 @@ end
3939
function convert_vermin_to(target_verm)
4040
local vermin_id = findVermin(target_verm)
4141
local changed = 0
42-
for _, verm in pairs(df.global.world.vermin.colonies) do
42+
for _, verm in pairs(df.global.world.event.vermin_colonies) do
4343
verm.race = vermin_id
4444
verm.caste = -1 -- check for queen bee?
4545
verm.amount = 18826
@@ -61,8 +61,8 @@ function place_vermin(target_verm)
6161
verm.amount = 18826
6262
verm.visible = true
6363
verm.pos:assign(pos)
64-
df.global.world.vermin.colonies:insert("#", verm)
65-
df.global.world.vermin.all:insert("#", verm)
64+
df.global.world.event.vermin_colonies:insert("#", verm)
65+
df.global.world.event.vermin:insert("#", verm)
6666
end
6767

6868
local args = {...}
@@ -75,7 +75,7 @@ elseif args[1] == 'convert' then
7575
elseif args[1] == 'place' then
7676
place_vermin(target_verm)
7777
else
78-
if #df.global.world.vermin.colonies < 1 then
78+
if #df.global.world.event.vermin_colonies < 1 then
7979
dfhack.printerr('There are no colonies on the map.')
8080
end
8181
list_colonies()

deep-embark.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function reveal(pos)
122122
local tiletype = block.tiletype[x%16][y%16]
123123
if tiletype ~= df.tiletype.GlowingBarrier then -- to avoid multiple instances
124124
block.tiletype[x%16][y%16] = df.tiletype.GlowingBarrier
125-
local barriers = df.global.world.glowing_barriers
125+
local barriers = df.global.world.event.glowing_barriers
126126
local barrier = df.glowing_barrier:new()
127127
barrier.buildings:insert('#',-1) -- being unbound to a building makes the barrier disappear immediately
128128
barrier.pos:assign(pos)
@@ -255,7 +255,7 @@ end
255255

256256
function disableSpireDemons()
257257
-- marks underworld spires on the map as having been breached already, preventing HFS events
258-
for _, spire in ipairs(df.global.world.deep_vein_hollows) do
258+
for _, spire in ipairs(df.global.world.event.deep_vein_hollows) do
259259
spire.triggered = true
260260
end
261261
end

do-job-now.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ local function getSelectedWorkOrder()
134134
local orders
135135
local idx
136136
if df.viewscreen_jobmanagementst:is_instance(scr) then
137-
orders = df.global.world.manager_orders
137+
orders = df.global.world.manager_orders.all
138138
idx = scr.sel_idx
139139
elseif df.viewscreen_workshop_profilest:is_instance(scr)
140140
and scr.tab == df.viewscreen_workshop_profilest.T_tab.Orders

exportlegends.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ local function export_more_legends_xml()
256256
end
257257
if df.abstract_building_templest:is_instance(buildingV) then
258258
file:write("\t\t\t\t<deity_type>"..buildingV.deity_type.."</deity_type>\n")
259-
if buildingV.deity_type == df.temple_deity_type.Deity then
259+
if buildingV.deity_type == df.religious_practice_type.WORSHIP_HFID then
260260
file:write("\t\t\t\t<deity>"..buildingV.deity_data.Deity.."</deity>\n")
261-
elseif buildingV.deity_type == df.temple_deity_type.Religion then
261+
elseif buildingV.deity_type == df.religious_practice_type.RELIGION_ENID then
262262
file:write("\t\t\t\t<religion>"..buildingV.deity_data.Religion.."</religion>\n")
263263
end
264264
end

extinguish.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ function extinguishUnit(unit)
9898
end
9999

100100
function extinguishAll()
101-
local fires = df.global.world.fires
101+
local fires = df.global.world.event.fires
102102
for i = #fires - 1, 0, -1 do
103103
extinguishTile(pos2xyz(fires[i].pos))
104104
fires:erase(i)
105105
end
106-
local campfires = df.global.world.campfires
106+
local campfires = df.global.world.event.campfires
107107
for i = #campfires - 1, 0, -1 do
108108
extinguishTile(pos2xyz(campfires[i].pos))
109109
campfires:erase(i)
@@ -118,14 +118,14 @@ end
118118

119119
function extinguishLocation(x, y, z)
120120
local pos = xyz2pos(x, y, z)
121-
local fires = df.global.world.fires
121+
local fires = df.global.world.event.fires
122122
for i = #fires - 1, 0, -1 do
123123
if same_xyz(pos, fires[i].pos) then
124124
extinguishTile(x, y, z)
125125
fires:erase(i)
126126
end
127127
end
128-
local campfires = df.global.world.campfires
128+
local campfires = df.global.world.event.campfires
129129
for i = #campfires - 1, 0, -1 do
130130
if same_xyz(pos, campfires[i].pos) then
131131
extinguishTile(x, y, z)

firestarter.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ elseif dfhack.gui.getSelectedUnit(true) then
99
entry.item.flags.on_fire = true
1010
end
1111
elseif guidm.getCursorPos() then
12-
df.global.world.fires:insert('#', {
12+
df.global.world.event.fires:insert('#', {
1313
new=df.fire,
1414
timer=1000,
1515
pos=guidm.getCursorPos(),

fix/engravings.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ end
3333

3434
--loop runs through list of all engravings checking each using is_good_engraving and if bad gets deleted
3535
local cleanup = 0
36-
local engravings = df.global.world.engravings
36+
local engravings = df.global.world.event.engravings
3737
for index = #engravings-1,0,-1 do
3838
local engraving = engravings[index]
3939
if not is_good_engraving(engraving) then

gui/advfort.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,11 @@ function advGlobalPos()
196196
local map=df.global.world.map
197197
local wd=df.global.world.world_data
198198
local adv=df.global.world.units.active[0]
199-
--wd.adv_region_x*16+wd.adv_emb_x,wd.adv_region_y*16+wd.adv_emb_y
200-
--return wd.adv_region_x*16+wd.adv_emb_x,wd.adv_region_y*16+wd.adv_emb_y
201-
--return wd.adv_region_x*16+wd.adv_emb_x+adv.pos.x/16,wd.adv_region_y*16+wd.adv_emb_y+adv.pos.y/16
199+
--wd.midmap_data.adv_region_x*16+wd.midmap_data.adv_emb_x,wd.midmap_data.adv_region_y*16+wd.midmap_data.adv_emb_y
200+
--return wd.midmap_data.adv_region_x*16+wd.midmap_data.adv_emb_x,wd.midmap_data.adv_region_y*16+wd.midmap_data.adv_emb_y
201+
--return wd.midmap_data.adv_region_x*16+wd.midmap_data.adv_emb_x+adv.pos.x/16,wd.midmap_data.adv_region_y*16+wd.midmap_data.adv_emb_y+adv.pos.y/16
202202
--print(map.region_x,map.region_y,adv.pos.x,adv.pos.y)
203-
--print(map.region_x+adv.pos.x/48, map.region_y+adv.pos.y/48,wd.adv_region_x*16+wd.adv_emb_x,wd.adv_region_y*16+wd.adv_emb_y)
203+
--print(map.region_x+adv.pos.x/48, map.region_y+adv.pos.y/48,wd.midmap_data.adv_region_x*16+wd.midmap_data.adv_emb_x,wd.midmap_data.adv_region_y*16+wd.midmap_data.adv_emb_y)
204204
return math.floor(map.region_x+adv.pos.x/48), math.floor(map.region_y+adv.pos.y/48)
205205
end
206206
function inSite()

gui/extended-status.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ function queue_beds(amount)
4747
end
4848

4949
order = df.manager_order:new()
50-
order.id = df.global.world.manager_order_next_id
51-
df.global.world.manager_order_next_id = df.global.world.manager_order_next_id + 1
50+
order.id = df.global.world.manager_orders.manager_order_next_id
51+
df.global.world.manager_orders.manager_order_next_id = df.global.world.manager_orders.manager_order_next_id + 1
5252
order.job_type = df.job_type.ConstructBed
5353
order.material_category.wood = true
5454
order.amount_left = amount
5555
order.amount_total = amount
56-
df.global.world.manager_orders:insert('#', order)
56+
df.global.world.manager_orders.all:insert('#', order)
5757
end
5858

5959
status_overlay = defclass(status_overlay, gui.Screen)
@@ -172,7 +172,7 @@ function bedroom_list:refresh()
172172
end
173173
end
174174
self.queued_beds = 0
175-
for _, order in pairs(df.global.world.manager_orders) do
175+
for _, order in pairs(df.global.world.manager_orders.all) do
176176
if order.job_type == df.job_type.ConstructBed then
177177
self.queued_beds = self.queued_beds + order.amount_left
178178
end

gui/gm-editor.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function getTargetFromScreens()
6161
if dfhack.gui.matchFocusString('dwarfmode/ViewSheets/ENGRAVING', dfhack.gui.getDFViewscreen(true)) then
6262
local sheet = df.global.game.main_interface.view_sheets
6363
local pos = xyz2pos(sheet.viewing_x, sheet.viewing_y, sheet.viewing_z)
64-
for _, engraving in ipairs(df.global.world.engravings) do
64+
for _, engraving in ipairs(df.global.world.event.engravings) do
6565
if same_xyz(engraving.pos, pos) then
6666
my_trg = engraving
6767
break

0 commit comments

Comments
 (0)