From 76839961c60008d29b99c21e5e79e9a34119ed2f Mon Sep 17 00:00:00 2001 From: opfromthestart Date: Mon, 8 Aug 2022 20:12:44 -0400 Subject: [PATCH 1/2] Adds fire and lava collision to boats --- mods/ENTITIES/mcl_boats/init.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mods/ENTITIES/mcl_boats/init.lua b/mods/ENTITIES/mcl_boats/init.lua index 087cd7eae5..1f1d85274f 100644 --- a/mods/ENTITIES/mcl_boats/init.lua +++ b/mods/ENTITIES/mcl_boats/init.lua @@ -24,6 +24,10 @@ local function is_ice(pos) return is_group(pos, "ice") end +local function is_fire(pos) + return is_group(pos, "set_on_fire") +end + local function get_sign(i) if i == 0 then return 0 @@ -216,6 +220,13 @@ function boat.on_step(self, dtime, moveresult) on_water = false if not in_water and is_ice(waterp) then 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 v_slowdown = 0.04 v_factor = 0.5 From 5da6f6812fc3efa7fa878c739d0cc56d1a31c26c Mon Sep 17 00:00:00 2001 From: opfromthestart Date: Tue, 9 Aug 2022 12:23:44 -0400 Subject: [PATCH 2/2] faster boat death --- mods/ENTITIES/mcl_boats/init.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/mods/ENTITIES/mcl_boats/init.lua b/mods/ENTITIES/mcl_boats/init.lua index f750e80eb8..0b2d67730f 100644 --- a/mods/ENTITIES/mcl_boats/init.lua +++ b/mods/ENTITIES/mcl_boats/init.lua @@ -223,12 +223,9 @@ function boat.on_step(self, dtime, moveresult) if not in_water and is_ice(waterp) then 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) + boat.on_death(self, nil) + self.object:remove() + return else v_slowdown = 0.04 v_factor = 0.5