aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-11-12 15:22:09 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-11-29 19:13:40 +0200
commitddaff2d653efb1bebe04b9d316fe1bde26671b82 (patch)
tree9925ae29968859e0ff6487c685eeab0296b2ed55
parent75a0ca6bd67aa9ca87668bc27d36399b5028c2b1 (diff)
downloadminetest-ddaff2d653efb1bebe04b9d316fe1bde26671b82.tar.gz
minetest-ddaff2d653efb1bebe04b9d316fe1bde26671b82.tar.bz2
minetest-ddaff2d653efb1bebe04b9d316fe1bde26671b82.zip
Scripting WIP
-rw-r--r--data/scripts/default.lua45
1 files changed, 45 insertions, 0 deletions
diff --git a/data/scripts/default.lua b/data/scripts/default.lua
index 46d9fbf6c..3ec6f8433 100644
--- a/data/scripts/default.lua
+++ b/data/scripts/default.lua
@@ -192,3 +192,48 @@ minetest.register_entity("TNT", TNT)
print("minetest.registered_entities:")
dump2(minetest.registered_entities)
+--[=[
+
+register_block(0, {
+ textures = "stone.png",
+ makefacetype = 0,
+ get_dig_duration = function(env, pos, digger)
+ -- Check stuff like digger.current_tool
+ return 1.5
+ end,
+ on_dig = function(env, pos, digger)
+ env:remove_node(pos)
+ digger.inventory.put("MaterialItem2 0");
+ end,
+})
+
+register_block(1, {
+ textures = {"grass.png","mud.png","mud_grass_side.png","mud_grass_side.png","mud_grass_side.png","mud_grass_side.png"},
+ makefacetype = 0,
+ get_dig_duration = function(env, pos, digger)
+ -- Check stuff like digger.current_tool
+ return 0.5
+ end,
+ on_dig = function(env, pos, digger)
+ env:remove_node(pos)
+ digger.inventory.put("MaterialItem2 1");
+ end,
+})
+
+-- Consider the "miscellaneous block namespace" to be 0xc00...0xfff = 3072...4095
+register_block(3072, {
+ textures = {"tnt_top.png","tnt_bottom.png","tnt_side.png","tnt_side.png","tnt_side.png","tnt_side.png"},
+ makefacetype = 0,
+ get_dig_duration = function(env, pos, digger)
+ -- Cannot be dug
+ return nil
+ end,
+ -- on_dig = function(env, pos, digger) end, -- Not implemented
+ on_hit = function(env, pos, hitter)
+ -- Replace with TNT object, which will explode after timer, follow gravity, blink and stuff
+ env:add_object("tnt", pos)
+ env:remove_node(pos)
+ end,
+})
+--]=]
+