Merge pull request #8 from bell07/patch-1

setSprint should be a local function
master
Rhys Rustad-Elliott 2018-05-11 22:55:59 -04:00 committed by GitHub
commit d714ce3a33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 14 deletions

View File

@ -10,6 +10,20 @@ distributed without any warranty.
local players = {}
local staminaHud = {}
local function setSprinting(playerName, sprinting) --Sets the state of a player (0=stopped/moving, 1=sprinting)
local player = minetest.get_player_by_name(playerName)
if players[playerName] then
players[playerName]["sprinting"] = sprinting
if sprinting == true then
player:set_physics_override({speed=SPRINT_SPEED,jump=SPRINT_JUMP})
elseif sprinting == false then
player:set_physics_override({speed=1.0,jump=1.0})
end
return true
end
return false
end
minetest.register_on_joinplayer(function(player)
local playerName = player:get_player_name()
@ -109,17 +123,3 @@ minetest.register_globalstep(function(dtime)
end
end
end)
function setSprinting(playerName, sprinting) --Sets the state of a player (0=stopped/moving, 1=sprinting)
local player = minetest.get_player_by_name(playerName)
if players[playerName] then
players[playerName]["sprinting"] = sprinting
if sprinting == true then
player:set_physics_override({speed=SPRINT_SPEED,jump=SPRINT_JUMP})
elseif sprinting == false then
player:set_physics_override({speed=1.0,jump=1.0})
end
return true
end
return false
end