forked from LizzyFleckenstein03/Memeclone
Merge my own changes into my master branch #4 #5
|
@ -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
|
||||
|
@ -225,4 +231,4 @@ minetest.register_globalstep(function(dtime)
|
|||
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
Loading…
Reference in New Issue