Merge pull request '"WHY ARE YOU RUNNING"' (#4) from chmodsayshello/Memeclone_Fork:running into master
Reviewed-on: EliasFleckenstein03/Memeclone#4
This commit is contained in:
commit
e3233853fd
|
@ -29,6 +29,7 @@ mcl_sprint = {}
|
||||||
mcl_sprint.SPEED = 1.3
|
mcl_sprint.SPEED = 1.3
|
||||||
|
|
||||||
local players = {}
|
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 true if the player with the given name is sprinting, false if not.
|
||||||
-- Returns nil if player does not exist.
|
-- Returns nil if player does not exist.
|
||||||
|
@ -84,6 +85,10 @@ local function setSprinting(playerName, sprinting) --Sets the state of a player
|
||||||
end
|
end
|
||||||
if sprinting == true then
|
if sprinting == true then
|
||||||
playerphysics.add_physics_factor(player, "speed", "mcl_sprint:sprint", mcl_sprint.SPEED)
|
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
|
end
|
||||||
elseif sprinting == false
|
elseif sprinting == false
|
||||||
and player:get_wielded_item():get_name() ~= "mcl_bows:bow_0"
|
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)
|
fov_new = math.max(players[playerName].fov - 0.05, 1.0)
|
||||||
if sprinting == false then
|
if sprinting == false then
|
||||||
playerphysics.remove_physics_factor(player, "speed", "mcl_sprint:sprint")
|
playerphysics.remove_physics_factor(player, "speed", "mcl_sprint:sprint")
|
||||||
|
current = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if fov_new ~= fov_old then
|
if fov_new ~= fov_old then
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue