master
root 2020-12-12 13:32:26 +01:00
parent 86cf5fc360
commit 58dc26ee92
37 changed files with 711 additions and 0 deletions

View File

@ -0,0 +1,20 @@
unused_args = false
allow_defined_top = true
globals = {
"minetest",
"player_api",
"armor"
}
read_globals = {
string = {fields = {"split"}},
table = {fields = {"copy", "getn"}},
-- Builtin
"vector", "ItemStack",
"dump", "DIR_DELIM", "VoxelArea", "Settings",
-- MTG
"default", "sfinv", "creative",
}

View File

@ -0,0 +1,4 @@
# Licenses
- Source code: GPLv3.
- Textures: CC BY-SA 4.0

View File

@ -0,0 +1,8 @@
# Beauty Pack [modpack]
A cosmetic mod.
## Licenses
- Code: GPL v3.0
- Textures: CC BY-SA 4.0

View File

@ -0,0 +1,3 @@
local modpath = ...
assert(loadfile(modpath .. "/api/api_container.lua"))()

View File

@ -0,0 +1,260 @@
closet.container = {}
closet.container.open_containers = {}
local _contexts = {}
local function get_context(name)
local context = _contexts[name] or {}
_contexts[name] = context
return context
end
minetest.register_on_leaveplayer(function(player)
_contexts[player:get_player_name()] = nil
end)
function closet.compose_preview(clicker, gender)
local inv = clicker:get_inventory()
local inv_list = inv:get_list("cloths")
local head, upper, lower, underwear
for i = 1, #inv_list do
local item_name = inv_list[i]:get_name()
local cloth_type = minetest.get_item_group(item_name, "cloth")
if cloth_type == 1 then
head = minetest.registered_items[item_name]._cloth_preview
elseif cloth_type == 2 then
upper = minetest.registered_items[item_name]._cloth_preview
elseif cloth_type == 3 then
lower = minetest.registered_items[item_name]._cloth_preview
underwear = true
end
end
if not(underwear) then
lower = "cloth_lower_underwear_preview.png"
end
local preview, texture_base
if gender == "male" then
texture_base= "closet_player_preview.png"
else
texture_base = "closet_female_preview.png"
end
preview="[combine:32x64:0,0="..texture_base
if head then
preview= preview .. ":8,0="..head
end
if upper then
preview= preview .. ":0,16="..upper
end
if lower then
preview= preview .. ":8,40="..lower
end
return preview
end
--if minetest.get_modpath("3d_armor")~=nil then
--local clicker_name = clicker:get_player_name()
--texture = armor.textures[clicker_name].skin
--5.4--texture = minetest.formspec_escape(armor.textures[clicker_name].skin)..","..
--5.4armor.textures[clicker_name].armor..","..armor.textures[clicker_name].wielditem
--else
--5.4--texture = clicker:get_properties().textures[1]
--end
--minetest.chat_send_all(raw_texture)
function closet.container.get_container_formspec(pos, clicker)
local gender = player_api.get_gender(clicker)
local model = player_api.get_gender_model(gender)
local preview = closet.compose_preview(clicker, gender)
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
local formspec =
"size[8,8.25]" ..
--5.4--"model[0,0;5,5;preview_model;"..model..";"..texture..";-10,195;;;0,79]"..
"image[0.5,0.5;2,4;"..preview.."]" ..
"list[current_player;cloths;3,0.25;1,4]" ..
"list[nodemeta:" .. spos .. ";closet;5,0.25;3,12;]" ..
"list[current_player;main;0,4.5;8,1;]" ..
"list[current_player;main;0,5.5;8,3;8]" ..
default.get_hotbar_bg(0,4.5)
return formspec
end
-- Allow only "cloth" groups to put/move
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 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'
stack = inventory_info.stack
else
return
end
if stack then
local stack_name = stack:get_name()
local item_group = minetest.get_item_group(stack_name , "cloth")
if item_group == 0 then --not a cloth
return 0
end
--search for another cloth of the same type
local cloth_list = player:get_inventory():get_list("cloths")
for i = 1, #cloth_list do
local cloth_type = minetest.get_item_group(cloth_list[i]:get_name(), "cloth")
if cloth_type == item_group then
return 0
end
end
return 1
end
return 0
end)
minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info)
local update_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
update_cloths = false
end
update_cloths = true
elseif (action == "move" and inventory_info.to_list == "main" and inventory_info.from_list == "cloths") then
update_cloths = true
elseif (action == "put" or action == "take") and inventory_info.listname == "cloths" then
update_cloths = true
else
return
end
if update_cloths then
local player_name = player:get_player_name()
minetest.show_formspec(player_name,
"closet:container", closet.container.get_container_formspec(_contexts[player_name], player))
end
end)
function closet.container.container_lid_close(pn)
local container_open_info = closet.container.open_containers[pn]
local pos = container_open_info.pos
local sound = container_open_info.sound
local swap = container_open_info.swap
closet.container.open_containers[pn] = nil
for k, v in pairs(closet.container.open_containers) do
if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then
return true
end
end
local node = minetest.get_node(pos)
minetest.after(0.2, minetest.swap_node, pos, { name = "closet:" .. swap,
param2 = node.param2 })
minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10})
end
minetest.register_on_leaveplayer(function(player)
local pn = player:get_player_name()
if closet.container.open_containers[pn] then
closet.container.container_lid_close(pn)
end
end)
function closet.container.container_lid_obstructed(pos, direction)
if direction == "above" then
pos = {x = pos.x, y = pos.y + 1, z = pos.z}
end
local def = minetest.registered_nodes[minetest.get_node(pos).name]
-- allow ladders, signs, wallmounted things and torches to not obstruct
if def and
(def.drawtype == "airlike" or
def.drawtype == "signlike" or
def.drawtype == "torchlike" or
(def.drawtype == "nodebox" and def.paramtype2 == "wallmounted")) then
return false
end
return true
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "closet:container" then
return
end
if not player or not fields.quit then
return
end
local pn = player:get_player_name()
if not closet.container.open_containers[pn] then
return
end
local cloth = player_api.compose_cloth(player)
local gender = player:get_meta():get_string("gender")
player_api.registered_models[player_api.get_gender_model(gender)].textures[1] = cloth
local player_name = player:get_player_name()
armor.textures[player_name].skin = cloth
player_api.set_textures(player, player_api.registered_models[player_api.get_gender_model(gender)].textures)
closet.container.container_lid_close(pn)
return true
end)
function closet.register_container(name, d)
local def = table.copy(d)
def.drawtype = 'mesh'
def.paramtype = "light"
def.paramtype2 = "facedir"
def.is_ground_content = false
def.on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", d.description)
local inv = meta:get_inventory()
inv:set_size("closet", 12*1)
end
def.can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("closet")
end
def.on_rightclick = function(pos, node, clicker)
minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos, max_hear_distance = 10})
if not closet.container.container_lid_obstructed(pos, "above") then
minetest.swap_node(pos, {
name = "closet:" .. name .. "_open",
param2 = node.param2 })
end
minetest.after(0.2, minetest.show_formspec,
clicker:get_player_name(),
"closet:container", closet.container.get_container_formspec(pos, clicker))
local player_name = clicker:get_player_name()
_contexts[player_name] = pos
closet.container.open_containers[player_name] = { pos = pos, sound = def.sound_close, swap = name }
end
def.on_blast = function(pos)
local drops = {}
default.get_inventory_drops(pos, "closet", drops)
drops[#drops+1] = "closet:" .. name
minetest.remove_node(pos)
return drops
end
local def_opened = table.copy(def)
local def_closed = table.copy(def)
def_opened.mesh = "closet_open.obj"
def_opened.tiles = {"closet_closet_open.png",}
def_opened.drop = "closet:" .. name
def_opened.groups.not_in_creative_inventory = 1
def_opened.can_dig = function()
return false
end
def_opened.on_blast = function() end
minetest.register_node("closet:" .. name, def_closed)
minetest.register_node("closet:" .. name .. "_open", def_opened)
end

View File

@ -0,0 +1,28 @@
local S = ...
closet.register_container("closet", {
description = S("Closet"),
inventory_image = "closet_closet_inv.png",
mesh = "closet.obj",
tiles = {
"closet_closet.png",
},
selection_box = {
type = "fixed",
fixed = { -1/2, -1/2, 0.062500, 1/2, 1.5, 1/2 },
},
sounds = default.node_sound_wood_defaults(),
sound_open = "default_chest_open",
sound_close = "default_chest_close",
groups = {choppy = 2, oddly_breakable_by_hand = 2},
})
minetest.register_craft({
output = "closet:closet",
type = "shaped",
recipe = {
{"", "group:wood", "group:wood"},
{"", "group:wood", "group:mirror"},
{"", "group:wood", "group:wood"},
}
})

View File

@ -0,0 +1,19 @@
--
-- closet
-- License:GPLv3
--
local modname = "closet"
local modpath = minetest.get_modpath(modname)
-- internationalization boilerplate
local S = minetest.get_translator(minetest.get_current_modname())
--
-- Closet Mod
--
closet = {}
-- Load the files
assert(loadfile(modpath .. "/api/api.lua"))(modpath)
assert(loadfile(modpath .. "/closet.lua"))(S)

View File

@ -0,0 +1,2 @@
# textdomain: closet
Closet=Armario ropero

View File

@ -0,0 +1,5 @@
name = closet
description = A Wardove for put/store cloths
depends = default, player_api, mirrors
optional_depends =
version =

Binary file not shown.

View File

@ -0,0 +1,13 @@
# Blender MTL File: 'closet.blend'
# Material Count: 1
newmtl none
Ns 92.156863
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd /opt/minetest/games/juanchi/mods/closet/textures/closet_closet.png

View File

@ -0,0 +1,50 @@
# Blender v2.79 (sub 0) OBJ File: 'closet.blend'
# www.blender.org
mtllib closet.mtl
o wardrove_nodebox1
v 0.500000 -0.500000 0.062500
v 0.500000 -0.500000 0.500000
v 0.500000 1.500000 0.500000
v 0.500000 1.500000 0.062500
v -0.500000 -0.500000 0.062500
v -0.500000 -0.500000 0.500000
v -0.500000 1.500000 0.500000
v -0.500000 1.500000 0.062500
vt 0.656250 0.179487
vt 0.875000 0.179487
vt 0.875000 1.000000
vt 0.656250 1.000000
vt 0.765625 0.179487
vt 0.546875 0.179487
vt 0.546875 1.000000
vt 0.765625 1.000000
vt 0.000000 0.179487
vt -0.000000 1.000000
vt 0.500000 1.000000
vt 0.515625 0.179487
vt 1.000000 0.179487
vt 1.000000 1.000000
vt 0.500000 1.000000
vt 0.500000 0.179487
vt 0.000000 0.000000
vt 0.500000 0.000000
vt 0.500000 0.179487
vt -0.000000 0.179487
vt 0.500000 0.179487
vt 0.500000 0.000000
vt 0.000000 0.000000
vn -1.0000 0.0000 0.0000
vn -0.5774 0.5774 0.5774
vn -0.7071 0.7071 0.0000
vn 0.0000 -0.0000 1.0000
vn 0.0000 0.7071 0.7071
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
usemtl none
s 1
f 1/1/1 2/2/1 3/3/1 4/4/1
f 5/5/1 6/6/1 7/7/2 8/8/3
f 1/9/4 4/10/4 8/11/4 5/12/4
f 2/13/4 3/14/5 7/15/2 6/16/4
f 1/9/6 2/17/6 6/18/6 5/19/6
f 7/20/2 3/21/5 4/22/7 8/23/3

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
# Blender MTL File: 'closet_open.blend'
# Material Count: 1
newmtl none.002
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd /opt/minetest/games/juanchi/mods/closet/textures/closet_closet_open.png

View File

@ -0,0 +1,86 @@
# Blender v2.79 (sub 0) OBJ File: 'closet_open.blend'
# www.blender.org
mtllib closet_open.mtl
o nodebox2.001
v -0.312500 -0.437500 -0.500000
v -0.312500 1.437500 -0.500000
v -0.312500 1.437500 0.062500
v -0.312500 -0.437500 0.062500
v -0.375000 -0.437500 -0.500000
v -0.375000 -0.437500 0.062500
v -0.375000 1.437500 0.062500
v -0.375000 1.437500 -0.500000
v 0.500000 -0.500000 0.062500
v 0.500000 1.500000 0.062500
v 0.500000 1.500000 0.500000
v 0.500000 -0.500000 0.500000
v -0.500000 -0.500000 0.062500
v -0.500000 -0.500000 0.500000
v -0.500000 1.500000 0.500000
v -0.500000 1.500000 0.062500
vt 0.743902 0.974359
vt 0.743902 0.205128
vt 0.463415 0.205128
vt 0.463415 0.974359
vt 0.780488 0.230769
vt 1.000000 0.230769
vt 1.000000 1.000000
vt 0.780488 1.000000
vt 0.585366 0.205128
vt 0.560976 0.205128
vt 0.560976 0.974359
vt 0.585366 0.974359
vt 0.585366 0.615385
vt 0.585366 0.628205
vt 0.573171 0.628205
vt 0.573171 0.615385
vt 0.719512 0.897436
vt 0.451219 0.897436
vt 0.451219 0.871795
vt 0.719512 0.871795
vt 0.756098 0.615385
vt 0.756098 0.589744
vt 0.475610 0.589744
vt 0.475610 0.615385
vt 0.512195 0.179487
vt 0.512195 1.000000
vt 0.682927 1.000000
vt 0.682927 0.179487
vt 0.597561 0.179487
vt 0.426829 0.179487
vt 0.426829 1.000000
vt 0.597561 1.000000
vt 0.000000 0.179487
vt 0.390244 0.179487
vt 0.390244 1.000000
vt -0.000000 1.000000
vt 0.780488 0.179487
vt 0.780488 1.000000
vt 0.390244 1.000000
vt 0.390244 0.179487
vt 0.000000 -0.000000
vt 0.390244 0.000000
vt 0.390244 0.000000
vt 0.000000 0.000000
vt 0.000000 0.179487
vt 0.390244 0.179487
vn 1.0000 -0.0000 0.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 0.0000 -0.0000 1.0000
vn 0.0000 -1.0000 -0.0000
vn 0.0000 1.0000 0.0000
usemtl none.002
s 1
f 1/1/1 2/2/1 3/3/1 4/4/1
f 5/5/2 6/6/2 7/7/2 8/8/2
f 1/9/3 5/10/3 8/11/3 2/12/3
f 4/13/4 3/14/4 7/15/4 6/16/4
f 1/17/5 4/18/5 6/19/5 5/20/5
f 2/21/6 8/22/6 7/23/6 3/24/6
f 9/25/1 10/26/1 11/27/1 12/28/1
f 13/29/2 14/30/2 15/31/2 16/32/2
f 9/33/3 13/34/3 16/35/3 10/36/3
f 12/37/4 11/38/4 15/39/4 14/40/4
f 9/33/5 12/41/5 14/42/5 13/34/5
f 10/43/6 16/44/6 15/45/6 11/46/6

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,58 @@
--
-- default_clothes
-- License:GPLv3
--
--
-- Default Clothes
--
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,5 @@
name = default_clothes
description = Craft the default player_api cloths
depends = player_api, fabric
optional_depends =
version =

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

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

@ -0,0 +1,39 @@
--
-- mirrors
-- License:GPLv3
--
-- internationalization boilerplate
local S = minetest.get_translator(minetest.get_current_modname())
--
-- Mirrors Mod
--
minetest.register_node("mirrors:mirror", {
description = S("Mirror"),
inventory_image = "mirrors_mirror_inv.png",
wield_image = "mirrors_mirror_inv.png",
tiles = {"mirrors_mirror.png", "mirrors_mirror.png", "mirrors_mirror.png", "mirrors_mirror.png",
"mirrors_mirror_back.png","mirrors_mirror.png"},
groups = {mirror = 1, cracky=1},
sounds = default.node_sound_glass_defaults(),
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.375, 0.5, 0.5, 0.5 },
},
},
})
minetest.register_craft({
output = "mirror:mirror",
type = "shaped",
recipe = {
{"default:stick", "default:stick", "default:stick"},
{"default:stick", "xpanes:pane_flat", "default:stick"},
{"default:stick", "default:stick", "default:stick"},
}
})

View File

@ -0,0 +1,2 @@
# textdomain: mirrors
Mirror=Espejo

View File

@ -0,0 +1,5 @@
name = mirrors
description = A Wardove for put/store cloths
depends = default, xpanes
optional_depends =
version =

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File