From c7e4e15768b239829494c89a1001d8b83ec2242d Mon Sep 17 00:00:00 2001 From: anarquimico Date: Mon, 28 Nov 2022 21:37:59 -0300 Subject: [PATCH] Add files --- init.lua | 173 +++++++++++++++++++++++++++++++++++++ license.txt | 52 +++++++++++ locale/template.txt | 8 ++ locale/vessels.de.tr | 8 ++ locale/vessels.eo.tr | 8 ++ locale/vessels.es.tr | 8 ++ locale/vessels.fr.tr | 8 ++ locale/vessels.id.tr | 8 ++ locale/vessels.it.tr | 8 ++ locale/vessels.ja.tr | 8 ++ locale/vessels.jbo.tr | 8 ++ locale/vessels.ms.tr | 8 ++ locale/vessels.pl.tr | 8 ++ locale/vessels.pt_BR.tr | 8 ++ locale/vessels.ru.tr | 8 ++ locale/vessels.sk.tr | 8 ++ locale/vessels.sv.tr | 8 ++ locale/vessels.uk.tr | 8 ++ locale/vessels.zh_CN.tr | 8 ++ locale/vessels.zh_TW.tr | 8 ++ mod.conf | 2 + textures/vessels_shelf.png | Bin 0 -> 354 bytes 22 files changed, 371 insertions(+) create mode 100644 init.lua create mode 100644 license.txt create mode 100644 locale/template.txt create mode 100644 locale/vessels.de.tr create mode 100644 locale/vessels.eo.tr create mode 100644 locale/vessels.es.tr create mode 100644 locale/vessels.fr.tr create mode 100644 locale/vessels.id.tr create mode 100644 locale/vessels.it.tr create mode 100644 locale/vessels.ja.tr create mode 100644 locale/vessels.jbo.tr create mode 100644 locale/vessels.ms.tr create mode 100644 locale/vessels.pl.tr create mode 100644 locale/vessels.pt_BR.tr create mode 100644 locale/vessels.ru.tr create mode 100644 locale/vessels.sk.tr create mode 100644 locale/vessels.sv.tr create mode 100644 locale/vessels.uk.tr create mode 100644 locale/vessels.zh_CN.tr create mode 100644 locale/vessels.zh_TW.tr create mode 100644 mod.conf create mode 100644 textures/vessels_shelf.png diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..224b422 --- /dev/null +++ b/init.lua @@ -0,0 +1,173 @@ + +local S = minetest.get_translator("vessels") +local C = minetest.colorize +local F = minetest.formspec_escape + + +local function close_forms(pos) + local players = minetest.get_connected_players() + local formname = "mcl_vessels_shelf:vessels_shelf_"..pos.x.."_"..pos.y.."_"..pos.z + for p = 1, #players do + if vector.distance(players[p]:get_pos(), pos) <= 30 then + minetest.close_formspec(players[p]:get_player_name(), formname) + end + end +end + + +local function drop_item_stack(pos, stack) + if not stack or stack:is_empty() then return end + local drop_offset = vector.new(math.random() - 0.5, 0, math.random() - 0.5) + minetest.add_item(vector.add(pos, drop_offset), stack) +end + + +function drop_items_from_meta_container(listname) + return function(pos, oldnode, oldmetadata) + if oldmetadata and oldmetadata.inventory then + -- process in after_dig_node callback + local main = oldmetadata.inventory.main + if not main then return end + for _, stack in pairs(main) do + drop_item_stack(pos, stack) + end + else + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + for i = 1, inv:get_size( "main") do + drop_item_stack(pos, inv:get_stack( "main", i)) + end + meta:from_table() + end + end +end + + +local drop_content = drop_items_from_meta_container( "main") + +local function on_blast(pos) + local node = minetest.get_node(pos) + drop_content(pos, node) + minetest.remove_node(pos) +end + +local function protection_check_move(pos, from_list, from_index, to_list, to_index, count, player) + local name = player:get_player_name() + if minetest.is_protected(pos, name) then + minetest.record_protection_violation(pos, name) + return 0 + else + return count + end +end + +local function protection_check_put_take(pos, listname, index, stack, player) + local name = player:get_player_name() + if minetest.is_protected(pos, name) then + minetest.record_protection_violation(pos, name) + return 0 + elseif minetest.get_item_group(stack:get_name(), "brewitem") ~= 0 then + return stack:get_count() + else + return 0 + end +end + + +local function vessels_shelf_gui(pos, node, clicker) + local name = minetest.get_meta(pos):get_string("name") + + if name == "" then + name = S( "Vessels Shelf") + end + + local playername = clicker:get_player_name() + + minetest.show_formspec(playername, + "mcl_vessels_shelf:vessels_shelf_"..pos.x.."_"..pos.y.."_"..pos.z, + table.concat({ + "size[9,8.75]", + "label[0,0;"..F(C("#313131", name)).."]", + "list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]", + mcl_formspec.get_itemslot_bg(0, 0.5, 9, 3), + "label[0,4.0;"..F(C( "#313131", S( "Inventory"))).."]", + "list[current_player;main;0,4.5;9,3;9]", + mcl_formspec.get_itemslot_bg(0, 4.5, 9, 3), + "list[current_player;main;0,7.74;9,1;]", + mcl_formspec.get_itemslot_bg(0, 7.74, 9, 1), + "listring[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main]", + "listring[current_player;main]", + }) + ) +end + +local function close_forms(pos) + local players = minetest.get_connected_players() + local formname = "mcl_vessels_shelf:vessels_shelf_"..pos.x.."_"..pos.y.."_"..pos.z + for p = 1, #players do + if vector.distance(players[p]:get_pos(), pos) <= 30 then + minetest.close_formspec(players[p]:get_player_name(), formname) + end + end +end + + + +minetest.register_node( "mcl_vessels_shelf:vessels_shelf", { + description = S( "Vessels Shelf" ), + tiles = {"default_wood.png", "default_wood.png", "default_wood.png", + "default_wood.png", "default_wood.png", "vessels_shelf.png"}, + stack_max = 64, + paramtype2 = "facedir", + is_ground_content = false, + groups = { + handy=1, axey=1, deco_block=1, material_wood=1, + flammable=3, fire_encouragement=30, fire_flammability=20, container=1}, + drop = "mcl_vessels_shelf:vessels_shelf", + sound = wood_sound, + _mcl_blast_resistance = 1.5, + _mcl_hardness = 1.5, + _mcl_silk_touch_drop = true, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + inv:set_size( "main", 9*3) + end, + after_place_node = function(pos, placer, itemstack, pointed_thing) + minetest.get_meta(pos):set_string( "name", itemstack:get_meta():get_string( "name")) + end, + allow_metadata_inventory_move = protection_check_move, + allow_metadata_inventory_take = protection_check_put_take, + allow_metadata_inventory_put = protection_check_put_take, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log( "action", player:get_player_name().. + " moves stuff in vessels shelf at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log( "action", player:get_player_name().. + " moves stuff to vessels shelf at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log( "action", player:get_player_name().. + " takes stuff from vessels shelf at "..minetest.pos_to_string(pos)) + end, + after_dig_node = drop_content, + on_blast = on_blast, + on_rightclick = vessels_shelf_gui, + on_destruct = close_forms, +}) + +minetest.register_craft({ + output = "mcl_vessels_shelf:vessels_shelf", + recipe = { + { "group:wood", "group:wood", "group:wood" }, + { "mcl_potions:glass_bottle", "mcl_potions:glass_bottle", "mcl_potions:glass_bottle" }, + { "group:wood", "group:wood", "group:wood" }, + } +}) + +minetest.register_craft({ + type = "fuel", + recipe = "mcl_vessels_shelf:vessels_shelf", + burntime = 15, +}) diff --git a/license.txt b/license.txt new file mode 100644 index 0000000..de16a3b --- /dev/null +++ b/license.txt @@ -0,0 +1,52 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2012-2016 Vanessa Ezekowitz +Copyright (C) 2012-2016 celeron55, Perttu Ahola +Copyright (C) 2012-2016 Various Minetest developers and contributors + +This program is free software; you can redistribute it and/or modify it under the terms +of the GNU Lesser General Public License as published by the Free Software Foundation; +either version 2.1 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU Lesser General Public License for more details: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Vanessa Ezekowitz +Copyright (C) 2016 Thomas-S + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..e6e5f69 --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf= +Vessels Shelf (@1 items)= +Vessels Shelf= +Empty Glass Bottle= +Empty Drinking Glass= +Empty Heavy Steel Bottle= +Glass Fragments= diff --git a/locale/vessels.de.tr b/locale/vessels.de.tr new file mode 100644 index 0000000..162e359 --- /dev/null +++ b/locale/vessels.de.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=Leeres Gefäßregal +Vessels Shelf (@1 items)=Gefäßregal (@1 Gegenstände) +Vessels Shelf=Gefäßregal +Empty Glass Bottle=Leere Glasflasche +Empty Drinking Glass=Leeres Trinkglas +Empty Heavy Steel Bottle=Leere schwere Stahlflasche +Glass Fragments=Glasfragmente diff --git a/locale/vessels.eo.tr b/locale/vessels.eo.tr new file mode 100644 index 0000000..c4a84ce --- /dev/null +++ b/locale/vessels.eo.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=Malplena Vaza Plataĵo +Vessels Shelf (@1 items)=Vaza Plataĵo (@1 objektoj) +Vessels Shelf=Vaza Plataĵo +Empty Glass Bottle=Malplena Vitra Botelo +Empty Drinking Glass=Malplena Glaso +Empty Heavy Steel Bottle=Malplena Peza Ŝtala Botelo +Glass Fragments=Vitraj Eroj diff --git a/locale/vessels.es.tr b/locale/vessels.es.tr new file mode 100644 index 0000000..d6131d8 --- /dev/null +++ b/locale/vessels.es.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=Estante de vasijas vacío +Vessels Shelf (@1 items)=Estante de vasijas (@1 objetos) +Vessels Shelf=Estante de vasijas +Empty Glass Bottle=Botella de vidrio vacía +Empty Drinking Glass=Vaso para beber vacío +Empty Heavy Steel Bottle=Botella de acero vacía +Glass Fragments=Fragmentos de vidrio diff --git a/locale/vessels.fr.tr b/locale/vessels.fr.tr new file mode 100644 index 0000000..f099c19 --- /dev/null +++ b/locale/vessels.fr.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=Etagère à récipient vide +Vessels Shelf (@1 items)=Etagère à récipient (@1 articles) +Vessels Shelf=Etagère à récipient +Empty Glass Bottle=Bouteille de verre vide +Empty Drinking Glass=Verre vide +Empty Heavy Steel Bottle=Bouteille d'acier lourde vide +Glass Fragments=Fragments de verre diff --git a/locale/vessels.id.tr b/locale/vessels.id.tr new file mode 100644 index 0000000..f80fbc3 --- /dev/null +++ b/locale/vessels.id.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=Rak Bejana Kosong +Vessels Shelf (@1 items)=Rak Bejana (@1 barang) +Vessels Shelf=Rak Bejana +Empty Glass Bottle=Botol Kaca Kosong +Empty Drinking Glass=Gelas Minum Kosong +Empty Heavy Steel Bottle=Botol Baja Berat Kosong +Glass Fragments=Pecahan Kaca diff --git a/locale/vessels.it.tr b/locale/vessels.it.tr new file mode 100644 index 0000000..70ea575 --- /dev/null +++ b/locale/vessels.it.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=Scaffale per contenitori vuoto +Vessels Shelf (@1 items)=Scaffale per contenitori (@1 oggetti) +Vessels Shelf=Scaffale per contenitori +Empty Glass Bottle=Bottiglia di vetro vuota +Empty Drinking Glass=Bicchiere di vetro vuoto +Empty Heavy Steel Bottle=Bottigia di metallo pesante vuota +Glass Fragments=Frammenti di vetro diff --git a/locale/vessels.ja.tr b/locale/vessels.ja.tr new file mode 100644 index 0000000..451489a --- /dev/null +++ b/locale/vessels.ja.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=空の瓶の棚 +Vessels Shelf (@1 items)=瓶の棚(@1 本) +Vessels Shelf=瓶の棚 +Empty Glass Bottle=空のガラス瓶 +Empty Drinking Glass=空のガラスコップ +Empty Heavy Steel Bottle=空の重い鉄瓶 +Glass Fragments=ガラスの破片 diff --git a/locale/vessels.jbo.tr b/locale/vessels.jbo.tr new file mode 100644 index 0000000..6e1145e --- /dev/null +++ b/locale/vessels.jbo.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=.i ti kunti ke vasru kajna +Vessels Shelf (@1 items)=.i lo ti vasru kajna cu vasru lo @1 dacti +Vessels Shelf=lo vasru kajna +Empty Glass Bottle=lo blacybo'i be no da +Empty Drinking Glass=lo blacykabri be no da +Empty Heavy Steel Bottle=lo tilju ke gasta botpi be no da +Glass Fragments=lo derxi be lo blaci spisa diff --git a/locale/vessels.ms.tr b/locale/vessels.ms.tr new file mode 100644 index 0000000..da7a0f0 --- /dev/null +++ b/locale/vessels.ms.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=Rak Bekas Kaca Kosong +Vessels Shelf (@1 items)=Rak Bekas Kaca (@1 barang) +Vessels Shelf=Rak Bekas Kaca +Empty Glass Bottle=Botol Kaca Kosong +Empty Drinking Glass=Gelas Minuman Kosong +Empty Heavy Steel Bottle=Botol Keluli Berat Kosong +Glass Fragments=Serpihan Kaca diff --git a/locale/vessels.pl.tr b/locale/vessels.pl.tr new file mode 100644 index 0000000..5e91da9 --- /dev/null +++ b/locale/vessels.pl.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=Pusta półka na naczynia +Vessels Shelf (@1 items)=Półka na naczynia (@1 przedmiotów) +Vessels Shelf=Półka na naczynia +Empty Glass Bottle=Pusta szklana butelka +Empty Drinking Glass=Pusta butelka do picia +Empty Heavy Steel Bottle=Pusta stalowa butelka +Glass Fragments=Odłamki szkła diff --git a/locale/vessels.pt_BR.tr b/locale/vessels.pt_BR.tr new file mode 100644 index 0000000..c22cb06 --- /dev/null +++ b/locale/vessels.pt_BR.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=Prateleira de Vasos Vazia +Vessels Shelf (@1 items)=Prateleira de Vasos (@1 itens) +Vessels Shelf=Prateleira de Vasos +Empty Glass Bottle=Garrafa de Vidro Vazia +Empty Drinking Glass=Copo Vazio +Empty Heavy Steel Bottle=Garrafa de Aço Pesada Vazia +Glass Fragments=Cacos de Vidro diff --git a/locale/vessels.ru.tr b/locale/vessels.ru.tr new file mode 100644 index 0000000..196d842 --- /dev/null +++ b/locale/vessels.ru.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=Полка с Пустыми Сосудами +Vessels Shelf (@1 items)=Полка с Сосудами (@1 предметы) +Vessels Shelf=Полка с Сосудами +Empty Glass Bottle=Пустая Стеклянная Бутылка +Empty Drinking Glass=Пустой Стакан +Empty Heavy Steel Bottle=Пустая Стальная Бутылка +Glass Fragments=Стеклянные Осколки diff --git a/locale/vessels.sk.tr b/locale/vessels.sk.tr new file mode 100644 index 0000000..6ec640b --- /dev/null +++ b/locale/vessels.sk.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=Prázdna polica na fľašky +Vessels Shelf (@1 items)=Polica na fľašky (@1 položka/y) +Vessels Shelf=Polica na fľašky +Empty Glass Bottle=Prázdna sklenená fľaša +Empty Drinking Glass=Prázdny pohár na pitie +Empty Heavy Steel Bottle=Prázdna oceľová fľaša +Glass Fragments=Časti skla diff --git a/locale/vessels.sv.tr b/locale/vessels.sv.tr new file mode 100644 index 0000000..48e76e2 --- /dev/null +++ b/locale/vessels.sv.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=Tom kärlhylla +Vessels Shelf (@1 items)=Kärlhylla (@1 saker) +Vessels Shelf=Kärlhylla +Empty Glass Bottle=Tom glasflaska +Empty Drinking Glass=Tom drycksflaska +Empty Heavy Steel Bottle=Tom tungstålsflaska +Glass Fragments=Glasbitar diff --git a/locale/vessels.uk.tr b/locale/vessels.uk.tr new file mode 100644 index 0000000..5025835 --- /dev/null +++ b/locale/vessels.uk.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=Полиця з Пустим Посудом +Vessels Shelf (@1 items)=Полиця з Посудом (@1 предмета) +Vessels Shelf=Полиця з Посудом +Empty Glass Bottle=Порожня Скляна Пляшка +Empty Drinking Glass=Порожня Склянка +Empty Heavy Steel Bottle=Порожня Сталева Пляшка +Glass Fragments=Скляні Уламки diff --git a/locale/vessels.zh_CN.tr b/locale/vessels.zh_CN.tr new file mode 100644 index 0000000..e303e24 --- /dev/null +++ b/locale/vessels.zh_CN.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=空容器架 +Vessels Shelf (@1 items)=容器架(@1项) +Vessels Shelf=容器架 +Empty Glass Bottle=空玻璃瓶 +Empty Drinking Glass=空水杯 +Empty Heavy Steel Bottle=空重型钢瓶 +Glass Fragments=玻璃碎片 diff --git a/locale/vessels.zh_TW.tr b/locale/vessels.zh_TW.tr new file mode 100644 index 0000000..6aecb35 --- /dev/null +++ b/locale/vessels.zh_TW.tr @@ -0,0 +1,8 @@ +# textdomain: vessels +Empty Vessels Shelf=空容器架 +Vessels Shelf (@1 items)=容器架(@1項) +Vessels Shelf=容器架 +Empty Glass Bottle=空玻璃瓶 +Empty Drinking Glass=空水杯 +Empty Heavy Steel Bottle=空重型鋼瓶 +Glass Fragments=玻璃碎片 diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..d518e46 --- /dev/null +++ b/mod.conf @@ -0,0 +1,2 @@ +name = mcl_vessels_shelf +description = Port of MTG Vessel Shelf to MCL2 diff --git a/textures/vessels_shelf.png b/textures/vessels_shelf.png new file mode 100644 index 0000000000000000000000000000000000000000..87c69b28954009b8d719d477168a53fd91cde343 GIT binary patch literal 354 zcmV-o0iFJdP)advkbhYH?&!Om$f;UqURgvB+>{^q3-MBCadP1 z+#F25()H5Nw7VTJV{GHXa@$=T1hXynEHexD1+yRvcurvH-T(jq07*qoM6N<$f|F^B AV*mgE literal 0 HcmV?d00001