2020-01-20 21:25:56 -05:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
2020-06-22 22:46:48 -04:00
|
|
|
local minetest, nodecore, pairs
|
|
|
|
= minetest, nodecore, pairs
|
2020-01-20 21:25:56 -05:00
|
|
|
-- 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
|
|
|
|
|
2020-07-05 09:56:52 -04:00
|
|
|
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
|
2020-07-05 09:56:52 -04:00
|
|
|
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
|
|
|
|
|
2020-07-05 09:56:52 -04:00
|
|
|
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}
|
2020-01-20 21:25:56 -05:00
|
|
|
end
|
2020-06-22 22:46:48 -04:00
|
|
|
})
|