built on 25/10/2020 21:54:19

This commit is contained in:
Joachim Stolberg 2020-10-25 21:54:19 +01:00
parent c3cedfbeab
commit 33fd191c2f
2 changed files with 9 additions and 10 deletions

View File

@ -164,8 +164,9 @@ function stamina.set_poisoned(player, poisoned)
end end
end end
local function poison_tick(player, ticks, interval, elapsed) local function poison_tick(player_name, ticks, interval, elapsed)
if not stamina.is_poisoned(player) then local player = minetest.get_player_by_name(player_name)
if not player or not stamina.is_poisoned(player) then
return return
elseif elapsed > ticks then elseif elapsed > ticks then
stamina.set_poisoned(player, false) stamina.set_poisoned(player, false)
@ -174,7 +175,7 @@ local function poison_tick(player, ticks, interval, elapsed)
if hp > 0 then if hp > 0 then
player:set_hp(hp) player:set_hp(hp)
end end
minetest.after(interval, poison_tick, player, ticks, interval, elapsed + 1) minetest.after(interval, poison_tick, player_name, ticks, interval, elapsed + 1)
end end
end end
@ -194,7 +195,8 @@ function stamina.poison(player, ticks, interval)
return return
end end
stamina.set_poisoned(player, true) stamina.set_poisoned(player, true)
poison_tick(player, ticks, interval, 0) local player_name = player:get_player_name()
poison_tick(player_name, ticks, interval, 0)
end end
--- END POISON API --- --- END POISON API ---
--- EXHAUSTION API --- --- EXHAUSTION API ---
@ -291,10 +293,7 @@ function stamina.set_sprinting(player, sprinting)
def.jump = def.jump + settings.sprint_jump def.jump = def.jump + settings.sprint_jump
end end
-- Check access conflicts with other mods player:set_physics_override(def)
if player:get_meta():get_int("player_physics_locked") == 0 then
player:set_physics_override(def)
end
end end
if settings.sprint_particles and sprinting then if settings.sprint_particles and sprinting then

View File

@ -114,14 +114,14 @@ minetest.register_entity(
end end
if controls.right then if controls.right then
yaw = yaw - math.pi / 96 yaw = yaw - math.pi / 60
vspeed = -2 vspeed = -2
hspeed = 4 hspeed = 4
player:set_look_vertical(math.tan(-vspeed / hspeed)) player:set_look_vertical(math.tan(-vspeed / hspeed))
set_player_yaw(self, player, yaw) set_player_yaw(self, player, yaw)
self.idle = 1 self.idle = 1
elseif controls.left then elseif controls.left then
yaw = yaw + math.pi / 96 yaw = yaw + math.pi / 60
vspeed = -2 vspeed = -2
hspeed = 4 hspeed = 4
player:set_look_vertical(math.tan(-vspeed / hspeed)) player:set_look_vertical(math.tan(-vspeed / hspeed))