2021-08-12 16:58:04 +02:00
|
|
|
local get_connected_players = minetest.get_connected_players
|
|
|
|
local lastdir = {}
|
|
|
|
|
2024-10-28 16:46:22 +01:00
|
|
|
minetest.register_globalstep(function()
|
2021-08-12 16:58:04 +02:00
|
|
|
for _, player in pairs(get_connected_players()) do
|
|
|
|
local pname = player:get_player_name()
|
2024-10-28 16:46:22 +01:00
|
|
|
local ldeg = -player:get_look_vertical()
|
2021-08-12 16:58:04 +02:00
|
|
|
|
2024-10-28 16:46:22 +01:00
|
|
|
if (lastdir[pname] or 0) ~= ldeg then
|
2021-08-12 16:58:04 +02:00
|
|
|
lastdir[pname] = ldeg
|
2024-10-28 16:46:22 +01:00
|
|
|
player:set_bone_override("Head", {
|
|
|
|
rotation = {
|
|
|
|
vec = {x = ldeg, y = 0, z = 0},
|
|
|
|
interpolation = 0.14,
|
|
|
|
}
|
|
|
|
})
|
2021-08-12 16:58:04 +02:00
|
|
|
end
|
2020-06-12 05:17:28 +02:00
|
|
|
end
|
|
|
|
end)
|
2021-08-12 16:58:04 +02:00
|
|
|
|
|
|
|
minetest.register_on_leaveplayer(function(player)
|
|
|
|
lastdir[player:get_player_name()] = nil
|
|
|
|
end)
|