Adds fire and lava collision to boats

This commit is contained in:
opfromthestart 2022-08-08 20:12:44 -04:00
parent 3922c5bdca
commit 76839961c6

View file

@ -24,6 +24,10 @@ local function is_ice(pos)
return is_group(pos, "ice") return is_group(pos, "ice")
end end
local function is_fire(pos)
return is_group(pos, "set_on_fire")
end
local function get_sign(i) local function get_sign(i)
if i == 0 then if i == 0 then
return 0 return 0
@ -216,6 +220,13 @@ function boat.on_step(self, dtime, moveresult)
on_water = false on_water = false
if not in_water and is_ice(waterp) then if not in_water and is_ice(waterp) then
on_ice = true on_ice = true
elseif is_fire({x=p.x, y=p.y-boat_y_offset, z=p.z}) then
if self.object:get_hp() <= 0 then
boat.on_death(self, nil)
self.object:remove()
return
end
self.object:set_hp(self.object:get_hp()-1)
else else
v_slowdown = 0.04 v_slowdown = 0.04
v_factor = 0.5 v_factor = 0.5