From 63e25b4e099a53cc1e0f88c1f154af78e2548331 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Mar 2017 04:21:23 +0200 Subject: [PATCH] Automatically add door group to doors and trapdoors --- mods/ITEMS/mcl_doors/init.lua | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/mods/ITEMS/mcl_doors/init.lua b/mods/ITEMS/mcl_doors/init.lua index 41cbfbae..f90507a7 100644 --- a/mods/ITEMS/mcl_doors/init.lua +++ b/mods/ITEMS/mcl_doors/init.lua @@ -22,6 +22,7 @@ mcl_doors = {} function mcl_doors:register_door(name, def) def.groups.not_in_creative_inventory = 1 def.groups.dig_by_piston = 1 + def.groups.door = 1 if not def.sound_open then def.sound_open = "doors_door_open" @@ -388,7 +389,7 @@ mcl_doors:register_door("mcl_doors:wooden_door", { _doc_items_longdesc = wood_longdesc, _doc_items_usagehelp = wood_usagehelp, inventory_image = "door_wood.png", - groups = {handy=1,axey=1, door=1, material_wood=1}, + groups = {handy=1,axey=1, material_wood=1}, _mcl_hardness = 3, tiles_bottom = {"door_wood_b.png", "door_wood_b.png"}, tiles_top = {"door_wood_a.png", "door_wood_a.png"}, @@ -410,7 +411,7 @@ mcl_doors:register_door("mcl_doors:acacia_door", { _doc_items_longdesc = wood_longdesc, _doc_items_usagehelp = wood_usagehelp, inventory_image = "door_acacia.png", - groups = {handy=1,axey=1, door=1, material_wood=1}, + groups = {handy=1,axey=1, material_wood=1}, _mcl_hardness = 3, tiles_bottom = {"door_acacia_b.png", "door_acacia_b.png"}, tiles_top = {"door_acacia_a.png", "door_acacia_a.png"}, @@ -432,7 +433,7 @@ mcl_doors:register_door("mcl_doors:birch_door", { _doc_items_longdesc = wood_longdesc, _doc_items_usagehelp = wood_usagehelp, inventory_image = "door_birch.png", - groups = {handy=1,axey=1, door=1, material_wood=1}, + groups = {handy=1,axey=1, material_wood=1}, _mcl_hardness = 3, tiles_bottom = {"door_birch_b.png", "door_birch_b.png"}, tiles_top = {"door_birch_a.png", "door_birch_a.png"}, @@ -454,7 +455,7 @@ mcl_doors:register_door("mcl_doors:dark_oak_door", { _doc_items_longdesc = wood_longdesc, _doc_items_usagehelp = wood_usagehelp, inventory_image = "door_dark_oak.png", - groups = {handy=1,axey=1, door=1, material_wood=1}, + groups = {handy=1,axey=1, material_wood=1}, _mcl_hardness = 3, tiles_bottom = {"door_dark_oak_b.png", "door_dark_oak_b.png"}, tiles_top = {"door_dark_oak_a.png", "door_dark_oak_a.png"}, @@ -476,7 +477,7 @@ mcl_doors:register_door("mcl_doors:jungle_door", { _doc_items_longdesc = wood_longdesc, _doc_items_usagehelp = wood_usagehelp, inventory_image = "door_jungle.png", - groups = {handy=1,axey=1, door=1, material_wood=1}, + groups = {handy=1,axey=1, material_wood=1}, _mcl_hardness = 3, tiles_bottom = {"door_jungle_b.png", "door_jungle_b.png"}, tiles_top = {"door_jungle_a.png", "door_jungle_a.png"}, @@ -498,7 +499,7 @@ mcl_doors:register_door("mcl_doors:spruce_door", { _doc_items_longdesc = wood_longdesc, _doc_items_usagehelp = wood_usagehelp, inventory_image = "door_spruce.png", - groups = {handy=1,axey=1, door=1, material_wood=1}, + groups = {handy=1,axey=1, material_wood=1}, _mcl_hardness = 3, tiles_bottom = {"door_spruce_b.png", "door_spruce_b.png"}, tiles_top = {"door_spruce_a.png", "door_spruce_a.png"}, @@ -551,7 +552,7 @@ mcl_doors:register_door("mcl_doors:iron_door", { _doc_items_longdesc = "Iron doors are 2-block high barriers which can only be opened or closed by a redstone signal, but not by hand.", _doc_items_usagehelp = "To open or close an iron door, supply its lower half with a redstone signal.", inventory_image = "door_steel.png", - groups = {pickaxey=1, door=1,mesecon_effector_on=1}, + groups = {pickaxey=1, mesecon_effector_on=1}, _mcl_hardness = 5, tiles_bottom = {"door_steel_b.png^[transformFX", "door_steel_b.png^[transformFX"}, tiles_top = {"door_steel_a.png^[transformFX", "door_steel_a.png^[transformFX"}, @@ -578,6 +579,11 @@ function mcl_doors:register_trapdoor(name, def) minetest.set_node(pos, node) end + if def.groups == nil then + def.groups = {} + end + def.groups.door = 2 + if not def.sound_open then def.sound_open = "doors_door_open" end @@ -696,7 +702,7 @@ mcl_doors:register_trapdoor("mcl_doors:trapdoor", { _doc_items_usagehelp = "To open or close the trapdoor, rightclick it or send a redstone signal to it.", tiles = {"door_trapdoor.png"}, wield_image = "door_trapdoor.png", - groups = {handy=1,axey=1, mesecon_effector_on=1,door=2, material_wood=1}, + groups = {handy=1,axey=1, mesecon_effector_on=1, material_wood=1}, _mcl_hardness = 3, sounds = mcl_sounds.node_sound_wood_defaults(), }) @@ -720,7 +726,7 @@ mcl_doors:register_trapdoor("mcl_doors:iron_trapdoor", { _doc_items_longdesc = "Iron trapdoors are floor covers which can only be opened and closed by redstone signals, but not by hand.", tiles = {"iron_trapdoor.png"}, wield_image = "iron_trapdoor.png", - groups = {pickaxey=1, mesecon_effector_on=1,door=2}, + groups = {pickaxey=1, mesecon_effector_on=1}, _mcl_hardness = 5, sounds = mcl_sounds.node_sound_metal_defaults(), sound_open = "doors_steel_door_open",