Update init.lua

This commit is contained in:
olliy 2021-04-20 20:32:25 +05:00 committed by GitHub
parent a97d88bf08
commit a76b52247a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -139,20 +139,23 @@ local timer = 0
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
timer = timer + dtime timer = timer + dtime
if timer >= 1 then if timer >= 1 then
timer = 0 timer = 0
for _, player in ipairs(minetest.get_connected_players()) do for _, player in ipairs(minetest.get_connected_players()) do
local name = player and player:get_player_name() local name = player and player:get_player_name()
local wielditem = player:get_wielded_item() local wielditem = player:get_wielded_item()
if wielditem:get_name() == "shooter_rocket:rocket_gun_loaded" then if wielditem:get_name() == "shooter_rocket:rocket_gun_loaded" then
local wielditem = player:get_wielded_item() local wielditem = player:get_wielded_item()
player:set_physics_override({ physics.set(name, "shooter_rocket:physics", {
speed = 0.7 speed = 0.7
}) })
end else
physics.remove(name, "shooter_rocket:physics")
end
end end
end end
end) end)
--Backwards compatibility --Backwards compatibility
minetest.register_alias("shooter:rocket", "shooter_rocket:rocket") minetest.register_alias("shooter:rocket", "shooter_rocket:rocket")
minetest.register_alias("shooter:rocket_gun", "shooter_rocket:rocket_gun") minetest.register_alias("shooter:rocket_gun", "shooter_rocket:rocket_gun")