Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 232
Expand file tree
/
Copy pathfeature.lua
More file actions
Latest commit
85 lines (75 loc) · 2.38 KB
/
Copy pathfeature.lua
File metadata and controls
85 lines (75 loc) · 2.38 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
-- List or manage map features & enable magma furnaces
localhelp=[====[
feature
=======
Enables management of map features.
* Discovering a magma feature (magma pool, volcano, magma sea, or curious
underground structure) permits magma workshops and furnaces to be built.
* Discovering a cavern layer causes plants (trees, shrubs, and grass) from
that cavern to grow within your fortress.
Options:
:list: Lists all map features in your current embark by index.
:magma: Enable magma furnaces (discovers a random magma feature).
:show X: Marks the selected map feature as discovered.
:hide X: Marks the selected map feature as undiscovered.
]====]
localmap_features=df.global.world.features.map_features
functiontoggle_feature(idx, discovered)
idx=tonumber(idx) --luacheck: retype
ifidx<0oridx>=#map_featuresthen
qerror('Invalid feature ID')
end
map_features[tonumber(idx)].flags.Discovered=discovered
end
functionlist_features()
localname=df.new('string')
foridx, featinipairs(map_features) do
localtags=''
iffeat:isWater() then
tags=tags..' [water]'
end
iffeat:isMagma() then
tags=tags..' [magma]'
end
iffeat:isSubterranean() then
tags=tags..' [subterranean]'
end
iffeat:isChasm() then
tags=tags..' [chasm]'
end
iffeat:isUnderworld() then
tags=tags..' [underworld]'
end
feat:getName(name)
print(('Feature #%i is %s: "%s", type %s%s'):format(
idx,
feat.flags.Discoveredand'shown' or'hidden',
name.value,
df.feature_type[feat:getType()],
tags
))
end
df.delete(name)
end
functionenable_magma_funaces()
foridx, featinipairs(map_features) do
iftostring(feat):find('magma') ~=nilthen
toggle_feature(idx, true)
print('Enabled magma furnaces.')
return
end
end
dfhack.printerr('Could not find a magma-bearing feature.')
end
localargs= {...}
ifargs[1] =='list' then
list_features()
elseifargs[1] =='magma' then
enable_magma_funaces()
elseifargs[1] =='show' then
toggle_feature(args[2], true)
elseifargs[1] =='hide' then
toggle_feature(args[2], false)
else
print(help)
end