Removed Sprint mod
It doesnot work with the armor slowing.
This commit is contained in:
parent
fe01905161
commit
6771e20be1
@ -1,13 +0,0 @@
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
@ -1,52 +0,0 @@
|
||||
Sprint Mod For Minetest by GunshipPenguin
|
||||
|
||||
Allows the player to sprint by double tapping w. By default,
|
||||
sprinting will make the player travel 50% faster and allow him/her
|
||||
to jump 10% higher.
|
||||
|
||||
Licence: WTFPL (see LICENCE file)
|
||||
|
||||
|
||||
---
|
||||
|
||||
This mod can be configured by changing the variables declared in
|
||||
the start of init.lua. The following is a brief explanation of each
|
||||
one.
|
||||
|
||||
SPRINT_SPEED (default 1.5)
|
||||
|
||||
How fast the player will move when sprinting as opposed to normal
|
||||
movement speed. 1.0 represents normal speed so 1.5 would mean that a
|
||||
sprinting player would travel 50% faster than a walking player and
|
||||
2.4 would mean that a sprinting player would travel 140% faster than
|
||||
a walking player.
|
||||
|
||||
SPRINT_JUMP (default 1.1)
|
||||
|
||||
How high the player will jump when sprinting as opposed to normal
|
||||
jump height. Same as SPRINT_SPEED, just controls jump height while
|
||||
sprinting rather than speed.
|
||||
|
||||
SPRINT_STAMINA (default 20)
|
||||
|
||||
How long the player can sprint for in seconds. Each player has a
|
||||
stamina variable assigned to them, it is initially set to
|
||||
SPRINT_STAMINA and can go no higher. When the player is sprinting,
|
||||
this variable ticks down once each second, and when it reaches 0,
|
||||
the player stops sprinting and may be sent a warning depending on
|
||||
the value of SPRINT_WARN. It ticks back up when the player isn't
|
||||
sprinting and stops at SPRINT_STAMINA. Set this to a huge value if
|
||||
you want unlimited sprinting.
|
||||
|
||||
SPRINT_TIMEOUT (default 0.5)
|
||||
|
||||
How much time the player has after releasing w, to press w again and
|
||||
start sprinting. Setting this too high will result in unwanted
|
||||
sprinting and setting it too low will result in it being
|
||||
difficult/impossible to sprint.
|
||||
|
||||
SPRINT_WARN (default true)
|
||||
|
||||
If the player should be warned that his/her stamina has run out via
|
||||
the in game chat system. You may want to set this to false if the
|
||||
notifications get annoying.
|
@ -1,103 +0,0 @@
|
||||
--Sprint mod for Minetest by GunshipPenguin
|
||||
|
||||
--Configuration variables, these are all explained in README.md
|
||||
local SPRINT_SPEED = 1.8
|
||||
local SPRINT_JUMP = 1.1
|
||||
local SPRINT_STAMINA = 3
|
||||
local SPRINT_TIMEOUT = 0.5
|
||||
local SPRINT_WARN = false
|
||||
|
||||
local players = {}
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
players[player:get_player_name()] = {state = 0, timeOut = 0, stamina = SPRINT_STAMINA, moving = false}
|
||||
end)
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
playerName = player:get_player_name()
|
||||
players[playerName] = nil
|
||||
end)
|
||||
minetest.register_globalstep(function(dtime)
|
||||
--Get the gametime
|
||||
local gameTime = minetest.get_gametime()
|
||||
|
||||
--Loop through all connected players
|
||||
for playerName,playerInfo in pairs(players) do
|
||||
local player = minetest.get_player_by_name(playerName)
|
||||
if player ~= nil then
|
||||
--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
|
||||
players[playerName]["timeOut"] = nil
|
||||
setState(playerName, 0)
|
||||
end
|
||||
|
||||
--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()
|
||||
local playerNode = minetest.get_node({x=playerPos["x"], y=playerPos["y"]-1, z=playerPos["z"]})
|
||||
if playerNode["name"] ~= "air" then
|
||||
for i=1, numParticles, 1 do
|
||||
minetest.add_particle({
|
||||
pos = {x=playerPos["x"]+math.random(-1,1)*math.random()/2,y=playerPos["y"]+0.1,z=playerPos["z"]+math.random(-1,1)*math.random()/2},
|
||||
vel = {x=0, y=5, z=0},
|
||||
acc = {x=0, y=-13, z=0},
|
||||
expirationtime = math.random(),
|
||||
size = math.random()+0.5,
|
||||
collisiondetection = true,
|
||||
vertical = false,
|
||||
texture = "default_dirt.png",
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Adjust player states
|
||||
if players[playerName]["moving"] == false and playerInfo["state"] == 3 then --Stopped
|
||||
setState(playerName, 0)
|
||||
elseif players[playerName]["moving"] == true and playerInfo["state"] == 0 then --Moving
|
||||
setState(playerName, 1)
|
||||
elseif players[playerName]["moving"] == false and playerInfo["state"] == 1 then --Primed
|
||||
setState(playerName, 2)
|
||||
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
|
||||
playerInfo["stamina"] = playerInfo["stamina"] - dtime
|
||||
if playerInfo["stamina"] <= 0 then
|
||||
playerInfo["stamina"] = 0
|
||||
setState(playerName, 0)
|
||||
if SPRINT_WARN then
|
||||
minetest.chat_send_player(playerName, "Your sprint stamina has run out!")
|
||||
end
|
||||
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
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
function setState(playerName, state) --Sets the state of a player (0=stopped, 1=moving, 2=primed, 3=sprinting)
|
||||
local player = minetest.get_player_by_name(playerName)
|
||||
local gameTime = minetest.get_gametime()
|
||||
if players[playerName] then
|
||||
players[playerName]["state"] = state
|
||||
if state == 0 then--Stopped
|
||||
player:set_physics_override({speed=1.0,jump=1.0})
|
||||
elseif state == 2 then --Primed
|
||||
players[playerName]["timeOut"] = gameTime
|
||||
elseif state == 3 then --Sprinting
|
||||
player:set_physics_override({speed=SPRINT_SPEED,jump=SPRINT_JUMP})
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user