mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-06-28 14:16:06 +02:00
Removed whitespaces
This commit is contained in:
@ -2,9 +2,9 @@
|
||||
Sprint mod for Minetest by GunshipPenguin
|
||||
|
||||
To the extent possible under law, the author(s)
|
||||
have dedicated all copyright and related and neighboring rights
|
||||
have dedicated all copyright and related and neighboring rights
|
||||
to this software to the public domain worldwide. This software is
|
||||
distributed without any warranty.
|
||||
distributed without any warranty.
|
||||
]]
|
||||
|
||||
local players = {}
|
||||
@ -15,9 +15,9 @@ minetest.register_on_joinplayer(function(player)
|
||||
|
||||
players[playerName] = {
|
||||
sprinting = false,
|
||||
timeOut = 0,
|
||||
stamina = SPRINT_STAMINA,
|
||||
epressed = false,
|
||||
timeOut = 0,
|
||||
stamina = SPRINT_STAMINA,
|
||||
epressed = false,
|
||||
}
|
||||
if SPRINT_HUDBARS_USED then
|
||||
hb.init_hudbar(player, "sprint")
|
||||
@ -61,12 +61,12 @@ minetest.register_globalstep(function(dtime)
|
||||
setSprinting(playerName, false)
|
||||
playerInfo["timeOut"] = 3
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
if gameTime > 0.4 then
|
||||
gameTime = 0
|
||||
local pos = player:getpos()
|
||||
-- From playerplus :
|
||||
-- From playerplus :
|
||||
-- am I near a cactus?
|
||||
pos.y = pos.y + 0.1
|
||||
local near = minetest.find_node_near(pos, 1, "default:cactus")
|
||||
@ -75,8 +75,8 @@ minetest.register_globalstep(function(dtime)
|
||||
player:set_hp(player:get_hp()-1)
|
||||
end
|
||||
end
|
||||
|
||||
--If the player is sprinting, create particles behind him/her
|
||||
|
||||
--If the player is sprinting, create particles behind him/her
|
||||
if playerInfo["sprinting"] == true then
|
||||
local numParticles = math.random(1, 2)
|
||||
local playerPos = player:getpos()
|
||||
@ -97,14 +97,14 @@ minetest.register_globalstep(function(dtime)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Adjust player states
|
||||
if players[playerName]["epressed"] == true and playerInfo["timeOut"] == 0 then --Stopped
|
||||
setSprinting(playerName, true)
|
||||
elseif players[playerName]["epressed"] == false then
|
||||
setSprinting(playerName, false)
|
||||
end
|
||||
|
||||
|
||||
if playerInfo["timeOut"] > 0 then
|
||||
playerInfo["timeOut"] = playerInfo["timeOut"] - dtime
|
||||
if playerInfo["timeOut"] < 0 then
|
||||
@ -112,7 +112,7 @@ minetest.register_globalstep(function(dtime)
|
||||
end
|
||||
else
|
||||
--Lower the player's stamina by dtime if he/she is sprinting and set his/her state to 0 if stamina is zero
|
||||
if playerInfo["sprinting"] == true then
|
||||
if playerInfo["sprinting"] == true then
|
||||
playerInfo["stamina"] = playerInfo["stamina"] - dtime
|
||||
if playerInfo["stamina"] <= 0 then
|
||||
playerInfo["stamina"] = 0
|
||||
@ -122,7 +122,7 @@ minetest.register_globalstep(function(dtime)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Increase player's stamina if he/she is not sprinting and his/her stamina is less than SPRINT_STAMINA
|
||||
if playerInfo["sprinting"] == false and playerInfo["stamina"] < SPRINT_STAMINA then
|
||||
playerInfo["stamina"] = playerInfo["stamina"] + dtime
|
||||
@ -131,7 +131,7 @@ minetest.register_globalstep(function(dtime)
|
||||
if playerInfo["stamina"] > SPRINT_STAMINA then
|
||||
playerInfo["stamina"] = SPRINT_STAMINA
|
||||
end
|
||||
|
||||
|
||||
--Update the players's hud sprint stamina bar
|
||||
|
||||
if SPRINT_HUDBARS_USED then
|
||||
|
@ -2,9 +2,9 @@
|
||||
Sprint mod for Minetest by GunshipPenguin
|
||||
|
||||
To the extent possible under law, the author(s)
|
||||
have dedicated all copyright and related and neighboring rights
|
||||
have dedicated all copyright and related and neighboring rights
|
||||
to this software to the public domain worldwide. This software is
|
||||
distributed without any warranty.
|
||||
distributed without any warranty.
|
||||
]]
|
||||
|
||||
--Configuration variables, these are all explained in README.md
|
||||
|
@ -2,9 +2,9 @@
|
||||
Sprint mod for Minetest by GunshipPenguin
|
||||
|
||||
To the extent possible under law, the author(s)
|
||||
have dedicated all copyright and related and neighboring rights
|
||||
have dedicated all copyright and related and neighboring rights
|
||||
to this software to the public domain worldwide. This software is
|
||||
distributed without any warranty.
|
||||
distributed without any warranty.
|
||||
]]
|
||||
|
||||
local players = {}
|
||||
@ -13,10 +13,10 @@ local staminaHud = {}
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local playerName = player:get_player_name()
|
||||
players[playerName] = {
|
||||
state = 0,
|
||||
timeOut = 0,
|
||||
stamina = SPRINT_STAMINA,
|
||||
moving = false,
|
||||
state = 0,
|
||||
timeOut = 0,
|
||||
stamina = SPRINT_STAMINA,
|
||||
moving = false,
|
||||
}
|
||||
|
||||
if SPRINT_HUDBARS_USED then
|
||||
@ -53,7 +53,7 @@ minetest.register_globalstep(function(dtime)
|
||||
local near = minetest.find_node_near(pos, 1, "default:cactus")
|
||||
if near then
|
||||
pos = near
|
||||
|
||||
|
||||
-- am I touching the cactus? if so it hurts
|
||||
for _,player in ipairs(minetest.get_objects_inside_radius(pos, 1.0)) do
|
||||
if player:get_hp() > 0 then
|
||||
@ -61,10 +61,10 @@ minetest.register_globalstep(function(dtime)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Check if they are moving or not
|
||||
players[playerName]["moving"] = player:get_player_control()["up"]
|
||||
|
||||
|
||||
--If the player has tapped w longer than SPRINT_TIMEOUT ago, set his/her state to 0
|
||||
if playerInfo["state"] == 2 then
|
||||
if playerInfo["timeOut"] + SPRINT_TIMEOUT < gameTime then
|
||||
@ -72,7 +72,7 @@ minetest.register_globalstep(function(dtime)
|
||||
setState(playerName, 0)
|
||||
end
|
||||
|
||||
--If the player is sprinting, create particles behind him/her
|
||||
--If the player is sprinting, create particles behind him/her
|
||||
elseif playerInfo["state"] == 3 and gameTime % 0.1 == 0 then
|
||||
local numParticles = math.random(1, 2)
|
||||
local playerPos = player:getpos()
|
||||
@ -103,16 +103,16 @@ minetest.register_globalstep(function(dtime)
|
||||
elseif players[playerName]["moving"] == true and playerInfo["state"] == 2 then --Sprinting
|
||||
setState(playerName, 3)
|
||||
end
|
||||
|
||||
|
||||
--Lower the player's stamina by dtime if he/she is sprinting and set his/her state to 0 if stamina is zero
|
||||
if playerInfo["state"] == 3 then
|
||||
if playerInfo["state"] == 3 then
|
||||
playerInfo["stamina"] = playerInfo["stamina"] - dtime
|
||||
if playerInfo["stamina"] <= 0 then
|
||||
playerInfo["stamina"] = 0
|
||||
setState(playerName, 0)
|
||||
minetest.sound_play("default_breathless",{object=player})
|
||||
end
|
||||
|
||||
|
||||
--Increase player's stamina if he/she is not sprinting and his/her stamina is less than SPRINT_STAMINA
|
||||
elseif playerInfo["state"] ~= 3 and playerInfo["stamina"] < SPRINT_STAMINA then
|
||||
playerInfo["stamina"] = playerInfo["stamina"] + dtime
|
||||
@ -121,7 +121,7 @@ minetest.register_globalstep(function(dtime)
|
||||
if playerInfo["stamina"] > SPRINT_STAMINA then
|
||||
playerInfo["stamina"] = SPRINT_STAMINA
|
||||
end
|
||||
|
||||
|
||||
--Update the players's hud sprint stamina bar
|
||||
|
||||
if SPRINT_HUDBARS_USED then
|
||||
|
Reference in New Issue
Block a user