mirror of
https://github.com/LoneWolfHT/headanim.git
synced 2025-07-18 08:10:39 +02:00
Compare commits
3 Commits
v1.01
...
fce30158a7
Author | SHA1 | Date | |
---|---|---|---|
fce30158a7 | |||
63fb160951 | |||
0e79459f96 |
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020 LoneWolfHT
|
Copyright (c) 2020-2021 LoneWolfHT
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
20
init.lua
20
init.lua
@ -1,5 +1,21 @@
|
|||||||
|
local get_connected_players = minetest.get_connected_players
|
||||||
|
local abs = math.abs
|
||||||
|
local deg = math.deg
|
||||||
|
local basepos = vector.new(0, 6.35, 0)
|
||||||
|
local lastdir = {}
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
for _, player in pairs(minetest.get_connected_players()) do
|
for _, player in pairs(get_connected_players()) do
|
||||||
player:set_bone_position("Head", vector.new(0, 6.35, 0), vector.new(-math.deg(player:get_look_vertical()), 0, 0))
|
local pname = player:get_player_name()
|
||||||
|
local ldeg = -deg(player:get_look_vertical())
|
||||||
|
|
||||||
|
if abs((lastdir[pname] or 0) - ldeg) > 4 then
|
||||||
|
lastdir[pname] = ldeg
|
||||||
|
player:set_bone_position("Head", basepos, {x = ldeg, y = 0, z = 0})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
lastdir[player:get_player_name()] = nil
|
||||||
|
end)
|
||||||
|
Reference in New Issue
Block a user