From f806ed9eee8c13eb0b4868641311d25257c63f46 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Tue, 20 Dec 2016 14:17:39 +0100 Subject: Turning mod into a modpack and separating the trains from the core mod --- advtrains/debugitems.lua | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 advtrains/debugitems.lua (limited to 'advtrains/debugitems.lua') diff --git a/advtrains/debugitems.lua b/advtrains/debugitems.lua new file mode 100644 index 0000000..b3164ff --- /dev/null +++ b/advtrains/debugitems.lua @@ -0,0 +1,36 @@ +minetest.register_tool("advtrains:tunnelborer", +{ + description = "tunnelborer", + groups = {cracky=1}, -- key=name, value=rating; rating=1..3. + inventory_image = "drwho_screwdriver.png", + wield_image = "drwho_screwdriver.png", + stack_max = 1, + range = 7.0, + + on_place = function(itemstack, placer, pointed_thing) + + end, + --[[ + ^ Shall place item and return the leftover itemstack + ^ default: minetest.item_place ]] + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type=="node" then + for x=-1,1 do + for y=-1,1 do + for z=-1,1 do + minetest.remove_node(vector.add(pointed_thing.under, {x=x, y=y, z=z})) + end + end + end + end + end, +--[[ +^ default: nil +^ Function must return either nil if no item shall be removed from +inventory, or an itemstack to replace the original itemstack. +e.g. itemstack:take_item(); return itemstack +^ Otherwise, the function is free to do what it wants. +^ The default functions handle regular use cases. +]] +} +) -- cgit v1.2.3