summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaceDeer <derksenmobile@gmail.com>2017-09-19 00:24:07 -0600
committerFaceDeer <derksenmobile@gmail.com>2017-09-19 00:24:07 -0600
commitd66cbc21642df96ca69f00624bd8d723313e416e (patch)
treea056a332ec24c4f8d4782180946f29d624102d82
parent576aeeade02104a41ccb60d4dda91f8e364639a1 (diff)
add builder read substitutions dictionary
-rw-r--r--init.lua16
-rw-r--r--nodes/node_builders.lua3
2 files changed, 18 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index 5ca91a1..d4d7832 100644
--- a/init.lua
+++ b/init.lua
@@ -4,6 +4,22 @@ digtron.auto_controller_colorize = "#88000030"
digtron.pusher_controller_colorize = "#00880030"
digtron.soft_digger_colorize = "#88880030"
+-- A global dictionary is used here so that other substitutions can be added easily by other mods, if necessary
+digtron.builder_read_item_substitutions = {
+ ["default:torch_ceiling"] = "default:torch",
+ ["default:torch_wall"] = "default:torch",
+ ["default:dirt_with_grass"] = "default:dirt",
+ ["default:dirt_with_grass_footsteps"] = "default:dirt",
+ ["default:dirt_with_dry_grass"] = "default:dirt",
+ ["default:dirt_with_rainforest_litter"] = "default:dirt",
+ ["default:dirt_with_snow"] = "default:dirt",
+ ["default:furnace_active"] = "default:furnace",
+ ["farming:soil"] = "default:dirt",
+ ["farming:soil_wet"] = "default:dirt",
+ ["farming:desert_sand_soil"] = "default:desert_sand",
+ ["farming:desert_sand_soil_wet"] = "default:desert_sand",
+}
+
dofile( minetest.get_modpath( "digtron" ) .. "/config.lua" )
dofile( minetest.get_modpath( "digtron" ) .. "/util.lua" )
dofile( minetest.get_modpath( "digtron" ) .. "/doc.lua" )
diff --git a/nodes/node_builders.lua b/nodes/node_builders.lua
index 53edaa5..683ecde 100644
--- a/nodes/node_builders.lua
+++ b/nodes/node_builders.lua
@@ -175,7 +175,8 @@ minetest.register_node("digtron:builder", {
if target_node.name ~= "air" and minetest.get_item_group(target_node.name, "digtron") == 0 then
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
- inv:set_stack("main", 1, target_node.name)
+ local target_name = digtron.builder_read_item_substitutions[target_node.name] or target_node.name
+ inv:set_stack("main", 1, target_name)
meta:set_int("build_facing", target_node.param2)
end
end