mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-11 18:40: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,
|
||||
timer = 0,
|
||||
collisionbox = {-5/16,-5/16,-5/16, 5/16,5/16,5/16},
|
||||
thrower = "",
|
||||
}
|
||||
|
||||
function snow_snowball_ENTITY.on_activate(self)
|
||||
@ -114,18 +115,21 @@ function snow_snowball_ENTITY.on_step(self, dtime)
|
||||
if self.timer > 600 then
|
||||
-- 10 minutes are too long for a snowball to fly somewhere
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
|
||||
if self.timer > 0.15 then
|
||||
for i, v in pairs(minetest.get_objects_inside_radius(self.object:getpos(), 1)) do
|
||||
if v ~= self.object then
|
||||
local entity_name = v:get_entity_name()
|
||||
if v:get_entity_name() ~= "__builtin:item"
|
||||
and entity_name ~= "snow:snowball_entity"
|
||||
if entity_name and entity_name ~= "snow:snowball_entity"
|
||||
and entity_name ~= "__builtin:item"
|
||||
and entity_name ~= "gauges:hp_bar" then
|
||||
if self.thrower then
|
||||
v:punch(minetest.get_player_by_name(self.thrower), 1.0,{full_punch_interval=1.0, damage_groups = {fleshy=1}})
|
||||
local puncher = self.object
|
||||
if self.thrower and self.thrower ~= "" and minetest.get_player_by_name(self.thrower) then
|
||||
puncher = minetest.get_player_by_name(self.thrower)
|
||||
end
|
||||
v:punch(puncher, 1.0, {full_punch_interval=1.0, damage_groups = {fleshy=1} })
|
||||
minetest.add_item(self.object:getpos(), "default:snow")
|
||||
self.object:remove()
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user