Skip to content

Commit 1eb5a1d

Browse files
committed
update to new d_init structure layout
1 parent c5d57ad commit 1eb5a1d

File tree

5 files changed

+12
-31
lines changed

5 files changed

+12
-31
lines changed

deep-embark.lua

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
-- Embark underground.
2-
-- author: Atomic Chicken
3-
41
--@ module = true
52

63
local utils = require 'utils'
@@ -50,8 +47,8 @@ function getFeatureBlocks(featureID)
5047
end
5148

5249
function isValidTiletype(tiletype)
53-
local tiletype = df.tiletype[tiletype]
54-
local tiletypeAttrs = df.tiletype.attrs[tiletype]
50+
local tt = df.tiletype[tiletype]
51+
local tiletypeAttrs = df.tiletype.attrs[tt]
5552
local material = tiletypeAttrs.material
5653
local forbiddenMaterials = {
5754
df.tiletype_material.TREE, -- so as not to embark stranded on top of a tree
@@ -95,7 +92,7 @@ function blockGlowingBarrierAnnouncements(recenter)
9592
dfhack.timeout(1,'ticks', function() -- barrier disappears after 1 tick
9693
announcementFlags:assign(oldFlags) -- restore announcement settings
9794
if recenter then
98-
-- Remove glowing barrier notifications:
95+
-- Remove glowing barrier notifications:
9996
local status = df.global.world.status
10097
local announcements = status.announcements
10198
for i = #announcements-1, 0, -1 do

open-legends.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function LegendsManager:onDestroy()
7575
dfhack.run_script('devel/pop-screen')
7676

7777
-- disable autosaves for the remainder of this session
78-
df.global.d_init.autosave = df.d_init_autosave.NONE
78+
df.global.d_init.feature.autosave = df.d_init_autosave.NONE
7979
end
8080
end
8181

quicksave.lua

+2-18
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,9 @@ if not dfhack.world.isFortressMode() then
2222
qerror('This script can only be used in fortress mode')
2323
end
2424

25-
local ui_main = df.global.plotinfo.main
26-
local flags4 = df.global.d_init.flags4
27-
28-
local function restore_autobackup()
29-
if ui_main.autosave_request and dfhack.isMapLoaded() then
30-
dfhack.timeout(10, 'frames', restore_autobackup)
31-
else
32-
flags4.AUTOBACKUP = true
33-
end
34-
end
35-
3625
function save()
26+
local ui_main = df.global.plotinfo.main
27+
3728
-- Request auto-save (preparation steps below discovered from rev eng)
3829
ui_main.autosave_request = true
3930
ui_main.autosave_timer = 5
@@ -45,13 +36,6 @@ function save()
4536
ui_main.save_progress.info.cur_unit_chunk = nil
4637
ui_main.save_progress.info.cur_unit_chunk_num = -1
4738
ui_main.save_progress.info.units_offloaded = -1
48-
49-
-- And since it will overwrite the backup, disable it temporarily
50-
if flags4.AUTOBACKUP then
51-
flags4.AUTOBACKUP = false
52-
restore_autobackup()
53-
end
54-
5539
print 'The game should autosave now.'
5640
end
5741

toggle-kbd-cursor.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
local guidm = require('gui.dwarfmode')
22

3-
local flags4 = df.global.d_init.flags4
3+
local flags = df.global.d_init.feature.flags
44

5-
if flags4.KEYBOARD_CURSOR then
6-
flags4.KEYBOARD_CURSOR = false
5+
if flags.KEYBOARD_CURSOR then
6+
flags.KEYBOARD_CURSOR = false
77
guidm.setCursorPos(xyz2pos(-30000, -30000, -30000))
88
print('Keyboard cursor disabled.')
99
else
1010
guidm.setCursorPos(guidm.Viewport.get():getCenter())
11-
flags4.KEYBOARD_CURSOR = true
11+
flags.KEYBOARD_CURSOR = true
1212
print('Keyboard cursor enabled.')
1313
end

twaterlvl.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
2-
df.global.d_init.flags1.SHOW_FLOW_AMOUNTS = not df.global.d_init.flags1.SHOW_FLOW_AMOUNTS
1+
local flags = df.global.d_init.display.flags
2+
flags.SHOW_FLOW_AMOUNTS = not flags.SHOW_FLOW_AMOUNTS
33
print('Water level display toggled.')

0 commit comments

Comments
 (0)