mirror of
https://github.com/minetest/minetest_game.git
synced 2024-12-22 23:10:17 +01:00
player_api: Remove local variable (#2640)
This commit is contained in:
parent
545ec0741c
commit
695f98f213
@ -113,14 +113,8 @@ minetest.register_globalstep(function()
|
|||||||
local model = model_name and models[model_name]
|
local model = model_name and models[model_name]
|
||||||
if model and not player_attached[name] then
|
if model and not player_attached[name] then
|
||||||
local controls = player:get_player_control()
|
local controls = player:get_player_control()
|
||||||
local walking = false
|
|
||||||
local animation_speed_mod = model.animation_speed or 30
|
local animation_speed_mod = model.animation_speed or 30
|
||||||
|
|
||||||
-- Determine if the player is walking
|
|
||||||
if controls.up or controls.down or controls.left or controls.right then
|
|
||||||
walking = true
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Determine if the player is sneaking, and reduce animation speed if so
|
-- Determine if the player is sneaking, and reduce animation speed if so
|
||||||
if controls.sneak then
|
if controls.sneak then
|
||||||
animation_speed_mod = animation_speed_mod / 2
|
animation_speed_mod = animation_speed_mod / 2
|
||||||
@ -129,7 +123,8 @@ minetest.register_globalstep(function()
|
|||||||
-- Apply animations based on what the player is doing
|
-- Apply animations based on what the player is doing
|
||||||
if player:get_hp() == 0 then
|
if player:get_hp() == 0 then
|
||||||
player_set_animation(player, "lay")
|
player_set_animation(player, "lay")
|
||||||
elseif walking then
|
-- Determine if the player is walking
|
||||||
|
elseif controls.up or controls.down or controls.left or controls.right then
|
||||||
if player_sneak[name] ~= controls.sneak then
|
if player_sneak[name] ~= controls.sneak then
|
||||||
player_anim[name] = nil
|
player_anim[name] = nil
|
||||||
player_sneak[name] = controls.sneak
|
player_sneak[name] = controls.sneak
|
||||||
|
Loading…
Reference in New Issue
Block a user