towny/visualize.lua
2019-01-12 17:49:44 +02:00

40 lines
992 B
Lua

-- Visualize an area
local r1 = towny.regions.size + 1
local c_obj_props = {
hp = 1,
glow = 1,
physical = false,
pointable = true,
visual = "cube",
visual_size = {x = r1, y = r1},
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)
local r = towny.regions.size / 2
local center = {x=p2.x + r,y=p2.y + r,z=p2.z + r}
local e = minetest.add_entity(center, "towny:region_visual")
end