Skip to content

Instantly share code, notes, and snippets.

@warmist
Created April 9, 2012 18:19
Show Gist options
  • Save warmist/2345207 to your computer and use it in GitHub Desktop.
Save warmist/2345207 to your computer and use it in GitHub Desktop.
Healing a unit.
function heal(unit)
unit.body.wounds:resize(0) -- memory leak here :/
unit.body.blood_count=unit.body.blood_max
--set flags for standing and grasping...
unit.status2.able_stand=4
unit.status2.able_stand_impair=4
unit.status2.able_grasp=4
unit.status2.able_grasp_impair=4
--should also set temperatures, and flags for breath etc...
unit.flags1.dead=false
unit.flags2.calculated_bodyparts=false
unit.flags2.calculated_nerves=false
unit.flags2.circulatory_spray=false
unit.flags2.vision_good=true
unit.flags2.vision_damaged=false
unit.flags2.vision_missing=false
unit.counters.winded=0
unit.counters.unconscious=0
for k,v in pairs(unit.body.components) do
for kk,vv in pairs(v) do
v[kk]=0
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment