mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-12 02:50:25 +01:00
better test in snow_entity
This commit is contained in:
parent
7b8caf54ea
commit
7437e9d6a4
@ -80,6 +80,7 @@ local snow_snowball_ENTITY = {
|
|||||||
physical = false,
|
physical = false,
|
||||||
timer = 0,
|
timer = 0,
|
||||||
collisionbox = {-5/16,-5/16,-5/16, 5/16,5/16,5/16},
|
collisionbox = {-5/16,-5/16,-5/16, 5/16,5/16,5/16},
|
||||||
|
thrower = "",
|
||||||
}
|
}
|
||||||
|
|
||||||
function snow_snowball_ENTITY.on_activate(self)
|
function snow_snowball_ENTITY.on_activate(self)
|
||||||
@ -114,18 +115,21 @@ function snow_snowball_ENTITY.on_step(self, dtime)
|
|||||||
if self.timer > 600 then
|
if self.timer > 600 then
|
||||||
-- 10 minutes are too long for a snowball to fly somewhere
|
-- 10 minutes are too long for a snowball to fly somewhere
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.timer > 0.15 then
|
if self.timer > 0.15 then
|
||||||
for i, v in pairs(minetest.get_objects_inside_radius(self.object:getpos(), 1)) do
|
for i, v in pairs(minetest.get_objects_inside_radius(self.object:getpos(), 1)) do
|
||||||
if v ~= self.object then
|
if v ~= self.object then
|
||||||
local entity_name = v:get_entity_name()
|
local entity_name = v:get_entity_name()
|
||||||
if v:get_entity_name() ~= "__builtin:item"
|
if entity_name and entity_name ~= "snow:snowball_entity"
|
||||||
and entity_name ~= "snow:snowball_entity"
|
and entity_name ~= "__builtin:item"
|
||||||
and entity_name ~= "gauges:hp_bar" then
|
and entity_name ~= "gauges:hp_bar" then
|
||||||
if self.thrower then
|
local puncher = self.object
|
||||||
v:punch(minetest.get_player_by_name(self.thrower), 1.0,{full_punch_interval=1.0, damage_groups = {fleshy=1}})
|
if self.thrower and self.thrower ~= "" and minetest.get_player_by_name(self.thrower) then
|
||||||
|
puncher = minetest.get_player_by_name(self.thrower)
|
||||||
end
|
end
|
||||||
|
v:punch(puncher, 1.0, {full_punch_interval=1.0, damage_groups = {fleshy=1} })
|
||||||
minetest.add_item(self.object:getpos(), "default:snow")
|
minetest.add_item(self.object:getpos(), "default:snow")
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user