Merge pull request #62 from Poikilos/patch-1

Detect if the object is dying rather than dead.
This commit is contained in:
D00Med 2022-12-31 06:30:17 +10:00 committed by GitHub
commit f90443761a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -737,9 +737,9 @@ function vehicles.explodinate(ent, radius)
end) end)
end end
function vehicles.on_punch(self, puncher) function vehicles.on_punch(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
local hp = self.object:get_hp() local hp = self.object:get_hp()
if hp == 0 then if (hp - damage) < 1 then
if self.driver then if self.driver then
vehicles.object_detach(self, self.driver, {x=1, y=0, z=1}) vehicles.object_detach(self, self.driver, {x=1, y=0, z=1})
end end