From 46bffd82d38ded68bcf102efd25da06a96e64a5d Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Tue, 12 Sep 2017 00:20:52 -0600 Subject: standardize config settings --- util.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'util.lua') diff --git a/util.lua b/util.lua index e32c16b..3f1d732 100644 --- a/util.lua +++ b/util.lua @@ -52,21 +52,21 @@ digtron.mark_diggable = function(pos, nodes_dug) local in_known_group = false local material_cost = 0 - if digtron.creative_mode ~= true then + if digtron.config.uses_resources then if minetest.get_item_group(target.name, "cracky") ~= 0 then in_known_group = true - material_cost = math.max(material_cost, digtron.dig_cost_cracky) + material_cost = math.max(material_cost, digtron.config.dig_cost_cracky) end if minetest.get_item_group(target.name, "crumbly") ~= 0 then in_known_group = true - material_cost = math.max(material_cost, digtron.dig_cost_crumbly) + material_cost = math.max(material_cost, digtron.config.dig_cost_crumbly) end if minetest.get_item_group(target.name, "choppy") ~= 0 then in_known_group = true - material_cost = math.max(material_cost, digtron.dig_cost_choppy) + material_cost = math.max(material_cost, digtron.config.dig_cost_choppy) end if not in_known_group then - material_cost = digtron.dig_cost_default + material_cost = digtron.config.dig_cost_default end end -- cgit v1.2.3 From 04228904f52214d508831b8df28adcab28e88ae8 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Tue, 19 Sep 2017 23:25:11 -0600 Subject: reuse period/offset markers for intermittent diggers --- util.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'util.lua') diff --git a/util.lua b/util.lua index 3f1d732..63903b1 100644 --- a/util.lua +++ b/util.lua @@ -240,4 +240,34 @@ digtron.is_soft_material = function(target) return true end return false +end + +digtron.show_offset_markers = function(pos, offset, period) + local buildpos = digtron.find_new_pos(pos, minetest.get_node(pos).param2) + local x_pos = math.floor((buildpos.x+offset)/period)*period - offset + minetest.add_entity({x=x_pos, y=buildpos.y, z=buildpos.z}, "digtron:marker") + if x_pos >= buildpos.x then + minetest.add_entity({x=x_pos - period, y=buildpos.y, z=buildpos.z}, "digtron:marker") + end + if x_pos <= buildpos.x then + minetest.add_entity({x=x_pos + period, y=buildpos.y, z=buildpos.z}, "digtron:marker") + end + + local y_pos = math.floor((buildpos.y+offset)/period)*period - offset + minetest.add_entity({x=buildpos.x, y=y_pos, z=buildpos.z}, "digtron:marker_vertical") + if y_pos >= buildpos.y then + minetest.add_entity({x=buildpos.x, y=y_pos - period, z=buildpos.z}, "digtron:marker_vertical") + end + if y_pos <= buildpos.y then + minetest.add_entity({x=buildpos.x, y=y_pos + period, z=buildpos.z}, "digtron:marker_vertical") + end + + local z_pos = math.floor((buildpos.z+offset)/period)*period - offset + minetest.add_entity({x=buildpos.x, y=buildpos.y, z=z_pos}, "digtron:marker"):setyaw(1.5708) + if z_pos >= buildpos.z then + minetest.add_entity({x=buildpos.x, y=buildpos.y, z=z_pos - period}, "digtron:marker"):setyaw(1.5708) + end + if z_pos <= buildpos.z then + minetest.add_entity({x=buildpos.x, y=buildpos.y, z=z_pos + period}, "digtron:marker"):setyaw(1.5708) + end end \ No newline at end of file -- cgit v1.2.3