Add _harmless option for rocket arrows

so event fireworks dont grief things
This commit is contained in:
cora 2022-11-18 07:26:44 +01:00
parent 93e5034317
commit c6fc388597
2 changed files with 7 additions and 2 deletions

View file

@ -236,8 +236,12 @@ local function get_point_on_circle(pos,r,n)
end
local function start_firework_rocket(pos)
local pp = get_point_on_circle(pos,math.random(32,64),32)
local o = minetest.add_entity(pp,"mcl_bows:rocket_entity")
local p = get_point_on_circle(pos,math.random(32,64),32)
local n = minetest.get_node(p)
local l = minetest.get_natural_light(pos,0.5)
if n.name ~= "air" or l <= minetest.LIGHT_MAX then return end
local o = minetest.add_entity(p,"mcl_bows:rocket_entity")
o:get_luaentity()._harmless = true
o:set_acceleration(vector.new(math.random(0,2),math.random(30,50),math.random(0,2)))
end

View file

@ -19,6 +19,7 @@ local function dir_to_pitch(dir)
end
local function damage_explosion(self, damagemulitplier)
if self._harmless then return end
local p = self.object:get_pos()
if not p then return end
mcl_explosions.explode(p, 3, {})