"WHY ARE YOU RUNNING" #4

Merged
LizzyFleckenstein03 merged 2 commits from chmodsayshello/Memeclone_Fork:running into master 2022-05-22 21:36:54 +02:00
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.