mirror of
https://git.minetest.org/BuckarooBanzay/digibuilder.git
synced 2024-12-12 00:23:15 +01:00
marker display
This commit is contained in:
parent
684afd7e56
commit
4bae9f15d5
1
init.lua
1
init.lua
@ -8,6 +8,7 @@ local MP = minetest.get_modpath("digibuilder")
|
||||
|
||||
-- common functions
|
||||
dofile(MP.."/common.lua")
|
||||
dofile(MP.."/marker.lua")
|
||||
dofile(MP.."/formspec.lua")
|
||||
dofile(MP.."/digiline_rules.lua")
|
||||
dofile(MP.."/digiline_validate_pos.lua")
|
||||
|
45
marker.lua
Normal file
45
marker.lua
Normal file
@ -0,0 +1,45 @@
|
||||
|
||||
function digibuilder.show_marker(pos, radius)
|
||||
local entity = "digibuilder:marker"
|
||||
|
||||
minetest.add_entity({x=pos.x+radius, y=pos.y+radius, z=pos.z+radius}, entity)
|
||||
minetest.add_entity({x=pos.x-radius, y=pos.y+radius, z=pos.z+radius}, entity)
|
||||
minetest.add_entity({x=pos.x+radius, y=pos.y+radius, z=pos.z-radius}, entity)
|
||||
minetest.add_entity({x=pos.x-radius, y=pos.y+radius, z=pos.z-radius}, entity)
|
||||
minetest.add_entity({x=pos.x+radius, y=pos.y-radius, z=pos.z+radius}, entity)
|
||||
minetest.add_entity({x=pos.x-radius, y=pos.y-radius, z=pos.z+radius}, entity)
|
||||
minetest.add_entity({x=pos.x+radius, y=pos.y-radius, z=pos.z-radius}, entity)
|
||||
minetest.add_entity({x=pos.x-radius, y=pos.y-radius, z=pos.z-radius}, entity)
|
||||
end
|
||||
|
||||
local texture = "digibuilder_marker_green.png"
|
||||
|
||||
minetest.register_entity("digibuilder:marker", {
|
||||
initial_properties = {
|
||||
visual = "cube",
|
||||
visual_size = {x=1.05, y=1.05},
|
||||
static_save = false,
|
||||
textures = {
|
||||
texture,
|
||||
texture,
|
||||
texture,
|
||||
texture,
|
||||
texture,
|
||||
texture
|
||||
},
|
||||
collisionbox = {-0.525, -0.525, -0.525, 0.525, 0.525, 0.525},
|
||||
physical = false,
|
||||
},
|
||||
|
||||
on_activate = function(self)
|
||||
minetest.after(8.0, function() self.object:remove() end)
|
||||
end,
|
||||
|
||||
on_rightclick=function(self)
|
||||
self.object:remove()
|
||||
end,
|
||||
|
||||
on_punch = function(self)
|
||||
self.object:remove()
|
||||
end,
|
||||
})
|
4
node.lua
4
node.lua
@ -126,7 +126,7 @@ minetest.register_node("digibuilder:digibuilder", {
|
||||
return stack:get_count()
|
||||
end,
|
||||
|
||||
on_punch = function()--pos, node, puncher)
|
||||
--TODO show marker on punch
|
||||
on_punch = function(pos)
|
||||
digibuilder.show_marker(pos, digibuilder.max_radius)
|
||||
end
|
||||
})
|
||||
|
@ -9,7 +9,6 @@ State: **WIP**
|
||||
# TODO
|
||||
|
||||
* [ ] `after_place_node(pos, placer, itemstack, pointed_thing)` compat (digtron mod?)
|
||||
* [ ] area display on punch (like in the jumpdrive/protector mod)
|
||||
|
||||
further issues:
|
||||
* [ ] Storage of read schematics/buildings
|
||||
|
BIN
textures/digibuilder_marker_green.png
Normal file
BIN
textures/digibuilder_marker_green.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 163 B |
Loading…
Reference in New Issue
Block a user