|
|
@ -3,36 +3,40 @@
|
|
|
|
--edited by expwnent
|
|
|
|
--edited by expwnent
|
|
|
|
|
|
|
|
|
|
|
|
-- attempt to fully heal a selected unit, option -r to attempt to resurrect the unit
|
|
|
|
-- attempt to fully heal a selected unit, option -r to attempt to resurrect the unit
|
|
|
|
local args = {...}
|
|
|
|
|
|
|
|
local resurrect = false
|
|
|
|
local utils=require('utils')
|
|
|
|
local i=0
|
|
|
|
|
|
|
|
for _,arg in ipairs(args) do
|
|
|
|
validArgs = validArgs or utils.invert({
|
|
|
|
if arg == '-r' or arg == '-R' then
|
|
|
|
'r',
|
|
|
|
resurrect = true
|
|
|
|
'help',
|
|
|
|
elseif tonumber(arg) then
|
|
|
|
'unit'
|
|
|
|
unit = df.unit.find(tonumber(arg))
|
|
|
|
})
|
|
|
|
elseif arg == 'help' or arg == '-help' or arg == '-h' then
|
|
|
|
|
|
|
|
|
|
|
|
local args = utils.processArgs({...}, validArgs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if args.help then
|
|
|
|
print('full-heal: heal a unit completely from anything, optionally including death.')
|
|
|
|
print('full-heal: heal a unit completely from anything, optionally including death.')
|
|
|
|
print(' full-heal [unitId]')
|
|
|
|
print(' full-heal -unit [unitId]')
|
|
|
|
print(' heal the unit with the given id')
|
|
|
|
print(' heal the unit with the given id')
|
|
|
|
print(' full-heal -r [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')
|
|
|
|
print(' full-heal')
|
|
|
|
print(' heal the currently selected unit')
|
|
|
|
print(' heal the currently selected unit')
|
|
|
|
print(' full-heal -r')
|
|
|
|
print(' full-heal -r')
|
|
|
|
print(' heal the currently selected unit and bring them back from death if they are dead')
|
|
|
|
print(' heal the currently selected unit and bring them back from death if they are dead')
|
|
|
|
print(' full-heal help')
|
|
|
|
print(' full-heal -help')
|
|
|
|
print(' print this help message')
|
|
|
|
print(' print this help message')
|
|
|
|
return
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
unit = unit or dfhack.gui.getSelectedUnit()
|
|
|
|
|
|
|
|
|
|
|
|
unit = df.unit.find(args.unit) or dfhack.gui.getSelectedUnit()
|
|
|
|
|
|
|
|
|
|
|
|
if not unit then
|
|
|
|
if not unit then
|
|
|
|
qerror('Error: please select a unit or pass its id as an argument.')
|
|
|
|
qerror('Error: please select a unit or pass its id as an argument.')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if unit then
|
|
|
|
if unit then
|
|
|
|
if resurrect then
|
|
|
|
if args.r then
|
|
|
|
if unit.flags1.dead then
|
|
|
|
if unit.flags1.dead then
|
|
|
|
--print("Resurrecting...")
|
|
|
|
--print("Resurrecting...")
|
|
|
|
unit.flags2.slaughter = false
|
|
|
|
unit.flags2.slaughter = false
|
|
|
@ -90,7 +94,7 @@ if unit then
|
|
|
|
unit.counters2.vomit_timeout=0
|
|
|
|
unit.counters2.vomit_timeout=0
|
|
|
|
|
|
|
|
|
|
|
|
--print("Resetting body part status...")
|
|
|
|
--print("Resetting body part status...")
|
|
|
|
v=unit.body.components
|
|
|
|
local v=unit.body.components
|
|
|
|
for i=0,#v.nonsolid_remaining - 1,1 do
|
|
|
|
for i=0,#v.nonsolid_remaining - 1,1 do
|
|
|
|
v.nonsolid_remaining[i] = 100 -- percent remaining of fluid layers (Urist Da Vinci)
|
|
|
|
v.nonsolid_remaining[i] = 100 -- percent remaining of fluid layers (Urist Da Vinci)
|
|
|
|
end
|
|
|
|
end
|
|
|
|