forked from VoxeLibre/VoxeLibre
fork update #10
|
@ -34,8 +34,10 @@ function mcl_util.mcl_log(message, module, bypass_default_logger)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local player_timers = {}
|
||||||
|
|
||||||
-- This is a dtime timer than can be used in on_step functions so it works every x seconds
|
-- This is a dtime timer than can be used in on_step functions so it works every x seconds
|
||||||
-- self - Object you want to store timer data on. E.g. mob or a minecart
|
-- self - Object you want to store timer data on. E.g. mob or a minecart, or player_name
|
||||||
-- dtime - The time since last run of on_step, should be passed in to function
|
-- dtime - The time since last run of on_step, should be passed in to function
|
||||||
-- timer_name - This is the name of the timer and also the key to store the data. No spaces + lowercase.
|
-- timer_name - This is the name of the timer and also the key to store the data. No spaces + lowercase.
|
||||||
-- threshold - The time before it returns successful. 0.2 if you want to run it 5 times a second.
|
-- threshold - The time before it returns successful. 0.2 if you want to run it 5 times a second.
|
||||||
|
@ -43,6 +45,14 @@ function mcl_util.check_dtime_timer(self, dtime, timer_name, threshold)
|
||||||
if not self or not threshold or not dtime then return end
|
if not self or not threshold or not dtime then return end
|
||||||
if not timer_name or timer_name == "" then return end
|
if not timer_name or timer_name == "" then return end
|
||||||
|
|
||||||
|
if type(self) == "string" then
|
||||||
|
local player_name = self
|
||||||
|
if not player_timers[player_name] then
|
||||||
|
player_timers[player_name] = {}
|
||||||
|
end
|
||||||
|
self = player_timers[player_name]
|
||||||
|
end
|
||||||
|
|
||||||
if not self._timers then
|
if not self._timers then
|
||||||
self._timers = {}
|
self._timers = {}
|
||||||
end
|
end
|
||||||
|
|
|
@ -272,10 +272,12 @@ minetest.register_globalstep(function(dtime)
|
||||||
if vector.length(player_velocity) < 40 then
|
if vector.length(player_velocity) < 40 then
|
||||||
-- player:add_velocity(vector.multiply(player:get_look_dir(), 4))
|
-- player:add_velocity(vector.multiply(player:get_look_dir(), 4))
|
||||||
speed_mult = elytra_vars.rocket_speed
|
speed_mult = elytra_vars.rocket_speed
|
||||||
|
|
||||||
|
if mcl_util.check_dtime_timer(name, dtime, "ely_rocket_particle_spawn", 0.3) then
|
||||||
add_particle({
|
add_particle({
|
||||||
pos = fly_pos,
|
pos = fly_pos,
|
||||||
velocity = {x = 0, y = 0, z = 0},
|
velocity = vector.zero(),
|
||||||
acceleration = {x = 0, y = 0, z = 0},
|
acceleration = vector.zero(),
|
||||||
expirationtime = math.random(0.3, 0.5),
|
expirationtime = math.random(0.3, 0.5),
|
||||||
size = math.random(1, 2),
|
size = math.random(1, 2),
|
||||||
collisiondetection = false,
|
collisiondetection = false,
|
||||||
|
@ -285,6 +287,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
elytra.speed = speed_mult -- set the speed so you can keep track of it and add to it
|
elytra.speed = speed_mult -- set the speed so you can keep track of it and add to it
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue