Skip to content

Commit 802169c

Browse files
committed
add govt and civ to rename options in fort mode
1 parent 1bb3173 commit 802169c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

gui/rename.lua

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ local function select_location(site, cb)
105105
choices, function(_, choice) cb(choice.data.target) end, nil, nil, true)
106106
end
107107

108-
local function select_site(site, cb)
108+
local function select_entity(site, cb)
109109
cb(site.name)
110110
end
111111

@@ -153,16 +153,24 @@ local function select_new_target(cb)
153153
table.insert(choices, {text='An artifact', data={fn=select_artifact}})
154154
end
155155
local site = dfhack.world.getCurrentSite()
156+
local is_fort_mode = dfhack.world.isFortressMode()
157+
local fort = is_fort_mode and df.historical_entity.find(df.global.plotinfo.group_id)
158+
local civ = is_fort_mode and df.historical_entity.find(df.global.plotinfo.civ_id)
156159
if site then
157160
if #site.buildings > 0 then
158161
table.insert(choices, {text='A location', data={fn=curry(select_location, site)}})
159162
end
160-
table.insert(choices, {text='This fortress', data={fn=curry(select_site, site)}})
161-
local fort = df.historical_entity.find(df.global.plotinfo.group_id)
163+
table.insert(choices, {text='This fortress/site', data={fn=curry(select_entity, site)}})
162164
if fort and #fort.squads > 0 then
163165
table.insert(choices, {text='A squad', data={fn=curry(select_squad, fort)}})
164166
end
165167
end
168+
if fort then
169+
table.insert(choices, {text='The government of this fortress', data={fn=curry(select_entity, fort)}})
170+
end
171+
if civ then
172+
table.insert(choices, {text='The civilization of this fortress', data={fn=curry(select_entity, civ)}})
173+
end
166174
if #df.global.world.units.all > 0 then
167175
table.insert(choices, {text='A unit', data={fn=select_unit}})
168176
end

0 commit comments

Comments
 (0)