From f6b9d19762ce686e90d7028c80f0a03a9a95c29c Mon Sep 17 00:00:00 2001 From: Putnam3145 Date: Fri, 24 Apr 2015 18:59:09 -0700 Subject: [PATCH] Make full-heal -r optionally remove corpse. --- scripts/full-heal.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/full-heal.lua b/scripts/full-heal.lua index d7267118c..13a65852d 100644 --- a/scripts/full-heal.lua +++ b/scripts/full-heal.lua @@ -9,7 +9,8 @@ local utils=require('utils') validArgs = validArgs or utils.invert({ 'r', 'help', - 'unit' + 'unit', + 'keep_corpse' }) local args = utils.processArgs({...}, validArgs) @@ -20,6 +21,8 @@ if args.help then print(' heal the unit with the given id') 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(' 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(' heal the currently selected unit') print(' full-heal -r') @@ -49,6 +52,15 @@ if unit then unit.flags1.dead = false unit.flags2.killed = 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 end