-
Notifications
You must be signed in to change notification settings - Fork 203
/
Copy pathreveal-adv-map.lua
46 lines (39 loc) · 1.32 KB
/
reveal-adv-map.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--@ module = true
local utils = require('utils')
function revealAdvMap(hide)
local world = df.global.world.world_data
for world_x = 0, world.world_width - 1, 1 do
for world_y = 0, world.world_height - 1, 1 do
df.global.world.world_data.region_map[world_x]:_displace(world_y).flags.discovered = not hide
end
end
-- update the quest log configuration if it is already open (restricts map cursor movement):
local view = dfhack.gui.getDFViewscreen(true)
if view._type == df.viewscreen_adventure_logst then
local player = view.player_region
if hide then
view.cursor.x = player.x
view.cursor.y = player.y
end
view.min_discovered.x = (hide and player.x) or 0
view.min_discovered.y = (hide and player.y) or 0
view.max_discovered.x = (hide and player.x) or world.world_width - 1
view.max_discovered.y = (hide and player.y) or world.world_height - 1
end
end
local validArgs = utils.invert({
'hide',
'help'
})
local args = utils.processArgs({...}, validArgs)
if dfhack_flags.module then
return
end
if args.help then
print(dfhack.script_help())
return
end
if not dfhack.world.isAdventureMode() then
qerror("This script can only be used in adventure mode!")
end
revealAdvMap(args.hide and true)