From b66c1268d7e81e867fe3a2efee29230c9338ebb7 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 19 Sep 2017 17:16:04 +0200 Subject: [PATCH] Blaze fireball / fire charge: Take fly dir into account when spawning fire --- mods/ENTITIES/mobs_mc/blaze.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/blaze.lua b/mods/ENTITIES/mobs_mc/blaze.lua index 3af101055..3c68126d3 100644 --- a/mods/ENTITIES/mobs_mc/blaze.lua +++ b/mods/ENTITIES/mobs_mc/blaze.lua @@ -97,9 +97,18 @@ mobs:register_arrow("mobs_mc:blaze_fireball", { -- Node hit, make fire hit_node = function(self, pos, node) - local pos_above = {x=pos.x, y=pos.y+1, z=pos.z} - if minetest.registered_nodes[minetest.get_node(pos_above).name].buildable_to then + if node.name == "air" then minetest.set_node(pos_above, {name=mobs_mc.items.fire}) + else + local v = self.object:getvelocity() + v = vector.normalize(v) + local crashpos = vector.subtract(pos, v) + local crashnode = minetest.get_node(crashpos) + -- Set fire if node is air, or a replacable flammable node (e.g. a plant) + if crashnode.name == "air" or + (minetest.registered_nodes[crashnode.name].buildable_to and minetest.get_item_group(crashnode.name, "flammable") >= 1) then + minetest.set_node(crashpos, {name=mobs_mc.items.fire}) + end end end })