slow player down while holding loaded rocket

This commit is contained in:
olliy 2021-04-20 19:28:51 +05:00 committed by GitHub
parent 6939ab0b6d
commit 0bdc630241
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -135,9 +135,26 @@ if shooter.config.enable_crafting == true then
}) })
end end
local timer = 0
minetest.register_globalstep(function(dtime)
timer = timer + dtime
if timer >= 0.1 then
for _, player in ipairs(minetest.get_connected_players()) do
local name = player and player:get_player_name()
local wielditem = player:get_wielded_item()
if wielditem:get_name() == "shooter_rocket:rocket_gun_loaded" then
local wielditem = player:get_wielded_item()
player:set_physics_override({
speed = 0.7
})
timer = 0
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")
minetest.register_alias("shooter:rocket_gun_loaded", "shooter_rocket:rocket_gun_loaded") minetest.register_alias("shooter:rocket_gun_loaded", "shooter_rocket:rocket_gun_loaded")