Skip to content

Commit 695f98f

Browse files
authoredApr 8, 2020
player_api: Remove local variable (#2640)
1 parent 545ec07 commit 695f98f

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed
 

Diff for: ‎mods/player_api/api.lua

+2-7
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,8 @@ minetest.register_globalstep(function()
113113
local model = model_name and models[model_name]
114114
if model and not player_attached[name] then
115115
local controls = player:get_player_control()
116-
local walking = false
117116
local animation_speed_mod = model.animation_speed or 30
118117

119-
-- Determine if the player is walking
120-
if controls.up or controls.down or controls.left or controls.right then
121-
walking = true
122-
end
123-
124118
-- Determine if the player is sneaking, and reduce animation speed if so
125119
if controls.sneak then
126120
animation_speed_mod = animation_speed_mod / 2
@@ -129,7 +123,8 @@ minetest.register_globalstep(function()
129123
-- Apply animations based on what the player is doing
130124
if player:get_hp() == 0 then
131125
player_set_animation(player, "lay")
132-
elseif walking then
126+
-- Determine if the player is walking
127+
elseif controls.up or controls.down or controls.left or controls.right then
133128
if player_sneak[name] ~= controls.sneak then
134129
player_anim[name] = nil
135130
player_sneak[name] = controls.sneak

0 commit comments

Comments
 (0)
Please sign in to comment.