mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-21 06:43:17 -04:00
use new get_meta() in player_api
This commit is contained in:
parent
fd027e71d3
commit
44ad633a2b
2 changed files with 6 additions and 5 deletions
|
@ -89,8 +89,9 @@ function player_api.set_textures(player, textures)
|
|||
local model = models[player_model[name]]
|
||||
local skin = skins[player_skin[name]]
|
||||
|
||||
local textures
|
||||
if skin.textures then
|
||||
if textures then
|
||||
skin_textures[name] = textures
|
||||
elseif skin.textures then
|
||||
textures = table.copy(skin.textures)
|
||||
skin_textures[name] = skin.textures
|
||||
elseif skin.texture then
|
||||
|
@ -134,7 +135,7 @@ function player_api.set_skin(player, skin_name, is_default, is_force)
|
|||
player_api.set_textures(player)
|
||||
|
||||
if not is_default then
|
||||
player:set_attribute("player_api:skin", skin_name)
|
||||
player:get_meta():set_string("player_api:skin", skin_name)
|
||||
end
|
||||
|
||||
for _, modifier_func in ipairs(registered_on_skin_change) do
|
||||
|
@ -144,7 +145,7 @@ end
|
|||
|
||||
-- Get current assigned or default skin for player
|
||||
function player_api.get_skin(player)
|
||||
local assigned_skin = player:get_attribute("player_api:skin")
|
||||
local assigned_skin = player:get_meta():get_string("player_api:skin")
|
||||
if assigned_skin then
|
||||
return assigned_skin, false
|
||||
end
|
||||
|
|
|
@ -116,7 +116,7 @@ end
|
|||
|
||||
function skinsdb5.on_skin_selection_receive_fields(player, context, fields)
|
||||
for field, _ in pairs(fields) do
|
||||
local current = string.split(field, "$", 2)
|
||||
local current = field:split("$", 2)
|
||||
if current[1] == "skins_set" then
|
||||
player_api.set_skin(player, context.skins_list[tonumber(current[2])].name)
|
||||
return 'set'
|
||||
|
|
Loading…
Add table
Reference in a new issue