diff --git a/mods/default/player.lua b/mods/default/player.lua index f0b5701..eef8eb3 100644 --- a/mods/default/player.lua +++ b/mods/default/player.lua @@ -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) diff --git a/mods/player_skins/depends.txt b/mods/player_skins/depends.txt index b7cc57f..1332f76 100644 --- a/mods/player_skins/depends.txt +++ b/mods/player_skins/depends.txt @@ -1,2 +1,3 @@ default +wieldhand util diff --git a/mods/player_skins/init.lua b/mods/player_skins/init.lua index da0f171..931390d 100644 --- a/mods/player_skins/init.lua +++ b/mods/player_skins/init.lua @@ -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 diff --git a/mods/wieldhand/init.lua b/mods/wieldhand/init.lua new file mode 100644 index 0000000..0a7ec71 --- /dev/null +++ b/mods/wieldhand/init.lua @@ -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 diff --git a/mods/wieldhand/mod.conf b/mods/wieldhand/mod.conf new file mode 100644 index 0000000..713546f --- /dev/null +++ b/mods/wieldhand/mod.conf @@ -0,0 +1,2 @@ +name = wieldhand +description = Adds serveal wield hands for the different skin tones, to be used by player_skins mod diff --git a/mods/wieldhand/textures/wieldhand_0.png b/mods/wieldhand/textures/wieldhand_0.png new file mode 100644 index 0000000..5b8d018 Binary files /dev/null and b/mods/wieldhand/textures/wieldhand_0.png differ diff --git a/mods/wieldhand/textures/wieldhand_1.png b/mods/wieldhand/textures/wieldhand_1.png new file mode 100644 index 0000000..1bc9c9d Binary files /dev/null and b/mods/wieldhand/textures/wieldhand_1.png differ diff --git a/mods/wieldhand/textures/wieldhand_2.png b/mods/wieldhand/textures/wieldhand_2.png new file mode 100644 index 0000000..762560e Binary files /dev/null and b/mods/wieldhand/textures/wieldhand_2.png differ diff --git a/mods/wieldhand/textures/wieldhand_3.png b/mods/wieldhand/textures/wieldhand_3.png new file mode 100644 index 0000000..c2ae28e Binary files /dev/null and b/mods/wieldhand/textures/wieldhand_3.png differ diff --git a/mods/wieldhand/textures/wieldhand_4.png b/mods/wieldhand/textures/wieldhand_4.png new file mode 100644 index 0000000..14e7375 Binary files /dev/null and b/mods/wieldhand/textures/wieldhand_4.png differ diff --git a/mods/wieldhand/textures/wieldhand_5.png b/mods/wieldhand/textures/wieldhand_5.png new file mode 100644 index 0000000..8294aea Binary files /dev/null and b/mods/wieldhand/textures/wieldhand_5.png differ diff --git a/mods/wieldhand/textures/wieldhand_6.png b/mods/wieldhand/textures/wieldhand_6.png new file mode 100644 index 0000000..4d82f38 Binary files /dev/null and b/mods/wieldhand/textures/wieldhand_6.png differ diff --git a/mods/wieldhand/textures/wieldhand_7.png b/mods/wieldhand/textures/wieldhand_7.png new file mode 100644 index 0000000..99b955e Binary files /dev/null and b/mods/wieldhand/textures/wieldhand_7.png differ diff --git a/mods/wieldhand/textures/wieldhand_8.png b/mods/wieldhand/textures/wieldhand_8.png new file mode 100644 index 0000000..7eafce9 Binary files /dev/null and b/mods/wieldhand/textures/wieldhand_8.png differ diff --git a/mods/wieldhand/textures/wieldhand_9.png b/mods/wieldhand/textures/wieldhand_9.png new file mode 100644 index 0000000..42480e2 Binary files /dev/null and b/mods/wieldhand/textures/wieldhand_9.png differ