From eb750bd15ff5810ba313b966c5ff7f94ae6e9554 Mon Sep 17 00:00:00 2001 From: Megaf Date: Wed, 11 Jun 2014 01:37:20 -0300 Subject: [PATCH] Changes to be committed: new file: cobble.lua new file: depends.txt new file: dropbox.lua new file: init.lua new file: secret.lua new file: shared.lua new file: textures/chests.0gb.us_dropbox_front.png new file: textures/chests.0gb.us_dropbox_right.png new file: textures/chests.0gb.us_secret_front.png new file: textures/chests.0gb.us_shared_front.png new file: textures/chests.0gb.us_wifi_front_animated.png new file: textures/chests.0gb.us_wifi_side.png new file: textures/chests.0gb.us_wifi_top.png new file: wifi.lua --- cobble.lua | 92 +++++++++++++++ depends.txt | 1 + dropbox.lua | 70 +++++++++++ init.lua | 6 + secret.lua | 107 +++++++++++++++++ shared.lua | 111 ++++++++++++++++++ textures/chests.0gb.us_dropbox_front.png | Bin 0 -> 943 bytes textures/chests.0gb.us_dropbox_right.png | Bin 0 -> 765 bytes textures/chests.0gb.us_secret_front.png | Bin 0 -> 940 bytes textures/chests.0gb.us_shared_front.png | Bin 0 -> 852 bytes .../chests.0gb.us_wifi_front_animated.png | Bin 0 -> 462 bytes textures/chests.0gb.us_wifi_side.png | Bin 0 -> 244 bytes textures/chests.0gb.us_wifi_top.png | Bin 0 -> 239 bytes wifi.lua | 46 ++++++++ 14 files changed, 433 insertions(+) create mode 100644 cobble.lua create mode 100644 depends.txt create mode 100644 dropbox.lua create mode 100644 init.lua create mode 100644 secret.lua create mode 100644 shared.lua create mode 100644 textures/chests.0gb.us_dropbox_front.png create mode 100644 textures/chests.0gb.us_dropbox_right.png create mode 100644 textures/chests.0gb.us_secret_front.png create mode 100644 textures/chests.0gb.us_shared_front.png create mode 100644 textures/chests.0gb.us_wifi_front_animated.png create mode 100644 textures/chests.0gb.us_wifi_side.png create mode 100644 textures/chests.0gb.us_wifi_top.png create mode 100644 wifi.lua diff --git a/cobble.lua b/cobble.lua new file mode 100644 index 0000000..baf1bcd --- /dev/null +++ b/cobble.lua @@ -0,0 +1,92 @@ +local function has_locked_chest_privilege(meta, player) + if player:get_player_name() ~= meta:get_string("owner") then + return false + end + return true +end + +minetest.register_node("more_chests:cobble", { + description = "Cobble Chest", + tiles = {"default_cobble.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + after_place_node = function(pos, placer) + local meta = minetest.env:get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") +--[[ meta:set_string("infotext", "Locked Chest (owned by ".. + meta:get_string("owner")..")")]] + end, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "size[8,9]".. + "list[current_name;main;0,0;8,4;]".. + "list[current_player;main;0,5;8,4;]") +-- meta:set_string("infotext", "Locked Chest") + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end, + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return count + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + 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 locked chest 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 locked chest 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 locked chest at "..minetest.pos_to_string(pos)) + end, +}) + +minetest.register_craft({ + output = 'more_chests:cobble', + recipe = { + {'default:wood','default:cobble','default:wood'}, + {'default:cobble','default:steel_ingot','default:cobble'}, + {'default:wood','default:cobble','default:wood'} + } +}) + diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +default diff --git a/dropbox.lua b/dropbox.lua new file mode 100644 index 0000000..f9f3c17 --- /dev/null +++ b/dropbox.lua @@ -0,0 +1,70 @@ +local function has_locked_chest_privilege(meta, player) + if player:get_player_name() ~= meta:get_string("owner") then + return false + end + return true +end + +minetest.register_node("more_chests:dropbox", { + description = "Dropbox", + tiles = {"default_chest_top.png", "default_chest_top.png", "chests.0gb.us_dropbox_right.png", + "default_chest_side.png", "default_chest_side.png", "chests.0gb.us_dropbox_front.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + after_place_node = function(pos, placer) + local meta = minetest.env:get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Dropbox (owned by ".. + meta:get_string("owner")..")") + end, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "size[8,9]".. + "list[current_name;main;0,0;8,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Chest") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a dropbox belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + 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 dropbox 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 dropbox 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 dropbox at "..minetest.pos_to_string(pos)) + end, +}) + +minetest.register_craft({ + output = 'more_chests:dropbox', + recipe = { + {'default:wood','','default:wood'}, + {'default:wood','default:steel_ingot','default:wood'}, + {'default:wood','default:wood','default:wood'} + } +}) + diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..338a4d6 --- /dev/null +++ b/init.lua @@ -0,0 +1,6 @@ +dofile(minetest.get_modpath("more_chests").."/cobble.lua") +dofile(minetest.get_modpath("more_chests").."/dropbox.lua") +dofile(minetest.get_modpath("more_chests").."/secret.lua") +dofile(minetest.get_modpath("more_chests").."/shared.lua") +dofile(minetest.get_modpath("more_chests").."/wifi.lua") + diff --git a/secret.lua b/secret.lua new file mode 100644 index 0000000..b7b00ed --- /dev/null +++ b/secret.lua @@ -0,0 +1,107 @@ +local function has_locked_chest_privilege(meta, player) + if player:get_player_name() ~= meta:get_string("owner") then + return false + end + return true +end + +local open = "size[8,10]".. + "list[current_name;main;0,0;8,4;]".. + "list[current_player;main;0,5;8,4;]".. + "button[3,9;2,1;open;close]" +local closed = "size[2,1]".. + "button[0,0;2,1;open;open]" + +minetest.register_node("more_chests:secret", { + description = "Secret Chest", + tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", + "default_chest_side.png", "default_chest_side.png", "chests.0gb.us_secret_front.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + after_place_node = function(pos, placer) + local meta = minetest.env:get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Secret Chest (owned by ".. + meta:get_string("owner")..")") + end, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", open) + meta:set_string("infotext", "Secret Chest") + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end, + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a secret chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return count + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a secret chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a secret chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + 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 secret chest 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 secret chest 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 secret chest at "..minetest.pos_to_string(pos)) + end, + on_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.env:get_meta(pos) + if has_locked_chest_privilege(meta, sender) then + if fields.open == "open" then + meta:set_string("formspec", open) + else + meta:set_string("formspec", closed) + end + end + end, +}) + +minetest.register_craft({ + output = 'more_chests:secret', + recipe = { + {'default:wood','default:cobble','default:wood'}, + {'default:wood','default:steel_ingot','default:wood'}, + {'default:wood','default:wood','default:wood'} + } +}) + diff --git a/shared.lua b/shared.lua new file mode 100644 index 0000000..7386332 --- /dev/null +++ b/shared.lua @@ -0,0 +1,111 @@ +local function has_locked_chest_privilege(meta, player) + local name = player:get_player_name() + local shared = " "..meta:get_string("shared").." " + if name == meta:get_string("owner") then + return true + elseif shared:find(" "..name.." ") then + + return true + else + return false + end +end + +local function formspec(string) + return "size[8,10]".. + "list[current_name;main;0,0;8,4;]".. + "list[current_player;main;0,5;8,4;]".. + "field[.25,9.5;6,1;shared;Shared with (separate names with spaces):;"..string.."]".. + "button[6,9;2,1;submit;submit]" +end + +minetest.register_node("chests_0gb_us:shared", { + description = "Shared Chest", + tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", + "default_chest_side.png", "default_chest_side.png", "chests.0gb.us_shared_front.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + after_place_node = function(pos, placer) + local meta = minetest.env:get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Shared Chest (owned by ".. + meta:get_string("owner")..")") + end, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", formspec("")) + meta:set_string("infotext", "Shared Chest") + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end, + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a shared chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return count + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a shared chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a shared chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + 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 shared chest 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 shared chest 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 shared chest at "..minetest.pos_to_string(pos)) + end, + on_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.env:get_meta(pos); + if meta:get_string("owner") == sender:get_player_name() then + meta:set_string("shared", fields.shared); + meta:set_string("formspec", formspec(fields.shared)) + end + end, +}) + +minetest.register_craft({ + output = 'chests_0gb_us:shared', + recipe = { + {'default:wood','default:leaves','default:wood'}, + {'default:wood','default:steel_ingot','default:wood'}, + {'default:wood','default:wood','default:wood'} + } +}) + diff --git a/textures/chests.0gb.us_dropbox_front.png b/textures/chests.0gb.us_dropbox_front.png new file mode 100644 index 0000000000000000000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MMORE;H1J_||V0rfO1ws_MnP%o9MuWtN(Mf{Q z^K(UkUY=kQ#q%3|rmxcTvHLqttN^PqeuH{27nKO3z6E-dp{Jb2{K>cB0j>j3D`uDXobWEqY{mef(W=M zlun2llx`j@>PY3{gNkztLllAth+vTUvy7Hfrgflpk(Hjs2O&h*KWbR+T9ksLna2lV zv19mize1S|_4jx0$j#krEU%AATP-GgcPOidP*yzg+&S*v_?78V$zc5$<>ZihHlwxB e2ZZGlC;1;Pk!zk#h}rT00000xotX literal 0 HcmV?d00001 diff --git a/textures/chests.0gb.us_wifi_front_animated.png b/textures/chests.0gb.us_wifi_front_animated.png new file mode 100644 index 0000000000000000000000000000000000000000..77bcb445e079bfeee19427bc467930578535a95e GIT binary patch literal 462 zcmV;<0WtoGP)N-6{J+j zP}kAn5!+I{qgO8Ha;B}t+gJY|KavH`j58lLsaU3>^)AYQ~gJqeab-yvd=c+u2WgP2&U*bevodkqijh6km3 z&-Djfx7r`lmN4%>V!Z07*qoM6N<$ Eg1gqr*Z=?k literal 0 HcmV?d00001 diff --git a/textures/chests.0gb.us_wifi_side.png b/textures/chests.0gb.us_wifi_side.png new file mode 100644 index 0000000000000000000000000000000000000000..f58fae953ab70fc10aa8eec832df4074db24e485 GIT binary patch literal 244 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE+c0ifI^L)E{-7tA5`PoA>45A_UxD28a|^b* ztyKJWFPO8dqsM;JSDP5|yeAX5r7}Fjblv~nW1atNb9rrC*v-{B;n$S?S

L^Sy8R hd1e~-JljC+_~wQl;OXk;vd$@?2>{96PNM(- literal 0 HcmV?d00001 diff --git a/textures/chests.0gb.us_wifi_top.png b/textures/chests.0gb.us_wifi_top.png new file mode 100644 index 0000000000000000000000000000000000000000..35c01d0f9d8deb6111caffde111a447368384271 GIT binary patch literal 239 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE7~I31rI22ERJzc;QoGJ z%X*8x?UO|pPI;eGVL7;Z>$ek*ca)UU!kCz6Y+!Ja?c!nJ%Tf e;bVyVPo`&u-k;dG8S;VdVDNPHb6Mw<&;$SmXj9Ap literal 0 HcmV?d00001 diff --git a/wifi.lua b/wifi.lua new file mode 100644 index 0000000..8ff25ee --- /dev/null +++ b/wifi.lua @@ -0,0 +1,46 @@ +minetest.register_node("more_chests:wifi", { + description = "Wifi Chest", + tiles = {"chests.0gb.us_wifi_top.png", "chests.0gb.us_wifi_top.png", "chests.0gb.us_wifi_side.png", + "chests.0gb.us_wifi_side.png", "chests.0gb.us_wifi_side.png", +{name="chests.0gb.us_wifi_front_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}} +}, + 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.env:get_meta(pos) + meta:set_string("formspec", + "size[8,9]".. + "list[current_player;more_chests:wifi;0,0;8,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Wifi Chest") + end, + 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 wifi chest 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 wifi chest 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 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) +