diff options
author | FaceDeer <derksenmobile@gmail.com> | 2017-09-19 23:25:11 -0600 |
---|---|---|
committer | FaceDeer <derksenmobile@gmail.com> | 2017-09-19 23:25:11 -0600 |
commit | 04228904f52214d508831b8df28adcab28e88ae8 (patch) | |
tree | 2075b3cdd8de0bdf18ee8ad3e1dc389cbe34bef8 /util.lua | |
parent | 3bc0eb82fa4796c32b6800e5833953262f8e0b0c (diff) |
reuse period/offset markers for intermittent diggers
Diffstat (limited to 'util.lua')
-rw-r--r-- | util.lua | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -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 |