Revert "move barrels to mcl_chests"

This reverts commit a272322cb5.
This commit is contained in:
AFCMS 2022-02-22 20:20:21 +01:00 committed by cora
parent cfe9067393
commit dfec4a5422
15 changed files with 49 additions and 20 deletions

View file

@ -1,7 +1,9 @@
local S = minetest.get_translator("mcl_chests") local S = minetest.get_translator("mcl_barrels")
local F = minetest.formspec_escape local F = minetest.formspec_escape
local C = minetest.colorize local C = minetest.colorize
--TODO: fix barrel rotation placement
local open_barrels = {} local open_barrels = {}
local drop_content = mcl_util.drop_items_from_meta_container("main") local drop_content = mcl_util.drop_items_from_meta_container("main")
@ -22,7 +24,7 @@ local function barrel_open(pos, node, clicker)
local playername = clicker:get_player_name() local playername = clicker:get_player_name()
minetest.show_formspec(playername, minetest.show_formspec(playername,
"mcl_chests:barrel_"..pos.x.."_"..pos.y.."_"..pos.z, "mcl_barrels:barrel_"..pos.x.."_"..pos.y.."_"..pos.z,
table.concat({ table.concat({
"size[9,8.75]", "size[9,8.75]",
"label[0,0;"..F(C("#313131", name)).."]", "label[0,0;"..F(C("#313131", name)).."]",
@ -38,13 +40,13 @@ local function barrel_open(pos, node, clicker)
}) })
) )
minetest.swap_node(pos, { name = "mcl_chests:barrel_open", param2 = node.param2 }) minetest.swap_node(pos, { name = "mcl_barrels:barrel_open", param2 = node.param2 })
open_barrels[playername] = pos open_barrels[playername] = pos
end end
local function close_forms(pos) local function close_forms(pos)
local players = minetest.get_connected_players() local players = minetest.get_connected_players()
local formname = "mcl_chests:barrel_"..pos.x.."_"..pos.y.."_"..pos.z local formname = "mcl_barrels:barrel_"..pos.x.."_"..pos.y.."_"..pos.z
for p = 1, #players do for p = 1, #players do
if vector.distance(players[p]:get_pos(), pos) <= 30 then if vector.distance(players[p]:get_pos(), pos) <= 30 then
minetest.close_formspec(players[p]:get_player_name(), formname) minetest.close_formspec(players[p]:get_player_name(), formname)
@ -55,8 +57,8 @@ end
local function update_after_close(pos) local function update_after_close(pos)
local node = minetest.get_node_or_nil(pos) local node = minetest.get_node_or_nil(pos)
if not node then return end if not node then return end
if node.name == "mcl_chests:barrel_open" then if node.name == "mcl_barrels:barrel_open" then
minetest.swap_node(pos, {name = "mcl_chests:barrel_closed", param2 = node.param2}) minetest.swap_node(pos, {name = "mcl_barrels:barrel_closed", param2 = node.param2})
end end
end end
@ -72,12 +74,12 @@ local function close_barrel(player)
open_barrels[name] = nil open_barrels[name] = nil
end end
minetest.register_node("mcl_chests:barrel_closed", { minetest.register_node("mcl_barrels:barrel_closed", {
description = S("Barrel"), description = S("Barrel"),
_tt_help = S("27 inventory slots"), _tt_help = S("27 inventory slots"),
_doc_items_longdesc = S("Barrels are containers which provide 27 inventory slots."), _doc_items_longdesc = S("Barrels are containers which provide 27 inventory slots."),
_doc_items_usagehelp = S("To access its inventory, rightclick it. When broken, the items will drop out."), _doc_items_usagehelp = S("To access its inventory, rightclick it. When broken, the items will drop out."),
tiles = {"mcl_chests_barrel_top.png^[transformR270", "mcl_chests_barrel_bottom.png", "mcl_chests_barrel_side.png"}, tiles = {"mcl_barrels_barrel_top.png^[transformR270", "mcl_barrels_barrel_bottom.png", "mcl_barrels_barrel_side.png"},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
--on_place = mcl_util.rotate_axis, --on_place = mcl_util.rotate_axis,
@ -104,16 +106,16 @@ minetest.register_node("mcl_chests:barrel_closed", {
_mcl_hardness = 2.5, _mcl_hardness = 2.5,
}) })
minetest.register_node("mcl_chests:barrel_open", { minetest.register_node("mcl_barrels:barrel_open", {
description = S("Barrel Open"), description = S("Barrel Open"),
_tt_help = S("27 inventory slots"), _tt_help = S("27 inventory slots"),
_doc_items_longdesc = S("Barrels are containers which provide 27 inventory slots."), _doc_items_longdesc = S("Barrels are containers which provide 27 inventory slots."),
_doc_items_usagehelp = S("To access its inventory, rightclick it. When broken, the items will drop out."), _doc_items_usagehelp = S("To access its inventory, rightclick it. When broken, the items will drop out."),
_doc_items_create_entry = false, _doc_items_create_entry = false,
tiles = {"mcl_chests_barrel_top_open.png", "mcl_chests_barrel_bottom.png", "mcl_chests_barrel_side.png"}, tiles = {"mcl_barrels_barrel_top_open.png", "mcl_barrels_barrel_bottom.png", "mcl_barrels_barrel_side.png"},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
drop = "mcl_chests:barrel_closed", drop = "mcl_barrels:barrel_closed",
stack_max = 64, stack_max = 64,
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
groups = {handy = 1, axey = 1, container = 2, material_wood = 1, flammable = -1, deco_block = 1, not_in_creative_inventory = 1}, groups = {handy = 1, axey = 1, container = 2, material_wood = 1, flammable = -1, deco_block = 1, not_in_creative_inventory = 1},
@ -126,7 +128,7 @@ minetest.register_node("mcl_chests:barrel_open", {
}) })
minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname:find("mcl_chests:barrel") == 1 and fields.quit then if formname:find("mcl_barrels:") == 1 and fields.quit then
close_barrel(player) close_barrel(player)
end end
end) end)
@ -137,10 +139,10 @@ end)
--Minecraft Java Edition craft --Minecraft Java Edition craft
minetest.register_craft({ minetest.register_craft({
output = "mcl_chests:barrel_closed", output = "mcl_barrels:barrel_closed",
recipe = { recipe = {
{"group:wood", "group:wood_slab", "group:wood"}, {"group:wood", "group:wood_slab", "group:wood"},
{"group:wood", "", "group:wood"}, {"group:wood", "", "group:wood"},
{"group:wood", "group:wood_slab", "group:wood"}, {"group:wood", "group:wood_slab", "group:wood"},
}, }
}) })

View file

@ -0,0 +1,5 @@
# textdomain: mcl_barrels
Barrel=
Barrels are containers which provide 27 inventory slots.=
To access its inventory, rightclick it. When broken, the items will drop out.=
27 inventory slots=

View file

@ -0,0 +1,5 @@
# textdomain: mcl_barrels
Barrel=
Barrels are containers which provide 27 inventory slots.=
To access its inventory, rightclick it. When broken, the items will drop out.=
27 inventory slots=

View file

@ -0,0 +1,5 @@
# textdomain: mcl_barrels
Barrel=Tonneau
Barrels are containers which provide 27 inventory slots.=Les tonneaux sont des conteneurs qui offrent 27 emplacements d'inventaire.
To access its inventory, rightclick it. When broken, the items will drop out.=Pour accéder à son inventaire, faites un clic droit dessus. Une fois cassés, les articles tomberont.
27 inventory slots=27 emplacements d'inventaire

View file

@ -0,0 +1,5 @@
# textdomain: mcl_barrels
Barrel=
Barrels are containers which provide 27 inventory slots.=
To access its inventory, rightclick it. When broken, the items will drop out.=
27 inventory slots=

View file

@ -0,0 +1,5 @@
# textdomain: mcl_barrels
Barrel=
Barrels are containers which provide 27 inventory slots.=
To access its inventory, rightclick it. When broken, the items will drop out.=
27 inventory slots=

View file

@ -0,0 +1,5 @@
# textdomain: mcl_barrels
Barrel=
Barrels are containers which provide 27 inventory slots.=
To access its inventory, rightclick it. When broken, the items will drop out.=
27 inventory slots=

View file

@ -0,0 +1,3 @@
name = mcl_barrels
depends = mcl_util, mcl_formspec, mcl_sounds
author = AFCMS

View file

Before

Width:  |  Height:  |  Size: 542 B

After

Width:  |  Height:  |  Size: 542 B

View file

Before

Width:  |  Height:  |  Size: 499 B

After

Width:  |  Height:  |  Size: 499 B

View file

Before

Width:  |  Height:  |  Size: 566 B

After

Width:  |  Height:  |  Size: 566 B

View file

Before

Width:  |  Height:  |  Size: 421 B

After

Width:  |  Height:  |  Size: 421 B

View file

@ -1419,5 +1419,3 @@ minetest.register_lbm({
minetest.get_meta(pos):set_string("formspec", "") minetest.get_meta(pos):set_string("formspec", "")
end, end,
}) })
dofile(minetest.get_modpath("mcl_chests").."/barrel.lua")

View file

@ -34,5 +34,3 @@ Can be combined to a large chest=Peut être combiné à un grand coffre
27 interdimensional inventory slots=27 emplacements d'inventaire interdimensionnels 27 interdimensional inventory slots=27 emplacements d'inventaire interdimensionnels
Put items inside, retrieve them from any ender chest=Mettez des objets à l'intérieur, récupérez-les dans n'importe quel coffre Put items inside, retrieve them from any ender chest=Mettez des objets à l'intérieur, récupérez-les dans n'importe quel coffre
Emits a redstone signal when opened=Émet un signal redstone à l'ouverture Emits a redstone signal when opened=Émet un signal redstone à l'ouverture
Barrel=Tonneau
Barrels are containers which provide 27 inventory slots.=Les tonneaux sont des conteneurs qui offrent 27 emplacements d'inventaire.

View file

@ -34,5 +34,3 @@ Can be combined to a large chest=
27 interdimensional inventory slots= 27 interdimensional inventory slots=
Put items inside, retrieve them from any ender chest= Put items inside, retrieve them from any ender chest=
Emits a redstone signal when opened= Emits a redstone signal when opened=
Barrel=
Barrels are containers which provide 27 inventory slots.=