mirror of
https://github.com/minetest-mods/skinsdb.git
synced 2025-04-26 21:30:24 +02:00
Merge branch 'master' into contentdb
This commit is contained in:
commit
8d5870c54c
10
init.lua
10
init.lua
@ -72,6 +72,7 @@ minetest.register_on_shutdown(function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- See also: 3d_armor/init.lua
|
||||||
player_api.register_model("skinsdb_3d_armor_character_5.b3d", {
|
player_api.register_model("skinsdb_3d_armor_character_5.b3d", {
|
||||||
animation_speed = 30,
|
animation_speed = 30,
|
||||||
textures = {
|
textures = {
|
||||||
@ -82,16 +83,21 @@ player_api.register_model("skinsdb_3d_armor_character_5.b3d", {
|
|||||||
},
|
},
|
||||||
animations = {
|
animations = {
|
||||||
stand = {x=0, y=79},
|
stand = {x=0, y=79},
|
||||||
lay = {x=162, y=166},
|
lay = {x=162, y=166, eye_height = 0.3, override_local = true,
|
||||||
|
collisionbox = {-0.6, 0.0, -0.6, 0.6, 0.3, 0.6}},
|
||||||
walk = {x=168, y=187},
|
walk = {x=168, y=187},
|
||||||
mine = {x=189, y=198},
|
mine = {x=189, y=198},
|
||||||
walk_mine = {x=200, y=219},
|
walk_mine = {x=200, y=219},
|
||||||
sit = {x=81, y=160},
|
sit = {x=81, y=160, eye_height = 0.8, override_local = true,
|
||||||
|
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.0, 0.3}},
|
||||||
-- compatibility w/ the emote mod
|
-- compatibility w/ the emote mod
|
||||||
wave = {x = 192, y = 196, override_local = true},
|
wave = {x = 192, y = 196, override_local = true},
|
||||||
point = {x = 196, y = 196, override_local = true},
|
point = {x = 196, y = 196, override_local = true},
|
||||||
freeze = {x = 205, y = 205, override_local = true},
|
freeze = {x = 205, y = 205, override_local = true},
|
||||||
},
|
},
|
||||||
|
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
||||||
|
-- stepheight: use default
|
||||||
|
eye_height = 1.47,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Register default character.png if not part of this mod
|
-- Register default character.png if not part of this mod
|
||||||
|
2
mod.conf
2
mod.conf
@ -1,5 +1,5 @@
|
|||||||
name = skinsdb
|
name = skinsdb
|
||||||
description = Player skin mod, supporting unified_inventory, sfinv and smart_inventory
|
description = Player skin mod, supporting unified_inventory, sfinv and smart_inventory
|
||||||
depends = player_api
|
depends = player_api
|
||||||
optional_depends = unified_inventory,3d_armor,clothing,sfinv,hand_monoid
|
optional_depends = unified_inventory, 3d_armor, clothing, creative, sfinv, hand_monoid
|
||||||
min_minetest_version = 5.4.0
|
min_minetest_version = 5.4.0
|
||||||
|
@ -49,23 +49,25 @@ function skin_class:set_texture(value)
|
|||||||
self._texture = value
|
self._texture = value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Retrieves the character texture
|
||||||
function skin_class:get_texture()
|
function skin_class:get_texture()
|
||||||
return self._texture
|
return self._texture
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Assigns an existing hand item (/node) name to this skin
|
||||||
function skin_class:set_hand(hand)
|
function skin_class:set_hand(hand)
|
||||||
self._hand = hand
|
self._hand = hand
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function skin_class:get_hand()
|
||||||
|
return self._hand
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Registers a new hand item based on the skin meta
|
||||||
local ALPHA_CLIP = minetest.features.use_texture_alpha_string_modes and "clip" or true
|
local ALPHA_CLIP = minetest.features.use_texture_alpha_string_modes and "clip" or true
|
||||||
function skin_class:set_hand_from_texture()
|
function skin_class:set_hand_from_texture()
|
||||||
local hand = core.get_current_modname()..':'..self._texture:gsub('[%p%c%s]', '')
|
local hand = core.get_current_modname()..':'..self._texture:gsub('[%p%c%s]', '')
|
||||||
local hand_def = {}
|
local hand_def = {}
|
||||||
for k,v in pairs(minetest.registered_items[""]) do
|
|
||||||
if k ~= "mod_origin" and k ~= "type" and k ~= "wield_image" then
|
|
||||||
hand_def[k] = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
hand_def.tiles = {self:get_texture()}
|
hand_def.tiles = {self:get_texture()}
|
||||||
hand_def.visual_scale = 1
|
hand_def.visual_scale = 1
|
||||||
hand_def.wield_scale = {x=1,y=1,z=1}
|
hand_def.wield_scale = {x=1,y=1,z=1}
|
||||||
@ -77,13 +79,39 @@ function skin_class:set_hand_from_texture()
|
|||||||
hand_def.mesh = "skinsdb_hand_18.b3d"
|
hand_def.mesh = "skinsdb_hand_18.b3d"
|
||||||
end
|
end
|
||||||
hand_def.use_texture_alpha = ALPHA_CLIP
|
hand_def.use_texture_alpha = ALPHA_CLIP
|
||||||
minetest.register_node(hand, hand_def)
|
|
||||||
|
core.register_node(hand, table.copy(hand_def))
|
||||||
|
|
||||||
|
self._hand_def = hand_def -- for wieldhand overrides
|
||||||
self:set_hand(hand)
|
self:set_hand(hand)
|
||||||
end
|
end
|
||||||
|
|
||||||
function skin_class:get_hand()
|
-- creative (and other mods?) may overwrite the wieldhand very late.
|
||||||
return self._hand
|
-- Grab the most recent definition and use them as default for our skin hands.
|
||||||
end
|
core.register_on_mods_loaded(function()
|
||||||
|
local default_hand_def = {}
|
||||||
|
for k, v in pairs(core.registered_items[""]) do
|
||||||
|
if k ~= "mod_origin"
|
||||||
|
and k ~= "name"
|
||||||
|
and k ~= "type"
|
||||||
|
and k ~= "wield_image"
|
||||||
|
and string.sub(k, 1, 1) ~= "_" then
|
||||||
|
default_hand_def[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for _, meta in pairs(skins.meta) do
|
||||||
|
local def = core.registered_nodes[meta._hand]
|
||||||
|
if def then
|
||||||
|
local new_def = table.copy(default_hand_def)
|
||||||
|
-- Overwrite the hand with our fields from `set_hand_from_texture`
|
||||||
|
for k, v in pairs(meta._hand_def) do
|
||||||
|
new_def[k] = v
|
||||||
|
end
|
||||||
|
core.override_item(meta._hand, new_def)
|
||||||
|
end
|
||||||
|
meta._hand_def = nil -- no longer needed, free up RAM
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
function skin_class:set_preview(value)
|
function skin_class:set_preview(value)
|
||||||
self._preview = value
|
self._preview = value
|
||||||
@ -109,7 +137,7 @@ function skin_class:get_preview()
|
|||||||
--Right Leg
|
--Right Leg
|
||||||
skin = skin .. "([combine:16x32:0,0=" .. player_skin .. "^[mask:skindb_mask_rleg.png)^"
|
skin = skin .. "([combine:16x32:0,0=" .. player_skin .. "^[mask:skindb_mask_rleg.png)^"
|
||||||
|
|
||||||
-- 64x skins have non-mirrored arms and legs
|
-- 64x64 skins have non-mirrored arms and legs
|
||||||
local left_arm
|
local left_arm
|
||||||
local left_leg
|
local left_leg
|
||||||
|
|
||||||
@ -126,17 +154,21 @@ function skin_class:get_preview()
|
|||||||
--Left Leg
|
--Left Leg
|
||||||
skin = skin .. left_leg
|
skin = skin .. left_leg
|
||||||
|
|
||||||
-- Add overlays for 64x skins. these wont appear if skin is 32x because it will be cropped out
|
if self:get_meta("format") == "1.8" then
|
||||||
--Chest Overlay
|
-- Add overlays for 64x64 skins. This check is needed to avoid
|
||||||
skin = skin .. "([combine:16x32:-16,-28=" .. player_skin .. "^[mask:skindb_mask_chest.png)^"
|
-- client-side out-of-bounds "[combine" warnings.
|
||||||
--Right Arm Overlay
|
|
||||||
skin = skin .. "([combine:16x32:-44,-28=" .. player_skin .. "^[mask:skindb_mask_rarm.png)^"
|
--Chest Overlay
|
||||||
--Right Leg Overlay
|
skin = skin .. "([combine:16x32:-16,-28=" .. player_skin .. "^[mask:skindb_mask_chest.png)^"
|
||||||
skin = skin .. "([combine:16x32:0,-16=" .. player_skin .. "^[mask:skindb_mask_rleg.png)^"
|
--Right Arm Overlay
|
||||||
--Left Arm Overlay
|
skin = skin .. "([combine:16x32:-44,-28=" .. player_skin .. "^[mask:skindb_mask_rarm.png)^"
|
||||||
skin = skin .. "([combine:16x32:-40,-44=" .. player_skin .. "^[mask:(skindb_mask_rarm.png^[transformFX))^"
|
--Right Leg Overlay
|
||||||
--Left Leg Overlay
|
skin = skin .. "([combine:16x32:0,-16=" .. player_skin .. "^[mask:skindb_mask_rleg.png)^"
|
||||||
skin = skin .. "([combine:16x32:4,-32=" .. player_skin .. "^[mask:(skindb_mask_rleg.png^[transformFX))"
|
--Left Arm Overlay
|
||||||
|
skin = skin .. "([combine:16x32:-40,-44=" .. player_skin .. "^[mask:(skindb_mask_rarm.png^[transformFX))^"
|
||||||
|
--Left Leg Overlay
|
||||||
|
skin = skin .. "([combine:16x32:4,-32=" .. player_skin .. "^[mask:(skindb_mask_rleg.png^[transformFX))"
|
||||||
|
end
|
||||||
|
|
||||||
-- Full Preview
|
-- Full Preview
|
||||||
skin = "(((" .. skin .. ")^[resize:64x128)^[mask:skindb_transform.png)"
|
skin = "(((" .. skin .. ")^[resize:64x128)^[mask:skindb_transform.png)"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user