36 lines
1.2 KiB
Lua
Raw Normal View History

-- LUALOCALS < ---------------------------------------------------------
2020-06-22 22:46:48 -04:00
local minetest, nodecore, pairs
= minetest, nodecore, pairs
-- LUALOCALS > ---------------------------------------------------------
2020-06-22 22:46:48 -04:00
nodecore.register_playerstep({
label = "player model visuals",
action = function(player, data)
2020-06-23 00:44:54 -04:00
if data.properties.visual_size.x <= 0 then return end
local props = nodecore.player_visuals_base(player, data)
2020-06-22 22:46:48 -04:00
-- Skin can be set preemptively by visuals_base; if so, then will
-- not be modified here.
if not props.textures then
-- Recheck skin only every couple seconds to avoid
-- interfering with animations if skin includes continuous
-- effects.
local now = minetest.get_us_time() / 1000000
if (not data.skincalctime) or (now >= data.skincalctime + 2) then
data.skincalctime = now
local t = nodecore.player_skin(player, data)
2020-06-22 22:46:48 -04:00
props.textures = {t}
end
end
for k, v in pairs(props) do data.properties[k] = v end
local anim = nodecore.player_anim(player, data)
2020-09-10 22:28:25 -04:00
if anim.name then
nodecore.player_discover(player, "anim_" .. anim.name)
end
2020-06-22 23:17:01 -04:00
data.animation = {{x = anim.x, y = anim.y}, anim.speed}
end
2020-06-22 22:46:48 -04:00
})