Add sprinting at spawn. Fix bug
This commit is contained in:
parent
8364cb27fd
commit
88824fb42a
@ -10,6 +10,7 @@ dofile(minetest.get_modpath("game").."/items.lua")
|
|||||||
dofile(minetest.get_modpath("game").."/awards.lua")
|
dofile(minetest.get_modpath("game").."/awards.lua")
|
||||||
dofile(minetest.get_modpath("game").."/armor.lua")
|
dofile(minetest.get_modpath("game").."/armor.lua")
|
||||||
dofile(minetest.get_modpath("game").."/friends.lua")
|
dofile(minetest.get_modpath("game").."/friends.lua")
|
||||||
|
dofile(minetest.get_modpath("game").."/sprint.lua")
|
||||||
|
|
||||||
minetest.register_item(":", {
|
minetest.register_item(":", {
|
||||||
type = "none",
|
type = "none",
|
||||||
@ -173,7 +174,7 @@ minetest.register_on_respawnplayer(function(player)
|
|||||||
local meta = player:get_meta()
|
local meta = player:get_meta()
|
||||||
|
|
||||||
if meta:get_string("location") == "dungeon" then
|
if meta:get_string("location") == "dungeon" then
|
||||||
if #game.parties[game.party[name]] <= 1 then
|
if game.get_table_size(game.parties[game.party[name]]) <= 1 then
|
||||||
game.clear_mobs_near(player:get_pos(), 150)
|
game.clear_mobs_near(player:get_pos(), 150)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
20
mods/game/sprint.lua
Normal file
20
mods/game/sprint.lua
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
local sprint_step = 0
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
|
sprint_step = sprint_step + dtime
|
||||||
|
|
||||||
|
if sprint_step >= 0.5 then
|
||||||
|
sprint_step = 0
|
||||||
|
|
||||||
|
for _, p in ipairs(minetest.get_connected_players()) do
|
||||||
|
local meta = p:get_meta()
|
||||||
|
|
||||||
|
if meta:get_string("location") == "spawn" and p:get_player_control().aux1 == true then
|
||||||
|
p:set_physics_override({speed = 2})
|
||||||
|
else
|
||||||
|
if p:get_physics_override().speed ~= 1 then
|
||||||
|
p:set_physics_override({speed = 1})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
Loading…
x
Reference in New Issue
Block a user