Add compatiblity with old mcl_player.player_attached table

This commit is contained in:
cora 2024-02-15 04:03:29 +01:00 committed by Elias Åström
parent eb2f4a3260
commit 3ce51f4502
3 changed files with 24 additions and 2 deletions

View File

@ -368,7 +368,7 @@ mcl_player.register_globalstep(function(player, dtime)
mcl_util.set_bone_position(player, "Body_Control", nil, vector.new(0, -player_vel_yaw + yaw, 0))
mcl_util.set_properties(player, player_props_sneaking)
mcl_player.player_set_animation(player, "sneak_stand", animation_speed_mod)
else
elseif not mcl_player.players[player].attached then
mcl_util.set_properties(player, player_props_normal)
mcl_util.set_bone_position(player,"Head_Control", nil, vector.new(pitch, player_vel_yaw - yaw, 0))
mcl_util.set_bone_position(player,"Body_Control", nil, vector.new(0, -player_vel_yaw + yaw, 0))

View File

@ -0,0 +1,20 @@
mcl_player.player_attached = {}
local mt = {
__index = function (t, k)
local pl = minetest.get_player_by_name(k)
if pl then
return mcl_player.players[pl].attached
end
return false
end,
__newindex = function (t, k, v)
local pl = minetest.get_player_by_name(k)
if pl then
mcl_player.players[pl].attached = v
end
return true
end,
}
setmetatable(mcl_player.player_attached, mt)

View File

@ -165,4 +165,6 @@ mcl_damage.register_modifier(function(obj, damage, reason)
end
end, -200)
dofile(minetest.get_modpath(minetest.get_current_modname()).."/animations.lua")
local modpath = minetest.get_modpath(minetest.get_current_modname())
dofile(modpath.."/animations.lua")
dofile(modpath.."/compat.lua")