1
0
Fork 0

Remove global_step from on_step

This commit is contained in:
Tuxilio 2023-10-01 10:30:09 +00:00
parent 7abffa8500
commit 65cab094b8
1 changed files with 37 additions and 51 deletions

View File

@ -231,10 +231,6 @@ function TRIDENT_ENTITY.on_step(self, dtime)
self._picked_up = false self._picked_up = false
-- Pickup trident if player is nearby (not in Creative Mode) -- Pickup trident if player is nearby (not in Creative Mode)
local timer = 0
minetest.register_globalstep(function(dtime)
timer = timer + dtime
if timer >= 0.3 then
local objects = minetest.get_objects_inside_radius(pos, 1) local objects = minetest.get_objects_inside_radius(pos, 1)
for _,obj in ipairs(objects) do for _,obj in ipairs(objects) do
if obj:is_player() then if obj:is_player() then
@ -254,17 +250,10 @@ function TRIDENT_ENTITY.on_step(self, dtime)
return return
end end
end end
timer = 0
end
end)
-- Check for object "collision". Done every tick (hopefully this is not too stressing) -- Check for object "collision". Done every tick (hopefully this is not too stressing)
else else
local timer = 0
minetest.register_globalstep(function(dtime)
timer = timer + dtime
if timer >= 0.3 then
if self._damage >= 9 and self._in_player == false then if self._damage >= 9 and self._in_player == false then
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 10, amount = 10,
@ -286,9 +275,6 @@ function TRIDENT_ENTITY.on_step(self, dtime)
playername = "", playername = "",
}) })
end end
timer = 0
end
end)
local closest_object local closest_object
local closest_distance local closest_distance