Merge pull request 'Merge my own changes into my master branch #4' (#5) from running into master

Reviewed-on: #5
This commit is contained in:
chmodsayshello 2022-02-01 20:08:58 +00:00
commit 942e2b45d0
2 changed files with 7 additions and 1 deletions

View File

@ -29,6 +29,7 @@ mcl_sprint = {}
mcl_sprint.SPEED = 1.3
local players = {}
local current = false --Well, while memeclone should be pretty shitty and stuff, we do not want to make players deaf
-- Returns true if the player with the given name is sprinting, false if not.
-- Returns nil if player does not exist.
@ -84,6 +85,10 @@ local function setSprinting(playerName, sprinting) --Sets the state of a player
end
if sprinting == true then
playerphysics.add_physics_factor(player, "speed", "mcl_sprint:sprint", mcl_sprint.SPEED)
if current == false then
minetest.sound_play("running") --this should play "why are you running" to the whole server when ANYONE starts sprinting, if noone else does it at the same time :D
current = true
end
end
elseif sprinting == false
and player:get_wielded_item():get_name() ~= "mcl_bows:bow_0"
@ -92,6 +97,7 @@ local function setSprinting(playerName, sprinting) --Sets the state of a player
fov_new = math.max(players[playerName].fov - 0.05, 1.0)
if sprinting == false then
playerphysics.remove_physics_factor(player, "speed", "mcl_sprint:sprint")
current = false
end
end
if fov_new ~= fov_old then

Binary file not shown.