mirror of
https://github.com/minetest-mods/skinsdb.git
synced 2025-01-10 16:10:16 +01:00
Use Mod_storage
This commit is contained in:
parent
2900d789af
commit
2cff7234e0
6
api.lua
6
api.lua
@ -1,6 +1,8 @@
|
|||||||
-- get current skin
|
-- get current skin
|
||||||
|
local storage = minetest.get_mod_storage()
|
||||||
|
|
||||||
function skins.get_player_skin(player)
|
function skins.get_player_skin(player)
|
||||||
local skin = player:get_attribute("skinsdb:skin_key")
|
local skin = storage:get_string(player:get_player_name())
|
||||||
return skins.get(skin) or skins.get(skins.default)
|
return skins.get(skin) or skins.get(skins.default)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -22,7 +24,7 @@ function skins.assign_player_skin(player, skin)
|
|||||||
if skin_key == skins.default then
|
if skin_key == skins.default then
|
||||||
skin_key = ""
|
skin_key = ""
|
||||||
end
|
end
|
||||||
player:set_attribute("skinsdb:skin_key", skin_key)
|
storage:set_string(player:get_player_name(), skin_key)
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user