-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathinit.lua
More file actions
30 lines (27 loc) · 786 Bytes
/
init.lua
File metadata and controls
30 lines (27 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
local get_connected_players = minetest.get_connected_players
local lastdir = {}
local basepos = vector.new(0, 6.35, 0)
minetest.register_globalstep(function()
for _, player in pairs(get_connected_players()) do
local pname = player:get_player_name()
local ldeg = -player:get_look_vertical()
if (lastdir[pname] or 0) ~= ldeg then
lastdir[pname] = ldeg
player:set_bone_override("Head", {
-- The position attr makes headanim work on older clients
-- https://github.com/LoneWolfHT/headanim/pull/4
position = {
vec = basepos,
absolute = true
},
rotation = {
vec = {x = ldeg, y = 0, z = 0},
interpolation = 0.09,
}
})
end
end
end)
minetest.register_on_leaveplayer(function(player)
lastdir[player:get_player_name()] = nil
end)