Skip to content

Commit

Permalink
prototype animation ignoring
Browse files Browse the repository at this point in the history
  • Loading branch information
wsor4035 committed Sep 7, 2024
1 parent ff718c2 commit f03aaee
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/player/minetest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,28 @@ function papi.set_animation(player, anim_name, speed, loop)
return player_api.set_animation(player, anim_name, speed, loop)
end

--todo: handle ignoring animations (maybe metatables?)

local papi_metatable = {
__newindex = function (table, key, value)
player_api.player_attached[key] = value

rawset(table, key, value)
end
}

local player_api_metatable = {
__newindex = function (table, key, value)
rawset(papi.player_attached, key, value)
rawset(table, key, value)
end
}

papi.player_attached = {}

--when a value is set in xcompat api, this will also set it in the player api
setmetatable(papi.player_attached, papi_metatable)

--when a value is set in player api, this will also set it in the xcompat api
setmetatable(player_api.player_attached, player_api_metatable)

return papi

0 comments on commit f03aaee

Please sign in to comment.