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,64 +231,50 @@ 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 local objects = minetest.get_objects_inside_radius(pos, 1)
minetest.register_globalstep(function(dtime) for _,obj in ipairs(objects) do
timer = timer + dtime if obj:is_player() then
if timer >= 0.3 then if not minetest.is_creative_enabled(obj:get_player_name()) then
local objects = minetest.get_objects_inside_radius(pos, 1) if obj:get_inventory():room_for_item("main", "mcl_tridents") and not self._picked_up then
for _,obj in ipairs(objects) do obj:get_inventory():add_item("main", "mcl_tridents:trident")
if obj:is_player() then minetest.sound_play("item_drop_pickup", {
if not minetest.is_creative_enabled(obj:get_player_name()) then pos = pos,
if obj:get_inventory():room_for_item("main", "mcl_tridents") and not self._picked_up then max_hear_distance = 16,
obj:get_inventory():add_item("main", "mcl_tridents:trident") gain = 1.0,
minetest.sound_play("item_drop_pickup", { }, true)
pos = pos, self._picked_up = true
max_hear_distance = 16,
gain = 1.0,
}, true)
self._picked_up = true
end
end
mcl_burning.extinguish(self.object)
self.object:remove()
return
end end
end end
timer = 0 mcl_burning.extinguish(self.object)
self.object:remove()
return
end end
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 if self._damage >= 9 and self._in_player == false then
minetest.register_globalstep(function(dtime) minetest.add_particlespawner({
timer = timer + dtime amount = 10,
if timer >= 0.3 then time = 0.1,
if self._damage >= 9 and self._in_player == false then minpos = vector.subtract(pos, vector.new(0.5, 0.5, 0.5)),
minetest.add_particlespawner({ maxpos = vector.add(pos, vector.new(0.5, 0.5, 0.5)),
amount = 10, minvel = vector.new(-1, -1, -1),
time = 0.1, maxvel = vector.new(1, 1, 1),
minpos = vector.subtract(pos, vector.new(0.5, 0.5, 0.5)), minacc = vector.new(0, -3, 0),
maxpos = vector.add(pos, vector.new(0.5, 0.5, 0.5)), maxacc = vector.new(0, -3, 0),
minvel = vector.new(-1, -1, -1), minexptime = 0.5,
maxvel = vector.new(1, 1, 1), maxexptime = 1,
minacc = vector.new(0, -3, 0), minsize = 0.5,
maxacc = vector.new(0, -3, 0), maxsize = 1,
minexptime = 0.5, collisiondetection = true,
maxexptime = 1, collision_removal = true,
minsize = 0.5, object_collision = true,
maxsize = 1, texture = "mcl_tridents_trail.png",
collisiondetection = true, playername = "",
collision_removal = true, })
object_collision = true, end
texture = "mcl_tridents_trail.png",
playername = "",
})
end
timer = 0
end
end)
local closest_object local closest_object
local closest_distance local closest_distance