Add files

This commit is contained in:
anarquimico 2022-11-28 21:37:59 -03:00
parent 6a85537e12
commit c7e4e15768
22 changed files with 371 additions and 0 deletions

173
init.lua Normal file
View File

@ -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,
})

52
license.txt Normal file
View File

@ -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 <celeron55@gmail.com>
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/

8
locale/template.txt Normal file
View File

@ -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=

8
locale/vessels.de.tr Normal file
View File

@ -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

8
locale/vessels.eo.tr Normal file
View File

@ -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

8
locale/vessels.es.tr Normal file
View File

@ -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

8
locale/vessels.fr.tr Normal file
View File

@ -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

8
locale/vessels.id.tr Normal file
View File

@ -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

8
locale/vessels.it.tr Normal file
View File

@ -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

8
locale/vessels.ja.tr Normal file
View File

@ -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=ガラスの破片

8
locale/vessels.jbo.tr Normal file
View File

@ -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

8
locale/vessels.ms.tr Normal file
View File

@ -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

8
locale/vessels.pl.tr Normal file
View File

@ -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

8
locale/vessels.pt_BR.tr Normal file
View File

@ -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

8
locale/vessels.ru.tr Normal file
View File

@ -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=Стеклянные Осколки

8
locale/vessels.sk.tr Normal file
View File

@ -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

8
locale/vessels.sv.tr Normal file
View File

@ -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

8
locale/vessels.uk.tr Normal file
View File

@ -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=Скляні Уламки

8
locale/vessels.zh_CN.tr Normal file
View File

@ -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=玻璃碎片

8
locale/vessels.zh_TW.tr Normal file
View File

@ -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=玻璃碎片

2
mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = mcl_vessels_shelf
description = Port of MTG Vessel Shelf to MCL2

BIN
textures/vessels_shelf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B