mirror of
https://github.com/minetest-mods/skinsdb.git
synced 2024-12-22 15:30:19 +01:00
adjustments from code review
This commit is contained in:
parent
2e39651821
commit
af5e6fcecc
7
API.md
7
API.md
@ -60,9 +60,10 @@ Set the hand node to be used with this skin
|
||||
|
||||
## skin:set_hand_from_texture()
|
||||
Register and set hand node based on skin texture
|
||||
Only works on mod load
|
||||
|
||||
##skin:get_hand()
|
||||
Get hand node
|
||||
## skin:get_hand()
|
||||
Get hand node. Returns ItemStack
|
||||
|
||||
## skin:set_preview(texture)
|
||||
Set the skin preview - usually at the init time only
|
||||
@ -76,7 +77,7 @@ Could be redefined for dynamic preview texture generation
|
||||
Hook for dynamic skins updates on select. Is called in skins.set_player_skin()
|
||||
In skinsdb the default implementation for this function is empty.
|
||||
|
||||
skin:apply_skin_to_player(player)
|
||||
## skin:apply_skin_to_player(player)
|
||||
Apply the skin to the player. Called in skins.update_player_skin() to update visuals
|
||||
|
||||
## skin:set_meta(key, value)
|
||||
|
7
init.lua
7
init.lua
@ -93,3 +93,10 @@ if not default_skin_obj then
|
||||
default_skin_obj:set_meta("name", "Sam")
|
||||
default_skin_obj:set_hand_from_texture()
|
||||
end
|
||||
|
||||
-- Secure hand inventory slot
|
||||
minetest.register_allow_player_inventory_action(function(player, action, inv, data)
|
||||
if data.to_list == "hand" or data.from_list == "hand" or data.listname == "hand" then
|
||||
return 0
|
||||
end
|
||||
end)
|
||||
|
@ -55,6 +55,7 @@ function skin_class:set_hand(hand)
|
||||
self._hand = hand
|
||||
end
|
||||
|
||||
local ALPHA_CLIP = minetest.features.use_texture_alpha_string_modes and "clip" or true
|
||||
function skin_class:set_hand_from_texture()
|
||||
local hand = core.get_current_modname()..':'..self._texture:gsub('[%p%c%s]', '')
|
||||
|
||||
@ -66,7 +67,7 @@ function skin_class:set_hand_from_texture()
|
||||
paramtype = "light",
|
||||
drawtype = "mesh",
|
||||
mesh = "skinsdb_hand.b3d",
|
||||
use_texture_alpha = "clip",
|
||||
use_texture_alpha = ALPHA_CLIP,
|
||||
node_placement_prediction = "",
|
||||
groups = { not_in_creative_inventory = 1 }
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user