From cf42d92cc048b63564d304b53e09458d82666076 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 19 Oct 2018 16:19:08 +0200 Subject: [PATCH] Add debug setting to edit item spawners --- mods/tutorial/init.lua | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/mods/tutorial/init.lua b/mods/tutorial/init.lua index 63da5ad..de5e3e0 100644 --- a/mods/tutorial/init.lua +++ b/mods/tutorial/init.lua @@ -1,5 +1,11 @@ tutorial = {} +-- == DEBUG SETTINGS == +-- If true, item spawner nodes become visible and pointable. +local edit_item_spawners = minetest.settings:get_bool("tutorial_debug_edit_item_spawners") + +-- == END OF DEBUG SETTINGS == + -- intllib support local S if (minetest.get_modpath("intllib")) then @@ -1096,17 +1102,36 @@ minetest.register_node("tutorial:ruler", { groups = {creative_breakable=1, attached_node=1}, }) +local is_drawtype, is_pointable, is_diggable, is_air_equivalent, is_tiles +-- Make some changes to item spawner node if debug setting is active +if edit_item_spawners then + -- This makes the item spawner visible and clickable + is_drawtype = "glasslike" + is_pointable = true + is_diggable = true + is_air_equivalent = false + is_tiles = { "tutorial_item_spawner.png" } +else + -- Normal invisible non-pointable non-editable item spawner + is_drawtype = "airlike" + is_pointable = false + is_diggable = false + is_air_equivalent = true + is_tiles = nil +end + -- Item spawner minetest.register_node("tutorial:itemspawner", { description = S("item spawner"), - drawtype = "airlike", paramtype = "light", walkable = false, - -- Set to true if you want to edit - pointable = false, + -- See above + drawtype = is_drawtype, + pointable = is_pointable, + diggable = is_diggable, + air_equivalent = is_air_equivalent, + tiles = is_tiles, floodable = false, - air_equivalent = true, - diggable = false, inventory_image = "tutorial_item_spawner.png", wield_image = "tutorial_item_spawner.png", buildable_to = false,