Updated remove-stress to the new argument system.

develop
expwnent 2014-11-30 09:23:35 -05:00
parent 5dcec6f683
commit 81b75161d6
1 changed files with 27 additions and 7 deletions

@ -3,12 +3,32 @@
--By Putnam; http://www.bay12forums.com/smf/index.php?topic=139553.msg5820486#msg5820486 --By Putnam; http://www.bay12forums.com/smf/index.php?topic=139553.msg5820486#msg5820486
local args = {...} local utils = require 'utils'
if args[1]=='all' then validArgs = validArgs or utils.invert({
for k,v in ipairs(df.global.world.units.active) do 'help',
v.status.current_soul.personality.stress_level=-1000000 'all'
end })
local args = utils.processArgs({...}, validArgs)
if args.help then
print([[
remove-stress [-all]
sets the stress level of every unit to -1000000, or just the selected unit if the '-all' argument is not given
]])
return
end
if args.all then
for k,v in ipairs(df.global.world.units.active) do
v.status.current_soul.personality.stress_level=-1000000
end
else else
dfhack.gui.getSelectedUnit().status.current_soul.personality.stress_level=-1000000 local unit = dfhack.gui.getSelectedUnit()
end if unit then
unit.status.current_soul.personality.stress_level=-1000000
else
error 'Invalid usage: No unit selected and -all argument not given.'
end
end