Add changable skin color
@ -100,6 +100,9 @@ local function on_joinplayer(player)
|
||||
player_health[name] = player:get_hp()
|
||||
|
||||
player_lastpos[name] = player:get_pos()
|
||||
|
||||
local inv = player:get_inventory()
|
||||
inv:set_size("hand", 1)
|
||||
end
|
||||
|
||||
local function on_leaveplayer(player)
|
||||
|
@ -1,2 +1,3 @@
|
||||
default
|
||||
wieldhand
|
||||
util
|
||||
|
@ -20,8 +20,7 @@ function player_skins.get_skin(name)
|
||||
end
|
||||
|
||||
local components = {
|
||||
--skin_colors = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" },
|
||||
skin_colors = { "1" },
|
||||
skin_colors = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" },
|
||||
cloth_colors = { "red", "redviolet", "magenta", "purple", "blue", "cyan", "green", "yellow", "orange" },
|
||||
band_colors = { "red", "redviolet", "magenta", "purple", "blue", "skyblue", "cyan", "turquoise", "lime", "green", "yellow", "orange" },
|
||||
hairs = {
|
||||
@ -65,11 +64,16 @@ function player_skins.set_skin(name, skin, cloth, bands, hair, eyes)
|
||||
if not player then
|
||||
return false
|
||||
end
|
||||
-- Set player skin and wieldhand
|
||||
default.player_set_textures(player, { newskin })
|
||||
wieldhand.set_hand(player, skin)
|
||||
|
||||
-- Update internal data
|
||||
player_skins.skins[name] = newskin
|
||||
local meta = player:get_meta()
|
||||
local metastring = skin..","..eyes..","..hair..","..cloth..","..bands
|
||||
meta:set_string("player_skins:skindata", metastring)
|
||||
|
||||
if minetest.global_exists("armor") then
|
||||
armor.update(player)
|
||||
end
|
||||
@ -126,9 +130,9 @@ function player_skins.get_formspec(playername)
|
||||
form = form .. "model[0.2,0.5;4,8;player_skins_skin_select_model;character.b3d;"..player_skins.skins[playername]..";0,180;false;false;0,0;0]"
|
||||
form = form .. default.ui.button(3.5, 0.3, 3, 1, "player_skins_skin_select_hairs", S("Hair"))
|
||||
form = form .. default.ui.button(3.5, 1.3, 3, 1, "player_skins_skin_select_eye_colors", S("Eyes"))
|
||||
form = form .. default.ui.button(3.5, 2.3, 3, 1, "player_skins_skin_select_skin_colors", S("Skin"))
|
||||
form = form .. default.ui.button(3.5, 3, 3, 1, "player_skins_skin_select_cloth_colors", S("Shirt"))
|
||||
form = form .. default.ui.button(3.5, 5, 3, 1, "player_skins_skin_select_band_colors", S("Trousers"))
|
||||
form = form .. default.ui.button(3.5, 6, 3, 1, "player_skins_skin_select_skin_colors", S("Skin"))
|
||||
form = form .. default.ui.button(3.5, 7.75, 3, 1, "player_skins_skin_select_random", S("Random"))
|
||||
return form
|
||||
end
|
||||
@ -140,7 +144,7 @@ minetest.register_on_player_receive_fields(function(player, form_name, fields)
|
||||
player_skins.set_random_skin(name)
|
||||
changed = true
|
||||
else
|
||||
local checks = {"hairs", "eye_colors", "cloth_colors", "band_colors"}
|
||||
local checks = {"hairs", "eye_colors", "cloth_colors", "band_colors", "skin_colors"}
|
||||
for c=1, #checks do
|
||||
local check = checks[c]
|
||||
if fields["player_skins_skin_select_"..check] then
|
||||
|
15
mods/wieldhand/init.lua
Normal file
@ -0,0 +1,15 @@
|
||||
hand = {}
|
||||
|
||||
for h=0, 9 do
|
||||
minetest.register_item("wieldhand:hand_"..h, {
|
||||
type = "none",
|
||||
wield_image = "wieldhand_"..h..".png",
|
||||
wield_scale = {x=1.0,y=1.0,z=3.0},
|
||||
})
|
||||
end
|
||||
|
||||
function wieldhand.set_hand(player, skin_tone)
|
||||
local inv = player:get_inventory()
|
||||
local hand = ItemStack("wieldhand:hand_"..skin_tone)
|
||||
inv:set_stack("hand", 1, hand)
|
||||
end
|
2
mods/wieldhand/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = wieldhand
|
||||
description = Adds serveal wield hands for the different skin tones, to be used by player_skins mod
|
BIN
mods/wieldhand/textures/wieldhand_0.png
Normal file
After Width: | Height: | Size: 198 B |
BIN
mods/wieldhand/textures/wieldhand_1.png
Normal file
After Width: | Height: | Size: 188 B |
BIN
mods/wieldhand/textures/wieldhand_2.png
Normal file
After Width: | Height: | Size: 196 B |
BIN
mods/wieldhand/textures/wieldhand_3.png
Normal file
After Width: | Height: | Size: 196 B |
BIN
mods/wieldhand/textures/wieldhand_4.png
Normal file
After Width: | Height: | Size: 194 B |
BIN
mods/wieldhand/textures/wieldhand_5.png
Normal file
After Width: | Height: | Size: 194 B |
BIN
mods/wieldhand/textures/wieldhand_6.png
Normal file
After Width: | Height: | Size: 194 B |
BIN
mods/wieldhand/textures/wieldhand_7.png
Normal file
After Width: | Height: | Size: 194 B |
BIN
mods/wieldhand/textures/wieldhand_8.png
Normal file
After Width: | Height: | Size: 199 B |
BIN
mods/wieldhand/textures/wieldhand_9.png
Normal file
After Width: | Height: | Size: 199 B |