Created
February 11, 2017 19:35
-
-
Save Jordach/4385e9a5687f778a54158e9d9df3b616 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wardrobe.formspec_meta( | |
eye, | |
hair, | |
ushirt, ushirt2, | |
utrou, utrou2, | |
socks, socks2, | |
jacket, jacket2, | |
trous, trous2, | |
shoes, shoes2, | |
acc1, acc2, acc3, acc4, acc5, acc6 ) | |
local formspec = | |
"size[14,10]".. | |
"label[1, 0; "..wardrobe.shirt_names[ushirt].."]".. | |
"button[1, 1; 1, 1; mouthd; <-]".. | |
"field[2.05, 1.32; 1.75, 1; entry1; ; RRGGBB]".. | |
"button[3.27, 1; 1, 1; mouthu; ->]" | |
return formspec | |
end | |
minetest.register_node("wardrobe:node", { | |
description = "Wardrobe", | |
tiles = {"wardrobe.png"}, | |
groups = {crumbly=3}, | |
after_place_node = function(pos, placer) | |
local meta = minetest.get_meta(pos) | |
meta:set_string("ushirt", 1) | |
end, | |
on_rightclick = function(pos, node, clicker) | |
local meta = minetest.get_meta(pos) | |
local pname = clicker:get_player_name() | |
local pchoices | |
wardrobe.formspec_selections[pname] = 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 | |
for i, fsel in ipairs (wardrobe.formspec_selections[pname]) do | |
pchoices[i] = fsel | |
end | |
minetest.show_formspec( | |
clicker:get_player_name(), | |
"wardrobe_"..minetest.pos_to_string(pos), | |
wardrobe.formspec_meta( | |
pchoices[1], | |
pchoices[2], | |
pchoices[3], pchoices[4], | |
pchoices[5], pchoices[6], | |
pchoices[7], pchoices[8], | |
pchoices[9], pchoices[10], | |
pchoices[11], pchoices[12], | |
pchoices[13], pchoices[14], | |
pchoices[15], pchoices[16], pchoices[17], pchoices[18], pchoices[19], pchoices[20] | |
) | |
) | |
end, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment