forked from VoxeLibre/VoxeLibre
Compare commits
19 Commits
master
...
emerald-fi
Author | SHA1 | Date |
---|---|---|
AFCMS | 2714f3345e | |
AFCMS | 250b1dca78 | |
AFCMS | fd8808af1d | |
AFCMS | 27d9c8449b | |
AFCMS | 1d39c9e9a1 | |
AFCMS | a1afa3746a | |
AFCMS | 7253e17bd7 | |
AFCMS | 0baef425d5 | |
AFCMS | 0c7243609f | |
AFCMS | 7f03c4f50e | |
AFCMS | 4de3f1265b | |
AFCMS | ac86cf2214 | |
AFCMS | 966991ce4d | |
AFCMS | 1673c62391 | |
AFCMS | e28f7e1ee9 | |
AFCMS | bf53ca18d6 | |
AFCMS | 0bf3dde857 | |
AFCMS | 09739b0d89 | |
AFCMS | 8fac3d1189 |
|
@ -0,0 +1,25 @@
|
||||||
|
# MineClone2 Formspec Guide
|
||||||
|
|
||||||
|
***This guide will learn you rules about creation of formspecs for the MineClone2 game.***
|
||||||
|
|
||||||
|
Formspecs are an important part of game and mod development.
|
||||||
|
|
||||||
|
First of all, MineClone2 aims to support ONLY last formspec version. Many utility functions will not work with formspec v1 or v2.
|
||||||
|
|
||||||
|
Label font size should be 25 to be minecraft like. We arent modifying formspec prepend in order to not break existing mods.
|
||||||
|
|
||||||
|
Just add this code to apply it to your formspec:
|
||||||
|
```lua
|
||||||
|
mcl_formspec.apply_label_size
|
||||||
|
```
|
||||||
|
|
||||||
|
The typical width of an 9 slots width inventory formspec is `0.375 + 9 + ((9-1) * 0.25) + 0.375 = 11.75`
|
||||||
|
|
||||||
|
Margins is 0.375
|
||||||
|
|
||||||
|
Space between 1st inventory line and the rest of inventory is 0.45
|
||||||
|
|
||||||
|
Labels should have 0.375 space above if there is no other stuff above and 0.45 between content
|
||||||
|
+ 0.375 under
|
||||||
|
|
||||||
|
According to minetest modding book, table.concat is faster than string concatenation, so this method should be prefered (the code is also more clear)
|
|
@ -1,5 +1,16 @@
|
||||||
|
local string = string
|
||||||
|
local table = table
|
||||||
|
|
||||||
|
local sf = string.format
|
||||||
|
|
||||||
mcl_formspec = {}
|
mcl_formspec = {}
|
||||||
|
|
||||||
|
mcl_formspec.label_color = "#313131"
|
||||||
|
|
||||||
|
mcl_formspec.label_size = tonumber(minetest.settings:get("mcl_label_font_size")) or 24
|
||||||
|
|
||||||
|
mcl_formspec.apply_label_size = sf("style_type[label;font_size=%s]", mcl_formspec.label_size)
|
||||||
|
|
||||||
function mcl_formspec.get_itemslot_bg(x, y, w, h)
|
function mcl_formspec.get_itemslot_bg(x, y, w, h)
|
||||||
local out = ""
|
local out = ""
|
||||||
for i = 0, w - 1, 1 do
|
for i = 0, w - 1, 1 do
|
||||||
|
@ -9,3 +20,24 @@ function mcl_formspec.get_itemslot_bg(x, y, w, h)
|
||||||
end
|
end
|
||||||
return out
|
return out
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--This function will replace mcl_formspec.get_itemslot_bg then every formspec will be upgrade to version 4
|
||||||
|
local function get_slot(x, y, size)
|
||||||
|
local t = "image["..x-size..","..y-size..";".. 1+(size*2)..",".. 1+(size*2)..";mcl_formspec_itemslot.png]"
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
|
||||||
|
mcl_formspec.itemslot_border_size = 0.05
|
||||||
|
|
||||||
|
function mcl_formspec.get_itemslot_bg_v4(x, y, w, h, size)
|
||||||
|
if not size then
|
||||||
|
size = mcl_formspec.itemslot_border_size
|
||||||
|
end
|
||||||
|
local out = ""
|
||||||
|
for i = 0, w - 1, 1 do
|
||||||
|
for j = 0, h - 1, 1 do
|
||||||
|
out = out .. get_slot(x+i+(i*0.25), y+j+(j*0.25), size)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return out
|
||||||
|
end
|
|
@ -1,5 +1,8 @@
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
local F = minetest.formspec_escape
|
local F = minetest.formspec_escape
|
||||||
|
local C = minetest.colorize
|
||||||
|
|
||||||
|
local table = table
|
||||||
|
|
||||||
mcl_inventory = {}
|
mcl_inventory = {}
|
||||||
|
|
||||||
|
@ -63,21 +66,88 @@ local function set_inventory(player, armor_change_only)
|
||||||
-- Show armor and player image
|
-- Show armor and player image
|
||||||
local player_preview
|
local player_preview
|
||||||
if minetest.settings:get_bool("3d_player_preview", true) then
|
if minetest.settings:get_bool("3d_player_preview", true) then
|
||||||
player_preview = mcl_player.get_player_formspec_model(player, 1.0, 0.0, 2.25, 4.5, "")
|
player_preview = mcl_player.get_player_formspec_model(player, 1.625, 0.375, 3.5, 4.75, "")
|
||||||
else
|
else
|
||||||
player_preview = "image[1.1,0.2;2,4;"..mcl_player.player_get_preview(player).."]"
|
player_preview = "image[1.625,0.375;3.5,4.75;"..mcl_player.player_get_preview(player).."]"
|
||||||
end
|
end
|
||||||
|
--player_preview = "image[1.625,0.375;3.5,4.75;"..mcl_player.player_get_preview(player).."]"
|
||||||
|
|
||||||
local armor_slots = {"helmet", "chestplate", "leggings", "boots"}
|
local armor_slots = {"helmet", "chestplate", "leggings", "boots"}
|
||||||
local armor_slot_imgs = ""
|
local armor_slot_imgs = ""
|
||||||
for a=1,4 do
|
for a=1,4 do
|
||||||
if inv:get_stack("armor", a+1):is_empty() then
|
if inv:get_stack("armor", a+1):is_empty() then
|
||||||
armor_slot_imgs = armor_slot_imgs .. "image[0,"..(a-1)..";1,1;mcl_inventory_empty_armor_slot_"..armor_slots[a]..".png]"
|
armor_slot_imgs = armor_slot_imgs .. "image[0.375,".. 0.375 + (a-1) + (a-1)* 0.25 ..";1,1;mcl_inventory_empty_armor_slot_"..armor_slots[a]..".png]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local form = "size[9,8.75]"..
|
--"label[0.375,5.575;"..F(C(mcl_formspec.label_color, S("Inventory"))).."]",
|
||||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png]"..
|
|
||||||
|
|
||||||
|
local form = table.concat({
|
||||||
|
"formspec_version[4]",
|
||||||
|
"size[11.75,10.9]",
|
||||||
|
mcl_formspec.apply_label_size,
|
||||||
|
mcl_formspec.get_itemslot_bg_v4(0.375, 0.375, 1, 1),
|
||||||
|
mcl_formspec.get_itemslot_bg_v4(0.375, 1.625, 1, 1),
|
||||||
|
mcl_formspec.get_itemslot_bg_v4(0.375, 2.875, 1, 1),
|
||||||
|
mcl_formspec.get_itemslot_bg_v4(0.375, 4.125, 1, 1),
|
||||||
|
armor_slot_imgs,
|
||||||
|
"list[current_player;armor;0.375,0.375;1,1;1]",
|
||||||
|
"list[current_player;armor;0.375,1.625;1,1;2]",
|
||||||
|
"list[current_player;armor;0.375,2.875;1,1;3]",
|
||||||
|
"list[current_player;armor;0.375,4.125;1,1;4]",
|
||||||
|
|
||||||
|
--TMP FAKE PLAYER PREVIEW
|
||||||
|
"box[1.625,0.375;3.5,4.75;"..mcl_formspec.label_color.."]",
|
||||||
|
player_preview,
|
||||||
|
|
||||||
|
--left hand presupport
|
||||||
|
--mcl_formspec.get_itemslot_bg_v4(5.375, 4.125, 1, 1),
|
||||||
|
--"list[current_player;armor;5.375,4.125;1,1;4]",
|
||||||
|
|
||||||
|
--buttons
|
||||||
|
|
||||||
|
--skins
|
||||||
|
"image_button[5.375,4.125;1,1;mcl_skins_button.png;__mcl_skins;]",
|
||||||
|
"tooltip[__mcl_skins;"..F(S("Select player skin")).."]",
|
||||||
|
|
||||||
|
--crafting guide button
|
||||||
|
"image_button[7.25,4.125;1,1;craftguide_book.png;__mcl_craftguide;]",
|
||||||
|
"tooltip[__mcl_craftguide;"..F(S("Recipe book")).."]",
|
||||||
|
|
||||||
|
--achievements button
|
||||||
|
"image_button[9.125,4.125;1,1;mcl_achievements_button.png;__mcl_achievements;]",
|
||||||
|
"tooltip[__mcl_achievements;"..F(S("Achievements")).."]",
|
||||||
|
|
||||||
|
--help button
|
||||||
|
"image_button[10.375,4.125;1,1;doc_button_icon_lores.png;__mcl_doc;]",
|
||||||
|
"tooltip[__mcl_doc;"..F(S("Help")).."]",
|
||||||
|
|
||||||
|
"label[6.625,0.375;"..F(C(mcl_formspec.label_color, S("Crafting"))).."]",
|
||||||
|
|
||||||
|
--crafting interface
|
||||||
|
mcl_formspec.get_itemslot_bg_v4(6.625, 0.75, 2, 2),
|
||||||
|
"list[current_player;craft;6.625,0.75;2,2]",
|
||||||
|
"image[9.125,1.375;1,1;crafting_formspec_arrow.png]",
|
||||||
|
mcl_formspec.get_itemslot_bg_v4(10.375, 1.375, 1, 1),
|
||||||
|
"list[current_player;craftpreview;10.375,1.375;1,1;]",
|
||||||
|
|
||||||
|
--player inventory
|
||||||
|
mcl_formspec.get_itemslot_bg_v4(0.375, 5.575, 9, 3),
|
||||||
|
mcl_formspec.get_itemslot_bg_v4(0.375, 9.525, 9, 1),
|
||||||
|
"list[current_player;main;0.375,5.575;9,3;9]",
|
||||||
|
"list[current_player;main;0.375,9.525;9,1;]",
|
||||||
|
|
||||||
|
--for shortcuts
|
||||||
|
"listring[current_player;main]",
|
||||||
|
"listring[current_player;armor]",
|
||||||
|
"listring[current_player;main]",
|
||||||
|
"listring[current_player;craft]",
|
||||||
|
"listring[current_player;main]",
|
||||||
|
})
|
||||||
|
|
||||||
|
local form2 = "size[9,8.75]"..
|
||||||
|
--"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png]"..
|
||||||
player_preview..
|
player_preview..
|
||||||
--armor
|
--armor
|
||||||
"list[current_player;armor;0,0;1,1;1]"..
|
"list[current_player;armor;0,0;1,1;1]"..
|
||||||
|
@ -88,12 +158,12 @@ local function set_inventory(player, armor_change_only)
|
||||||
mcl_formspec.get_itemslot_bg(0,1,1,1)..
|
mcl_formspec.get_itemslot_bg(0,1,1,1)..
|
||||||
mcl_formspec.get_itemslot_bg(0,2,1,1)..
|
mcl_formspec.get_itemslot_bg(0,2,1,1)..
|
||||||
mcl_formspec.get_itemslot_bg(0,3,1,1)..
|
mcl_formspec.get_itemslot_bg(0,3,1,1)..
|
||||||
armor_slot_imgs..
|
--armor_slot_imgs..
|
||||||
-- craft and inventory
|
-- craft and inventory
|
||||||
"label[0,4;"..F(minetest.colorize("#313131", S("Inventory"))).."]"..
|
"label[0,4;"..F(C("#313131", S("Inventory"))).."]"..
|
||||||
"list[current_player;main;0,4.5;9,3;9]"..
|
"list[current_player;main;0,4.5;9,3;9]"..
|
||||||
"list[current_player;main;0,7.74;9,1;]"..
|
"list[current_player;main;0,7.74;9,1;]"..
|
||||||
"label[4,0.5;"..F(minetest.colorize("#313131", S("Crafting"))).."]"..
|
"label[4,0.5;"..F(C("#313131", S("Crafting"))).."]"..
|
||||||
"list[current_player;craft;4,1;2,2]"..
|
"list[current_player;craft;4,1;2,2]"..
|
||||||
"list[current_player;craftpreview;7,1.5;1,1;]"..
|
"list[current_player;craftpreview;7,1.5;1,1;]"..
|
||||||
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
|
@ -1,4 +1,13 @@
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
local F = minetest.formspec_escape
|
||||||
|
local C = minetest.colorize
|
||||||
|
|
||||||
|
local string = string
|
||||||
|
local table = table
|
||||||
|
local math = math
|
||||||
|
|
||||||
|
local sf = string.format
|
||||||
|
|
||||||
local mod_doc = minetest.get_modpath("doc")
|
local mod_doc = minetest.get_modpath("doc")
|
||||||
|
|
||||||
-- Chest Entity
|
-- Chest Entity
|
||||||
|
@ -13,7 +22,7 @@ local entity_animations = {
|
||||||
speed = 25,
|
speed = 25,
|
||||||
open = {x = 0, y = 7},
|
open = {x = 0, y = 7},
|
||||||
close = {x = 13, y = 20},
|
close = {x = 13, y = 20},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
minetest.register_entity("mcl_chests:chest", {
|
minetest.register_entity("mcl_chests:chest", {
|
||||||
|
@ -207,23 +216,23 @@ local function chest_update_after_close(pos)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
|
|
||||||
if node.name == "mcl_chests:trapped_chest_on_small" then
|
if node.name == "mcl_chests:trapped_chest_on_small" then
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_small", param2 = node.param2})
|
minetest.swap_node(pos, {name = "mcl_chests:trapped_chest_small", param2 = node.param2})
|
||||||
find_or_create_entity(pos, "mcl_chests:trapped_chest_small", {"mcl_chests_trapped.png"}, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_small")
|
find_or_create_entity(pos, "mcl_chests:trapped_chest_small", {"mcl_chests_trapped.png"}, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_small")
|
||||||
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
||||||
elseif node.name == "mcl_chests:trapped_chest_on_left" then
|
elseif node.name == "mcl_chests:trapped_chest_on_left" then
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
minetest.swap_node(pos, {name = "mcl_chests:trapped_chest_left", param2 = node.param2})
|
||||||
find_or_create_entity(pos, "mcl_chests:trapped_chest_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
find_or_create_entity(pos, "mcl_chests:trapped_chest_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
||||||
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
||||||
|
|
||||||
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
||||||
minetest.swap_node(pos_other, {name="mcl_chests:trapped_chest_right", param2 = node.param2})
|
minetest.swap_node(pos_other, {name = "mcl_chests:trapped_chest_right", param2 = node.param2})
|
||||||
mesecon.receptor_off(pos_other, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos_other, trapped_chest_mesecons_rules)
|
||||||
elseif node.name == "mcl_chests:trapped_chest_on_right" then
|
elseif node.name == "mcl_chests:trapped_chest_on_right" then
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_right", param2 = node.param2})
|
minetest.swap_node(pos, {name = "mcl_chests:trapped_chest_right", param2 = node.param2})
|
||||||
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
||||||
|
|
||||||
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "right")
|
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "right")
|
||||||
minetest.swap_node(pos_other, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
minetest.swap_node(pos_other, {name = "mcl_chests:trapped_chest_left", param2 = node.param2})
|
||||||
find_or_create_entity(pos_other, "mcl_chests:trapped_chest_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
find_or_create_entity(pos_other, "mcl_chests:trapped_chest_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
||||||
mesecon.receptor_off(pos_other, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos_other, trapped_chest_mesecons_rules)
|
||||||
end
|
end
|
||||||
|
@ -474,18 +483,29 @@ local function register_chest(basename, desc, longdesc, usagehelp, tt_help, tile
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.show_formspec(clicker:get_player_name(),
|
minetest.show_formspec(clicker:get_player_name(),
|
||||||
"mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z,
|
sf("mcl_chests:%s_%s_%s_%s", canonical_basename, pos.x, pos.y, pos.z),
|
||||||
"size[9,8.75]"..
|
table.concat({
|
||||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", name)).."]"..
|
"formspec_version[4]",
|
||||||
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]"..
|
"size[11.75,10.425]",
|
||||||
mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
|
mcl_formspec.apply_label_size,
|
||||||
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
|
||||||
"list[current_player;main;0,4.5;9,3;9]"..
|
"label[0.375,0.375;"..F(C(mcl_formspec.label_color, name)).."]",
|
||||||
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
|
||||||
"list[current_player;main;0,7.74;9,1;]"..
|
mcl_formspec.get_itemslot_bg_v4(0.375, 0.75, 9, 3),
|
||||||
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
|
sf("list[nodemeta:%s,%s,%s;main;0.375,0.75;9,3;]", pos.x, pos.y, pos.z),
|
||||||
"listring[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main]"..
|
|
||||||
"listring[current_player;main]")
|
"label[0.375,4.7;"..F(C(mcl_formspec.label_color, S("Inventory"))).."]",
|
||||||
|
|
||||||
|
mcl_formspec.get_itemslot_bg_v4(0.375, 5.1, 9, 3),
|
||||||
|
"list[current_player;main;0.375,5.1;9,3;9]",
|
||||||
|
|
||||||
|
mcl_formspec.get_itemslot_bg_v4(0.375, 9.05, 9, 1),
|
||||||
|
"list[current_player;main;0.375,9.05;9,1;]",
|
||||||
|
|
||||||
|
sf("listring[nodemeta:%s,%s,%s;main]", pos.x, pos.y, pos.z),
|
||||||
|
"listring[current_player;main]",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
if on_rightclick_addendum then
|
if on_rightclick_addendum then
|
||||||
on_rightclick_addendum(pos, node, clicker)
|
on_rightclick_addendum(pos, node, clicker)
|
||||||
|
@ -623,26 +643,38 @@ local function register_chest(basename, desc, longdesc, usagehelp, tt_help, tile
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.show_formspec(clicker:get_player_name(),
|
minetest.show_formspec(clicker:get_player_name(),
|
||||||
"mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z,
|
sf("mcl_chests:%s_%s_%s_%s", canonical_basename, pos.x, pos.y, pos.z),
|
||||||
"size[9,11.5]"..
|
table.concat({
|
||||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", name)).."]"..
|
"formspec_version[4]",
|
||||||
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]"..
|
"size[11.75,14.15]",
|
||||||
mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
|
mcl_formspec.apply_label_size,
|
||||||
"list[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main;0,3.5;9,3;]"..
|
|
||||||
mcl_formspec.get_itemslot_bg(0,3.5,9,3)..
|
"label[0.375,0.375;"..F(C(mcl_formspec.label_color, name)).."]",
|
||||||
"label[0,7;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
|
||||||
"list[current_player;main;0,7.5;9,3;9]"..
|
mcl_formspec.get_itemslot_bg_v4(0.375, 0.75, 9, 3),
|
||||||
mcl_formspec.get_itemslot_bg(0,7.5,9,3)..
|
sf("list[nodemeta:%s,%s,%s;main;0.375,0.75;9,3;]", pos.x, pos.y, pos.z),
|
||||||
"list[current_player;main;0,10.75;9,1;]"..
|
|
||||||
mcl_formspec.get_itemslot_bg(0,10.75,9,1)..
|
mcl_formspec.get_itemslot_bg_v4(0.375, 4.5, 9, 3),
|
||||||
-- BEGIN OF LISTRING WORKAROUND
|
sf("list[nodemeta:%s,%s,%s;main;0.375,4.5;9,3;]", pos_other.x, pos_other.y, pos_other.z),
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[nodemeta:"..pos.x..","..pos.y..","..pos.z..";input]"..
|
"label[0.375,8.45;"..F(C(mcl_formspec.label_color, S("Inventory"))).."]",
|
||||||
-- END OF LISTRING WORKAROUND
|
|
||||||
"listring[current_player;main]"..
|
mcl_formspec.get_itemslot_bg_v4(0.375, 8.825, 9, 3),
|
||||||
"listring[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main]"..
|
"list[current_player;main;0.375,8.825;9,3;9]",
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main]")
|
mcl_formspec.get_itemslot_bg_v4(0.375, 12.775, 9, 1),
|
||||||
|
"list[current_player;main;0.375,12.775;9,1;]",
|
||||||
|
|
||||||
|
--BEGIN OF LISTRING WORKAROUND
|
||||||
|
"listring[current_player;main]",
|
||||||
|
sf("listring[nodemeta:%s,%s,%s;input]", pos.x, pos.y, pos.z),
|
||||||
|
--END OF LISTRING WORKAROUND
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
sf("listring[nodemeta:%s,%s,%s;main]", pos.x, pos.y, pos.z),
|
||||||
|
"listring[current_player;main]",
|
||||||
|
sf("listring[nodemeta:%s,%s,%s;main]", pos_other.x, pos_other.y, pos_other.z),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
if on_rightclick_addendum_left then
|
if on_rightclick_addendum_left then
|
||||||
on_rightclick_addendum_left(pos, node, clicker)
|
on_rightclick_addendum_left(pos, node, clicker)
|
||||||
|
@ -770,27 +802,38 @@ local function register_chest(basename, desc, longdesc, usagehelp, tt_help, tile
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.show_formspec(clicker:get_player_name(),
|
minetest.show_formspec(clicker:get_player_name(),
|
||||||
"mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z,
|
sf("mcl_chests:%s_%s_%s_%s", canonical_basename, pos.x, pos.y, pos.z),
|
||||||
|
table.concat({
|
||||||
|
"formspec_version[4]",
|
||||||
|
"size[11.75,14.15]",
|
||||||
|
mcl_formspec.apply_label_size,
|
||||||
|
|
||||||
"size[9,11.5]"..
|
"label[0.375,0.375;"..F(C(mcl_formspec.label_color, name)).."]",
|
||||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", name)).."]"..
|
|
||||||
"list[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main;0,0.5;9,3;]"..
|
mcl_formspec.get_itemslot_bg_v4(0.375, 0.75, 9, 3),
|
||||||
mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
|
sf("list[nodemeta:%s,%s,%s;main;0.375,0.75;9,3;]", pos_other.x, pos_other.y, pos_other.z),
|
||||||
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,3.5;9,3;]"..
|
|
||||||
mcl_formspec.get_itemslot_bg(0,3.5,9,3)..
|
mcl_formspec.get_itemslot_bg_v4(0.375, 4.5, 9, 3),
|
||||||
"label[0,7;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
sf("list[nodemeta:%s,%s,%s;main;0.375,4.5;9,3;]", pos.x, pos.y, pos.z),
|
||||||
"list[current_player;main;0,7.5;9,3;9]"..
|
|
||||||
mcl_formspec.get_itemslot_bg(0,7.5,9,3)..
|
"label[0.375,8.45;"..F(C(mcl_formspec.label_color, S("Inventory"))).."]",
|
||||||
"list[current_player;main;0,10.75;9,1;]"..
|
|
||||||
mcl_formspec.get_itemslot_bg(0,10.75,9,1)..
|
mcl_formspec.get_itemslot_bg_v4(0.375, 8.825, 9, 3),
|
||||||
-- BEGIN OF LISTRING WORKAROUND
|
"list[current_player;main;0.375,8.825;9,3;9]",
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[nodemeta:"..pos.x..","..pos.y..","..pos.z..";input]"..
|
mcl_formspec.get_itemslot_bg_v4(0.375, 12.775, 9, 1),
|
||||||
-- END OF LISTRING WORKAROUND
|
"list[current_player;main;0.375,12.775;9,1;]",
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main]"..
|
--BEGIN OF LISTRING WORKAROUND
|
||||||
"listring[current_player;main]"..
|
"listring[current_player;main]",
|
||||||
"listring[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main]")
|
sf("listring[nodemeta:%s,%s,%s;input]", pos.x, pos.y, pos.z),
|
||||||
|
--END OF LISTRING WORKAROUND
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
sf("listring[nodemeta:%s,%s,%s;main]", pos_other.x, pos_other.y, pos_other.z),
|
||||||
|
"listring[current_player;main]",
|
||||||
|
sf("listring[nodemeta:%s,%s,%s;main]", pos.x, pos.y, pos.z),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
if on_rightclick_addendum_right then
|
if on_rightclick_addendum_right then
|
||||||
on_rightclick_addendum_right(pos, node, clicker)
|
on_rightclick_addendum_right(pos, node, clicker)
|
||||||
|
@ -854,10 +897,12 @@ register_chest("trapped_chest",
|
||||||
S("27 inventory slots") .. "\n" .. S("Can be combined to a large chest") .. "\n" .. S("Emits a redstone signal when opened"),
|
S("27 inventory slots") .. "\n" .. S("Can be combined to a large chest") .. "\n" .. S("Emits a redstone signal when opened"),
|
||||||
traptiles,
|
traptiles,
|
||||||
nil,
|
nil,
|
||||||
{receptor = {
|
{
|
||||||
state = mesecon.state.off,
|
receptor = {
|
||||||
rules = trapped_chest_mesecons_rules,
|
state = mesecon.state.off,
|
||||||
}},
|
rules = trapped_chest_mesecons_rules,
|
||||||
|
},
|
||||||
|
},
|
||||||
function(pos, node, clicker)
|
function(pos, node, clicker)
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_on_small", param2 = node.param2})
|
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_on_small", param2 = node.param2})
|
||||||
find_or_create_entity(pos, "mcl_chests:trapped_chest_on_small", {"mcl_chests_trapped.png"}, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_on_small")
|
find_or_create_entity(pos, "mcl_chests:trapped_chest_on_small", {"mcl_chests_trapped.png"}, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_on_small")
|
||||||
|
@ -889,10 +934,12 @@ register_chest("trapped_chest",
|
||||||
|
|
||||||
register_chest("trapped_chest_on",
|
register_chest("trapped_chest_on",
|
||||||
nil, nil, nil, nil, traptiles, true,
|
nil, nil, nil, nil, traptiles, true,
|
||||||
{receptor = {
|
{
|
||||||
state = mesecon.state.on,
|
receptor = {
|
||||||
rules = trapped_chest_mesecons_rules,
|
state = mesecon.state.on,
|
||||||
}},
|
rules = trapped_chest_mesecons_rules,
|
||||||
|
},
|
||||||
|
},
|
||||||
nil, nil, nil,
|
nil, nil, nil,
|
||||||
"trapped_chest",
|
"trapped_chest",
|
||||||
"trapped_chest"
|
"trapped_chest"
|
||||||
|
@ -949,19 +996,19 @@ minetest.register_craft({
|
||||||
{"group:wood", "group:wood", "group:wood"},
|
{"group:wood", "group:wood", "group:wood"},
|
||||||
{"group:wood", "", "group:wood"},
|
{"group:wood", "", "group:wood"},
|
||||||
{"group:wood", "group:wood", "group:wood"},
|
{"group:wood", "group:wood", "group:wood"},
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "mcl_chests:chest",
|
recipe = "mcl_chests:chest",
|
||||||
burntime = 15
|
burntime = 15,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "mcl_chests:trapped_chest",
|
recipe = "mcl_chests:trapped_chest",
|
||||||
burntime = 15
|
burntime = 15,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("mcl_chests:ender_chest", {
|
minetest.register_node("mcl_chests:ender_chest", {
|
||||||
|
@ -985,17 +1032,27 @@ minetest.register_node("mcl_chests:ender_chest", {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local formspec_ender_chest = "size[9,8.75]"..
|
local formspec_ender_chest = table.concat({
|
||||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Ender Chest"))).."]"..
|
"formspec_version[4]",
|
||||||
"list[current_player;enderchest;0,0.5;9,3;]"..
|
"size[11.75,10.425]",
|
||||||
mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
|
mcl_formspec.apply_label_size,
|
||||||
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
|
||||||
"list[current_player;main;0,4.5;9,3;9]"..
|
"label[0.375,0.375;"..F(C(mcl_formspec.label_color, S("Ender Chest"))).."]",
|
||||||
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
|
||||||
"list[current_player;main;0,7.74;9,1;]"..
|
mcl_formspec.get_itemslot_bg_v4(0.375, 0.75, 9, 3),
|
||||||
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
|
"list[current_player;enderchest;0.375,0.75;9,3;]",
|
||||||
"listring[current_player;enderchest]"..
|
|
||||||
"listring[current_player;main]"
|
"label[0.375,4.7;"..F(C(mcl_formspec.label_color, S("Inventory"))).."]",
|
||||||
|
|
||||||
|
mcl_formspec.get_itemslot_bg_v4(0.375, 5.1, 9, 3),
|
||||||
|
"list[current_player;main;0.375,5.1;9,3;9]",
|
||||||
|
|
||||||
|
mcl_formspec.get_itemslot_bg_v4(0.375, 9.05, 9, 1),
|
||||||
|
"list[current_player;main;0.375,9.05;9,1;]",
|
||||||
|
|
||||||
|
"listring[current_player;enderchest]",
|
||||||
|
"listring[current_player;main]",
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("mcl_chests:ender_chest_small", {
|
minetest.register_node("mcl_chests:ender_chest_small", {
|
||||||
|
@ -1059,7 +1116,7 @@ minetest.register_craft({
|
||||||
{"mcl_core:obsidian", "mcl_core:obsidian", "mcl_core:obsidian"},
|
{"mcl_core:obsidian", "mcl_core:obsidian", "mcl_core:obsidian"},
|
||||||
{"mcl_core:obsidian", "mcl_end:ender_eye", "mcl_core:obsidian"},
|
{"mcl_core:obsidian", "mcl_end:ender_eye", "mcl_core:obsidian"},
|
||||||
{"mcl_core:obsidian", "mcl_core:obsidian", "mcl_core:obsidian"},
|
{"mcl_core:obsidian", "mcl_core:obsidian", "mcl_core:obsidian"},
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Shulker boxes
|
-- Shulker boxes
|
||||||
|
@ -1102,21 +1159,33 @@ local shulker_mob_textures = {
|
||||||
}
|
}
|
||||||
local canonical_shulker_color = "violet"
|
local canonical_shulker_color = "violet"
|
||||||
|
|
||||||
|
--WARNING: after formspec v4 update, old shulker boxes will need to be placed again to get the new formspec
|
||||||
local function formspec_shulker_box(name)
|
local function formspec_shulker_box(name)
|
||||||
if name == "" then
|
if not name or name == "" then
|
||||||
name = S("Shulker Box")
|
name = S("Shulker Box")
|
||||||
end
|
end
|
||||||
return "size[9,8.75]"..
|
|
||||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", name)).."]"..
|
return table.concat({
|
||||||
"list[context;main;0,0.5;9,3;]"..
|
"formspec_version[4]",
|
||||||
mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
|
"size[11.75,10.425]",
|
||||||
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
mcl_formspec.apply_label_size,
|
||||||
"list[current_player;main;0,4.5;9,3;9]"..
|
|
||||||
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
"label[0.375,0.375;"..F(C(mcl_formspec.label_color, name)).."]",
|
||||||
"list[current_player;main;0,7.74;9,1;]"..
|
|
||||||
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
|
mcl_formspec.get_itemslot_bg_v4(0.375, 0.75, 9, 3),
|
||||||
"listring[context;main]"..
|
"list[context;main;0.375,0.75;9,3;]",
|
||||||
"listring[current_player;main]"
|
|
||||||
|
"label[0.375,4.7;"..F(C(mcl_formspec.label_color, S("Inventory"))).."]",
|
||||||
|
|
||||||
|
mcl_formspec.get_itemslot_bg_v4(0.375, 5.1, 9, 3),
|
||||||
|
"list[current_player;main;0.375,5.1;9,3;9]",
|
||||||
|
|
||||||
|
mcl_formspec.get_itemslot_bg_v4(0.375, 9.05, 9, 1),
|
||||||
|
"list[current_player;main;0.375,9.05;9,1;]",
|
||||||
|
|
||||||
|
"listring[context;main]",
|
||||||
|
"listring[current_player;main]",
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_shulkerbox_meta(nmeta, imeta)
|
local function set_shulkerbox_meta(nmeta, imeta)
|
||||||
|
@ -1227,9 +1296,9 @@ for color, desc in pairs(boxtypes) do
|
||||||
drop = "",
|
drop = "",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
-- TODO: Make shulker boxes rotatable
|
-- TODO: Make shulker boxes rotatable
|
||||||
-- This doesn't work, it just destroys the inventory:
|
-- This doesn't work, it just destroys the inventory:
|
||||||
-- on_place = minetest.rotate_node,
|
-- on_place = minetest.rotate_node,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", formspec_shulker_box(nil))
|
meta:set_string("formspec", formspec_shulker_box(nil))
|
||||||
|
@ -1315,7 +1384,7 @@ for color, desc in pairs(boxtypes) do
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "mcl_chests:"..color.."_shulker_box",
|
output = "mcl_chests:"..color.."_shulker_box",
|
||||||
recipe = { "group:shulker_box", "mcl_dye:"..color }
|
recipe = {"group:shulker_box", "mcl_dye:"..color},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1325,7 +1394,7 @@ minetest.register_craft({
|
||||||
{"mcl_mobitems:shulker_shell"},
|
{"mcl_mobitems:shulker_shell"},
|
||||||
{"mcl_chests:chest"},
|
{"mcl_chests:chest"},
|
||||||
{"mcl_mobitems:shulker_shell"},
|
{"mcl_mobitems:shulker_shell"},
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Save metadata of shulker box when used in crafting
|
-- Save metadata of shulker box when used in crafting
|
||||||
|
@ -1399,13 +1468,13 @@ minetest.register_lbm({
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_lbm({
|
minetest.register_lbm({
|
||||||
label = "Update shulker box formspecs (0.60.0)",
|
label = "Update shulker box formspecs (0.72.0)",
|
||||||
name = "mcl_chests:update_shulker_box_formspecs_0_60_0",
|
name = "mcl_chests:update_shulker_box_formspecs_0_72_0",
|
||||||
nodenames = { "group:shulker_box" },
|
nodenames = { "group:shulker_box" },
|
||||||
run_at_every_load = false,
|
run_at_every_load = false,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", formspec_shulker_box)
|
meta:set_string("formspec", formspec_shulker_box(meta:get_string("name")))
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
local F = minetest.formspec_escape
|
||||||
|
local C = minetest.colorize
|
||||||
|
|
||||||
--[[ BEGIN OF NODE DEFINITIONS ]]
|
--[[ BEGIN OF NODE DEFINITIONS ]]
|
||||||
|
|
||||||
local mcl_hoppers_formspec =
|
local mcl_hoppers_formspec = table.concat({
|
||||||
"size[9,7]"..
|
"size[9,7]",
|
||||||
"label[2,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Hopper"))).."]"..
|
"label[2,0;"..F(C(mcl_formspec.label_color, S("Hopper"))).."]",
|
||||||
"list[context;main;2,0.5;5,1;]"..
|
"list[context;main;2,0.5;5,1;]",
|
||||||
mcl_formspec.get_itemslot_bg(2,0.5,5,1)..
|
mcl_formspec.get_itemslot_bg(2,0.5,5,1),
|
||||||
"label[0,2;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
"label[0,2;"..F(C(mcl_formspec.label_color, S("Inventory"))).."]",
|
||||||
"list[current_player;main;0,2.5;9,3;9]"..
|
"list[current_player;main;0,2.5;9,3;9]",
|
||||||
mcl_formspec.get_itemslot_bg(0,2.5,9,3)..
|
mcl_formspec.get_itemslot_bg(0,2.5,9,3),
|
||||||
"list[current_player;main;0,5.74;9,1;]"..
|
"list[current_player;main;0,5.74;9,1;]",
|
||||||
mcl_formspec.get_itemslot_bg(0,5.74,9,1)..
|
mcl_formspec.get_itemslot_bg(0,5.74,9,1),
|
||||||
"listring[context;main]"..
|
"listring[context;main]",
|
||||||
"listring[current_player;main]"
|
"listring[current_player;main]"
|
||||||
|
})
|
||||||
|
|
||||||
-- Downwards hopper (base definition)
|
-- Downwards hopper (base definition)
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ function mcl_player.player_get_preview(player)
|
||||||
if preview == "" then
|
if preview == "" then
|
||||||
preview = "player.png"
|
preview = "player.png"
|
||||||
end
|
end
|
||||||
local armor_preview = player:get_meta():set_string("mcl_player:armor_preview")
|
local armor_preview = player:get_meta():get_string("mcl_player:armor_preview")
|
||||||
if armor_preview ~= "" then
|
if armor_preview ~= "" then
|
||||||
preview = preview .. "^" .. armor_preview
|
preview = preview .. "^" .. armor_preview
|
||||||
end
|
end
|
||||||
|
|
|
@ -100,6 +100,11 @@ animated_chests (Animated chests) bool true
|
||||||
# The maximum number of boss bars to simultaniously display on the screen
|
# The maximum number of boss bars to simultaniously display on the screen
|
||||||
max_bossbars (Maximum Boss bars) int 5
|
max_bossbars (Maximum Boss bars) int 5
|
||||||
|
|
||||||
|
# Define how wide font will be displayed in mineclone2 formspecs
|
||||||
|
# This allow MineClone2 to have a label size similar to minecraft, but allowing at least singleplayer to use his own font with custom size
|
||||||
|
# (some fonts may be bigger than the default one and break formspecs)
|
||||||
|
mcl_label_font_size (Label Font Size) int 24
|
||||||
|
|
||||||
[Experimental]
|
[Experimental]
|
||||||
# Whether ice is translucent. If disabled, ice is fully opaque.
|
# Whether ice is translucent. If disabled, ice is fully opaque.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue