towny/visualize.lua

40 lines
1003 B
Lua
Raw Normal View History

2019-01-12 15:49:44 +00:00
-- Visualize an area
local r1 = towny.regions.size + 1
2019-01-12 21:31:11 +00:00
local r2 = towny.regions.height + 1
2019-01-12 15:49:44 +00:00
local c_obj_props = {
hp = 1,
glow = 1,
physical = false,
pointable = true,
visual = "cube",
2019-01-12 21:31:11 +00:00
visual_size = {x = r1, y = r2},
2019-01-12 15:49:44 +00:00
textures = {"towny_visualize.png","towny_visualize.png","towny_visualize.png",
"towny_visualize.png","towny_visualize.png","towny_visualize.png"},
static_save = false,
use_texture_alpha = true,
}
minetest.register_entity("towny:region_visual", {
initial_properties = c_obj_props,
on_punch = function(self)
self.object:remove()
end,
timer0 = 0,
on_step = function (self,dt)
self.timer0 = self.timer0 + 1
if self.timer0 > 600 then
self.object:remove()
end
end
})
function towny.regions:visualize_radius(pos)
local e = minetest.add_entity(pos, "towny:region_visual")
end
function towny.regions:visualize_area(p1,p2)
2019-01-12 21:31:11 +00:00
local center = {x=p2.x + r1/2,y=p2.y + r2/2,z=p2.z + r1/2}
2019-01-12 15:49:44 +00:00
local e = minetest.add_entity(center, "towny:region_visual")
end