summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author4Evergreen4 <eljohnson@frontier.com>2013-06-18 20:48:10 -0400
committer4Evergreen4 <eljohnson@frontier.com>2013-06-18 20:48:10 -0400
commitf3b307de3db1720924f6987e3e3aa291f4aa7891 (patch)
treefc038ea6d500979d3cbd4ca8c79cb91b5545f758
Initial commit
-rw-r--r--README.txt6
-rw-r--r--depends.txt1
-rw-r--r--init.lua81
-rw-r--r--sounds/trash.oggbin0 -> 24386 bytes
4 files changed, 88 insertions, 0 deletions
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..c7c8e30
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,6 @@
+This mod adds trash cans to minetest.
+
+License:
+
+This work is licensed under a Creative Commons Attribution 3.0 Unported License.
+More info at http://creativecommons.org/licenses/by/3.0/ \ No newline at end of file
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/init.lua b/init.lua
new file mode 100644
index 0000000..7fc0f13
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,81 @@
+minetest.register_node("trash_can:trash_can_wooden",{
+ groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
+ tiles = {"default_wood.png"},
+ description = "Wooden Trash Can",
+ drawtype="nodebox",
+ paramtype = "light",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.375000,-0.500000,0.312500,0.375000,0.500000,0.375000},
+ {0.312500,-0.500000,-0.375000,0.375000,0.500000,0.375000},
+ {-0.375000,-0.500000,-0.375000,0.375000,0.500000,-0.312500},
+ {-0.375000,-0.500000,-0.375000,-0.312500,0.500000,0.375000},
+ {-0.312500,-0.500000,-0.312500,0.312500,-0.437500,0.312500},
+ }
+ },
+ on_construct = function(pos)
+ local meta = minetest.env:get_meta(pos)
+ meta:set_string("formspec",
+ "size[8,9]"..
+ "button[0,0;2,1;empty;Empty Trash]"..
+ "list[current_name;main;3,1;2,3;]"..
+ "list[current_player;main;0,5;8,4;]")
+ meta:set_string("infotext", "Trash Can")
+ 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,
+ 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 trash can 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 trash can 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 trash can at "..minetest.pos_to_string(pos))
+ end,
+ on_receive_fields = function(pos, formname, fields, sender)
+ if fields.empty then
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ for i = 1, inv:get_size("main") do
+ inv:set_stack("main", i, nil)
+ end
+ minetest.sound_play("trash", {to_player=player_name, gain = 1.0})
+ end
+ end,
+})
+
+minetest.register_craft({
+ output = 'trash_can:trash_can_wooden',
+ recipe = {
+ {'group:wood', '', 'group:wood'},
+ {'group:wood', '', 'group:wood'},
+ {'group:wood', 'group:wood', 'group:wood'},
+ }
+})
+
+minetest.register_node("trash_can:trash_can_full",{
+ groups = {choppy=2},
+ tiles = {"default_wood.png"},
+ drawtype="nodebox",
+ paramtype = "light",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.375000,-0.500000,0.312500,0.375000,0.500000,0.375000}, --NodeBox 1
+ {0.312500,-0.500000,-0.375000,0.375000,0.500000,0.375000}, --NodeBox 2
+ {-0.375000,-0.500000,-0.375000,0.375000,0.500000,-0.312500}, --NodeBox 3
+ {-0.375000,-0.500000,-0.375000,-0.312500,0.500000,0.375000}, --NodeBox 4
+ {-0.312500,-0.500000,-0.312500,0.312500,0.375000,0.312500}, --NodeBox 5
+ }
+ }
+}) \ No newline at end of file
diff --git a/sounds/trash.ogg b/sounds/trash.ogg
new file mode 100644
index 0000000..410f35e
--- /dev/null
+++ b/sounds/trash.ogg
Binary files differ