Split mcl_playerplus to mcl_playerinfo for the node info
This commit is contained in:
parent
5ef42f27ec
commit
705dae46a0
11 changed files with 172 additions and 72 deletions
|
@ -14,6 +14,16 @@ mcl_sprint.SPEED = 1.3
|
|||
|
||||
local players = {}
|
||||
|
||||
-- Returns true if the player with the given name is sprinting, false if not.
|
||||
-- Returns nil if player does not exist.
|
||||
mcl_sprint.is_sprinting = function(playername)
|
||||
if players[playername] then
|
||||
return players[playername].sprinting
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local playerName = player:get_player_name()
|
||||
|
||||
|
@ -82,7 +92,7 @@ minetest.register_globalstep(function(dtime)
|
|||
if players[playerName]["shouldSprint"] == true then --Stopped
|
||||
local sprinting
|
||||
-- Prevent sprinting if standing on soul sand or hungry
|
||||
if mcl_playerplus[playerName].node_stand == "mcl_nether:soul_sand" or (mcl_hunger.active and mcl_hunger.get_hunger(player) <= 6) then
|
||||
if mcl_playerinfo[playerName].node_stand == "mcl_nether:soul_sand" or (mcl_hunger.active and mcl_hunger.get_hunger(player) <= 6) then
|
||||
sprinting = false
|
||||
else
|
||||
sprinting = true
|
||||
|
@ -101,7 +111,7 @@ function setSprinting(playerName, sprinting) --Sets the state of a player (0=sto
|
|||
if players[playerName] then
|
||||
players[playerName]["sprinting"] = sprinting
|
||||
-- Don't overwrite physics when standing on soul sand or sleeping
|
||||
if mcl_playerplus[playerName].node_stand ~= "mcl_nether:soul_sand" and player:get_attribute("mcl_beds:sleeping") ~= "true" then
|
||||
if mcl_playerinfo[playerName].node_stand ~= "mcl_nether:soul_sand" and player:get_attribute("mcl_beds:sleeping") ~= "true" then
|
||||
if sprinting == true then
|
||||
player:set_physics_override({speed=mcl_sprint.SPEED})
|
||||
elseif sprinting == false then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue