From 8b92e5077f46b5d1e635f9a3a16fab12ad4ff811 Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Mon, 11 Nov 2019 14:48:36 +0100 Subject: [PATCH] initial code --- .luacheckrc | 14 ++++++++++++++ depends.txt | 1 + init.lua | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 .luacheckrc create mode 100644 depends.txt create mode 100644 init.lua diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..1093a4e --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,14 @@ + +read_globals = { + -- Stdlib + string = {fields = {"split"}}, + table = {fields = {"copy", "getn"}}, + + -- Minetest + "vector", "ItemStack", + "dump", + + -- deps + "default", + "minetest" +} diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..f6f5f21 --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +more_chests diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..b7f58c0 --- /dev/null +++ b/init.lua @@ -0,0 +1,51 @@ +minetest.register_node("big_wifi_chest:big_wifi_chest", { + description = "Big Wifi Chest", + tiles = {"wifi_top.png", "wifi_top.png", "wifi_side.png", + "wifi_side.png", "wifi_side.png", "wifi_front.png"}, + paramtype2 = "facedir", + groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", + "size[8,9]".. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "list[current_player;more_chests:wifi;0,0.3;8,4;]".. + "list[current_player;main;0,4.85;8,1;]" .. + "list[current_player;main;0,6.08;8,3;8]" .. + "listring[current_player;more_chests:wifi]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,4.85)) + + meta:set_string("infotext", "Big Wifi Chest") + end, + on_metadata_inventory_move = function(pos, _, _, _, _, _, player) + minetest.log("action", player:get_player_name().. + " moves stuff in wifi chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, _, _, _, player) + minetest.log("action", player:get_player_name().. + " moves stuff to wifi chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, _, _, _, player) + minetest.log("action", player:get_player_name().. + " takes stuff from wifi chest at "..minetest.pos_to_string(pos)) + end, +}) + +minetest.register_craft({ + output = 'more_chests:wifi', + recipe = { + {'default:wood','default:mese','default:wood'}, + {'default:wood','default:steel_ingot','default:wood'}, + {'default:wood','default:wood','default:wood'} + } +}) + +minetest.register_on_joinplayer(function(player) + local inv = player:get_inventory() + inv:set_size("more_chests:wifi", 8*4) +end)