diff options
| author | Wuzzy <Wuzzy@disroot.org> | 2022-10-09 14:22:42 +0200 |
|---|---|---|
| committer | sfan5 <sfan5@live.de> | 2022-10-23 21:58:56 +0200 |
| commit | cb7b96fc90c4432938b0be4a98a3067e6a07b215 (patch) | |
| tree | 8c603d1b63beb7350536e105d524ff43c3277dc5 /games/devtest/mods/callbacks/init.lua | |
| parent | 68df0fb2ea0b0e6ba5ca27216d864e4843e8bdc4 (diff) | |
| download | minetest-cb7b96fc90c4432938b0be4a98a3067e6a07b215.tar.xz | |
DevTest: Move callback items to callbacks mod
Diffstat (limited to 'games/devtest/mods/callbacks/init.lua')
| -rw-r--r-- | games/devtest/mods/callbacks/init.lua | 53 |
1 files changed, 2 insertions, 51 deletions
diff --git a/games/devtest/mods/callbacks/init.lua b/games/devtest/mods/callbacks/init.lua index baaf9fbc7..c5b0984d5 100644 --- a/games/devtest/mods/callbacks/init.lua +++ b/games/devtest/mods/callbacks/init.lua @@ -1,51 +1,2 @@ -local function print_to_everything(msg) - minetest.log("action", msg) - minetest.chat_send_all(msg) -end - -minetest.register_node("callbacks:callback_node", { - description = "Callback Test Node (construct/destruct/timer)".."\n".. - "Tests callbacks: on_construct, after_place_node, on_destruct, after_destruct, after_dig_node, on_timer", - tiles = {"callbacks_callback_node.png"}, - groups = {dig_immediate=3}, - -- This was known to cause a bug in minetest.item_place_node() when used - -- via minetest.place_node(), causing a placer with no position - paramtype2 = "facedir", - drop = "", - - on_construct = function(pos) - print_to_everything("callbacks:callback_node:on_construct("..minetest.pos_to_string(pos)..")") - local meta = minetest.get_meta(pos) - meta:set_string("mine", "test") - local timer = minetest.get_node_timer(pos) - timer:start(4, 3) - end, - - after_place_node = function(pos, placer) - print_to_everything("callbacks:callback_node:after_place_node("..minetest.pos_to_string(pos)..")") - local meta = minetest.get_meta(pos) - if meta:get_string("mine") == "test" then - print_to_everything("correct metadata found") - else - print_to_everything("incorrect metadata found") - end - end, - - on_destruct = function(pos) - print_to_everything("callbacks:callback_node:on_destruct("..minetest.pos_to_string(pos)..")") - end, - - after_destruct = function(pos) - print_to_everything("callbacks:callback_node:after_destruct("..minetest.pos_to_string(pos)..")") - end, - - after_dig_node = function(pos, oldnode, oldmetadata, digger) - print_to_everything("callbacks:callback_node:after_dig_node("..minetest.pos_to_string(pos)..")") - end, - - on_timer = function(pos, elapsed) - print_to_everything("callbacks:callback_node:on_timer(): elapsed="..dump(elapsed)) - return true - end, -}) - +dofile(minetest.get_modpath("callbacks").."/items.lua") +dofile(minetest.get_modpath("callbacks").."/nodes.lua") |
