mirror of
https://github.com/minetest-mods/skinsdb.git
synced 2024-12-22 23:40:18 +01:00
Add hand_monoid support (#81)
This commit is contained in:
parent
6db9a55f0c
commit
b49907c4b1
@ -10,4 +10,5 @@ globals = {
|
||||
read_globals = {
|
||||
string = {fields = {"split", "trim"}},
|
||||
table = {fields = {"copy", "getn"}},
|
||||
"hand_monoid",
|
||||
}
|
||||
|
2
mod.conf
2
mod.conf
@ -1,5 +1,5 @@
|
||||
name = skinsdb
|
||||
description = Player skin mod, supporting unified_inventory, sfinv and smart_inventory
|
||||
depends = player_api
|
||||
optional_depends = unified_inventory,3d_armor,clothing,sfinv
|
||||
optional_depends = unified_inventory,3d_armor,clothing,sfinv,hand_monoid
|
||||
min_minetest_version = 5.4.0
|
||||
|
@ -1,5 +1,7 @@
|
||||
skins.meta = {}
|
||||
|
||||
local has_hand_monoid = minetest.get_modpath("hand_monoid")
|
||||
|
||||
local skin_class = {}
|
||||
skin_class.__index = skin_class
|
||||
skins.skin_class = skin_class
|
||||
@ -208,6 +210,13 @@ function skin_class:apply_skin_to_player(player)
|
||||
})
|
||||
|
||||
local hand = self:get_hand()
|
||||
if has_hand_monoid then
|
||||
if hand then
|
||||
hand_monoid.monoid:add_change(player, {name = hand}, "skinsdb:hand")
|
||||
else
|
||||
hand_monoid.monoid:del_change(player, "skinsdb:hand")
|
||||
end
|
||||
else
|
||||
if hand then
|
||||
player:get_inventory():set_size("hand", 1)
|
||||
player:get_inventory():set_stack("hand", 1, hand)
|
||||
@ -215,6 +224,7 @@ function skin_class:apply_skin_to_player(player)
|
||||
player:get_inventory():set_stack("hand", 1, "")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function skin_class:set_skin(player)
|
||||
-- The set_skin is used on skins selection
|
||||
|
Loading…
Reference in New Issue
Block a user