master
root 2020-12-03 20:50:12 +01:00
parent 1223c75e8c
commit d18677ebb1
10 changed files with 177 additions and 5 deletions

View File

@ -7,7 +7,7 @@ function closet.container.get_container_formspec(pos, clicker)
local texture
if minetest.get_modpath("3d_armor")~=nil then
local clicker_name = clicker:get_player_name()
texture = armor.textures[clicker_name].skin..","..
texture = minetest.formspec_escape(armor.textures[clicker_name].skin)..","..
armor.textures[clicker_name].armor..","..armor.textures[clicker_name].wielditem
else
texture = clicker:get_properties().textures[1]
@ -16,6 +16,7 @@ function closet.container.get_container_formspec(pos, clicker)
local formspec =
"size[8,8.25]" ..
"style[preview_model;frame_loop=0,79]"..
"model[0,0;5,5;preview_model;"..model..";"..texture..";-10,195]" ..
"list[current_player;cloths;3,0.25;1,4]" ..
"list[nodemeta:" .. spos .. ";closet;5,0.25;3,12;]" ..
@ -29,12 +30,14 @@ end
minetest.register_allow_player_inventory_action(function(player, action, inventory, inventory_info)
local stack
if action == "move" and inventory_info.to_list == "cloths" then --for moving items from player inventory list 'main' to 'cloths'
if action == "move" and inventory_info.to_list == "cloths" then
--for moving items from player inventory list 'main' to 'cloths'
if inventory_info.from_list == inventory_info.to_list then --for moving inside the 'cloths' inventory
return 1
end
stack = inventory:get_stack(inventory_info.from_list, inventory_info.from_index)
elseif action == "put" and inventory_info.listname == "cloths" then --for moving from node inventory 'closet' to player inventory 'cloths'
elseif action == "put" and inventory_info.listname == "cloths" then
--for moving from node inventory 'closet' to player inventory 'cloths'
stack = inventory_info.stack
else
return

58
default_cloths/init.lua Normal file
View File

@ -0,0 +1,58 @@
--
-- default_cloths
-- License:GPLv3
--
--
-- Default Cloths
--
minetest.register_craft({
output = "player_api:cloth_female_upper_default",
type = "shaped",
recipe = {
{"fabric:violet", "", "fabric:violet"},
{"fabric:dark_grey", "fabric:dark_grey", "fabric:dark_grey"},
{"fabric:violet", "fabric:violet", "fabric:violet"},
}
})
minetest.register_craft({
output = "player_api:cloth_male_upper_default",
type = "shaped",
recipe = {
{"fabric:black", "", "fabric:black"},
{"fabric:green", "fabric:green", "fabric:green"},
{"fabric:brown", "fabric:brown", "fabric:brown"},
}
})
minetest.register_craft({
output = "player_api:cloth_male_lower_default",
type = "shaped",
recipe = {
{"fabric:blue", "fabric:blue", "fabric:blue"},
{"fabric:blue", "", "fabric:blue"},
{"fabric:black", "", "fabric:black"},
}
})
minetest.register_craft({
output = "player_api:cloth_female_lower_default",
type = "shaped",
recipe = {
{"fabric:blue", "fabric:blue", "fabric:blue"},
{"fabric:white", "", "fabric:white"},
{"", "", ""},
}
})
minetest.register_craft({
output = "player_api:cloth_female_head_default",
type = "shaped",
recipe = {
{"fabric:pink", "", ""},
{"", "fabric:pink", ""},
{"", "", ""},
}
})

View File

@ -0,0 +1,17 @@
# textdomain: fabric
@1 Cotton Fabric=Tela de algodón @1
White=blanca
Grey=gris
Dark Grey=gris oscura
Black=negra
Violet=violeta
Blue=azul
Cyan=azul claro
Dark Green=verde oscuro
Green=verde
Yellow=amarilla
Brown=marrón
Orange=naranja
Red=roja
Magenta=magenta
Pink=rosa

5
default_cloths/mod.conf Normal file
View File

@ -0,0 +1,5 @@
name = default_cloths
description = Craft the default player_api cloths
depends = player_api
optional_depends =
version =

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

69
fabric/init.lua Normal file
View File

@ -0,0 +1,69 @@
--
-- fabric
-- License:GPLv3
--
-- internationalization boilerplate
local S = minetest.get_translator(minetest.get_current_modname())
--
-- Fabric Mod
--
local fabric_dyes = dye.dyes
for i = 1, #fabric_dyes do
if fabric_dyes[i][1] == "white" then
fabric_dyes[i][3] = "FFFFFF"
elseif fabric_dyes[i][1] == "grey" then
fabric_dyes[i][3] = "808080"
elseif fabric_dyes[i][1] == "dark_grey" then
fabric_dyes[i][3] = "A9A9A9"
elseif fabric_dyes[i][1] == "black" then
fabric_dyes[i][3] = "000000"
elseif fabric_dyes[i][1] == "violet" then
fabric_dyes[i][3] = "EE82EE"
elseif fabric_dyes[i][1] == "blue" then
fabric_dyes[i][3] = "0000FF"
elseif fabric_dyes[i][1] == "cyan" then
fabric_dyes[i][3] = "00FFFF"
elseif fabric_dyes[i][1] == "dark_green" then
fabric_dyes[i][3] = "006400"
elseif fabric_dyes[i][1] == "green" then
fabric_dyes[i][3] = "008000"
elseif fabric_dyes[i][1] == "yellow" then
fabric_dyes[i][3] = "FFFF00"
elseif fabric_dyes[i][1] == "brown" then
fabric_dyes[i][3] = "A52A2A"
elseif fabric_dyes[i][1] == "orange" then
fabric_dyes[i][3] = "FFA500"
elseif fabric_dyes[i][1] == "red" then
fabric_dyes[i][3] = "FF0000"
elseif fabric_dyes[i][1] == "magenta" then
fabric_dyes[i][3] = "FF00FF"
elseif fabric_dyes[i][1] == "pink" then
fabric_dyes[i][3] = "FFC0CB"
end
end
for i = 1, #fabric_dyes do
local name, desc, rgb = unpack(fabric_dyes[i])
desc = S(desc)
minetest.register_craftitem("fabric:".. name, {
description = S("@1 Cotton Fabric", desc),
inventory_image = "fabric_fabric.png^[colorize:#"..rgb..":180",
})
minetest.register_craft({
output = "fabric:".. name,
type = "shaped",
recipe = {
{"", "", ""},
{"", "group:dye,color_" .. name, ""},
{"farming:cotton", "farming:cotton", "farming:cotton"},
}
})
end

View File

@ -0,0 +1,17 @@
# textdomain: fabric
@1 Cotton Fabric=Tela de algodón @1
White=blanca
Grey=gris
Dark Grey=gris oscura
Black=negra
Violet=violeta
Blue=azul
Cyan=azul claro
Dark Green=verde oscuro
Green=verde
Yellow=amarilla
Brown=marrón
Orange=naranja
Red=roja
Magenta=magenta
Pink=rosa

5
fabric/mod.conf Normal file
View File

@ -0,0 +1,5 @@
name = fabric
description = Craft fabrics thru cotton
depends = farming, dye
optional_depends =
version =

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -3,8 +3,6 @@
-- License:GPLv3
--
local modname = "mirrors"
local modpath = minetest.get_modpath(modname)
-- internationalization boilerplate
local S = minetest.get_translator(minetest.get_current_modname())