create-unit: add nickname option

develop
lethosor 2015-10-26 21:02:03 -04:00
parent daf20c16bd
commit 7dd091e57a
1 changed files with 8 additions and 1 deletions

@ -103,7 +103,7 @@ function createFigure(trgunit,he,he_group)
hf.sex = trgunit.sex hf.sex = trgunit.sex
df.global.hist_figure_next_id=df.global.hist_figure_next_id+1 df.global.hist_figure_next_id=df.global.hist_figure_next_id+1
hf.appeared_year = df.global.cur_year hf.appeared_year = df.global.cur_year
hf.born_year = trgunit.relations.birth_year hf.born_year = trgunit.relations.birth_year
hf.born_seconds = trgunit.relations.birth_time hf.born_seconds = trgunit.relations.birth_time
hf.curse_year = trgunit.relations.curse_year hf.curse_year = trgunit.relations.curse_year
@ -330,6 +330,7 @@ validArgs = --[[validArgs or]]utils.invert({
'flagSet', 'flagSet',
'flagClear', 'flagClear',
'name', 'name',
'nick',
'location', 'location',
'age' 'age'
}) })
@ -369,6 +370,8 @@ arguments:
set the unit's name to be a random name appropriate for the given entity set the unit's name to be a random name appropriate for the given entity
examples: examples:
MOUNTAIN MOUNTAIN
-nick nickname
set the unit's nickname directly
-location [ x y z ] -location [ x y z ]
create the unit at the specified coordinates create the unit at the specified coordinates
-age howOld -age howOld
@ -505,6 +508,10 @@ else
end--]] end--]]
end end
if args.nick and type(args.nick) == 'string' then
dfhack.units.setNickname(df.unit.find(unitId), args.nick)
end
if civ_id then if civ_id then
local u = df.unit.find(unitId) local u = df.unit.find(unitId)
u.civ_id = civ_id u.civ_id = civ_id