only for test.
MultiCraft
Mrchiantos 2019-06-11 19:28:14 +02:00
parent 30314949a6
commit 5330b547b3
4 changed files with 57 additions and 16 deletions

View File

@ -1 +1,2 @@
default
character_creator

View File

@ -25,20 +25,33 @@ for i in ipairs(source_list) do
local red = source_list[i][4]
local green = source_list[i][5]
local blue = source_list[i][6]
if wieldskin == "white" then
wieldskin2 = "color_handwhite.png^(color_handwhite2.png^[colorize:#"..colour..":70)"
elseif wieldskin == "black" then
wieldskin2 = "color_handblack.png^(color_handwhite2.png^[colorize:#"..colour..":70)"
else
wieldskin2 = "color_handwhite.png^(color_handwhite2.png^[colorize:#"..colour..":70)"
end
minetest.register_node("color:" .. name, {
description = desc .. " color",
inventory_image = "blocks.png^[colorize:#"..colour..":70",
inventory_image = "blocks.png^[colorize:#"..colour..":70",
tiles = {"color_white.png^[colorize:#"..colour..":70"},
wield_image = "color_handwhite.png^(color_handwhite2.png^[colorize:#"..colour..":70)",
wield_image = wieldskin2,
wield_scale = {x=1,y=1,z=0.5},
is_ground_content = true,
groups = {snappy = 2, choppy = 2, wool = 2},
sounds = default.node_sound_defaults(),
oddly_breakable_by_hand = 1,
dig_immediate = 3,
oddly_breakable_by_hand = 1,
dig_immediate = 3,
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -10,11 +10,11 @@ local skin_default = {
gender = "Male",
height = 4,
width = 4,
face = "eyesblack.png",
face = "eyesblack.png",
skin = "skinwhite.png",
tshirt = "shirtwhite.png",
shoes = "hairblack.png",
pants = "pantsblue.png",
shoes = "hairblack.png",
pants = "pantsblue.png",
}
local skins = character_creator.skins
@ -33,8 +33,8 @@ minetest.after(0, function()
skin = associative_to_array(skins.skin),
tshirt = associative_to_array(skins.tshirt),
shoes = associative_to_array(skins.shoes),
pants = associative_to_array(skins.pants),
face = associative_to_array(skins.face),
pants = associative_to_array(skins.pants),
face = associative_to_array(skins.face),
}
end)
@ -96,6 +96,7 @@ local function load_skin(player)
player:set_attribute("character_creator:height", skin_default.height)
local function load_data(data_name)
local key = player:get_attribute("character_creator:" .. data_name)
local index = table.indexof(skins_array[data_name], key)
if index == -1 then
@ -109,8 +110,8 @@ local function load_skin(player)
load_data("skin")
load_data("tshirt")
load_data("shoes")
load_data("pants")
load_data("face")
load_data("pants")
load_data("face")
end
@ -125,8 +126,8 @@ local function save_skin(player)
save_data("skin")
save_data("tshirt")
save_data("shoes")
save_data("pants")
save_data("face")
save_data("pants")
save_data("face")
end
@ -143,11 +144,11 @@ local function get_texture(player)
local tshirt = skins.tshirt[tshirt_key]
texture = texture .. "^" .. tshirt
local pants_key = skins_array.pants[indexes.pants]
local pants_key = skins_array.pants[indexes.pants]
local pants = skins.pants[pants_key]
texture = texture .. "^" .. pants
local shoes_key = skins_array.shoes[indexes.shoes]
local shoes_key = skins_array.shoes[indexes.shoes]
local shoes = skins.shoes[shoes_key]
texture = texture .. "^" .. shoes
@ -172,6 +173,22 @@ local function change_skin(player)
})
local name = player:get_player_name()
wieldskin3 = player:get_attribute("character_creator:skin")
if wieldskin3 == "skinwhite.png" then
wieldskin = "white"
elseif wieldskin3 == "skinblack.png" then
wieldskin = "black"
else
wieldskin = "white"
end
if minetest.get_modpath("multiskin") then
multiskin.layers[name].skin = texture
@ -361,6 +378,16 @@ minetest.register_chatcommand("skin", {
end
})
minetest.register_chatcommand("say", {
params = "<text>",
description = "Send text to chat",
privs = {talk = true},
func = function( _ , text)
minetest.chat_send_all(text)
return true, "Text was sent successfully"
end,
})
if minetest.global_exists("unified_inventory") then
unified_inventory.register_button("character_creator", {
type = "image",