Make full-heal -r optionally remove corpse.

develop
Putnam3145 2015-04-24 18:59:09 -07:00
parent 0849099f20
commit f6b9d19762
1 changed files with 13 additions and 1 deletions

@ -9,7 +9,8 @@ local utils=require('utils')
validArgs = validArgs or utils.invert({ validArgs = validArgs or utils.invert({
'r', 'r',
'help', 'help',
'unit' 'unit',
'keep_corpse'
}) })
local args = utils.processArgs({...}, validArgs) local args = utils.processArgs({...}, validArgs)
@ -20,6 +21,8 @@ if args.help then
print(' heal the unit with the given id') print(' heal the unit with the given id')
print(' full-heal -r -unit [unitId]') print(' full-heal -r -unit [unitId]')
print(' heal the unit with the given id and bring them back from death if they are dead') print(' heal the unit with the given id and bring them back from death if they are dead')
print(' full-heal -r -keep_corpse -unit [unitId]')
print(' heal the unit with the given id and bring them back from death if they are dead, without removing their corpse')
print(' full-heal') print(' full-heal')
print(' heal the currently selected unit') print(' heal the currently selected unit')
print(' full-heal -r') print(' full-heal -r')
@ -49,6 +52,15 @@ if unit then
unit.flags1.dead = false unit.flags1.dead = false
unit.flags2.killed = false unit.flags2.killed = false
unit.flags3.ghostly = false unit.flags3.ghostly = false
if not args.keep_corpse then
for _,corpse in ipairs(df.global.world.items.other.CORPSE) do
if corpse.unit_id==unit.id then
corpse.flags.garbage_collect=true
corpse.flags.forbid=true
corpse.flags.hidden=true
end
end
end
--unit.unk_100 = 3 --unit.unk_100 = 3
end end