Add visual markers for crated Digtron image

This commit is contained in:
FaceDeer 2017-01-17 00:56:54 -07:00
parent 9ddec013de
commit 960d4e4155
3 changed files with 51 additions and 6 deletions

@ -50,8 +50,10 @@ local loaded_formspec = "size[4,1.5]" ..
default.gui_bg_img ..
default.gui_slots ..
"field[0.3,0.5;4,0.5;title;Digtron Name;${title}]" ..
"button_exit[0.5,1.2;1,0.1;save;Save Title]" ..
"button_exit[0.5,1.2;1,0.1;save;Save\nTitle]" ..
"tooltip[save;Saves the title of this Digtron]" ..
"button_exit[1.5,1.2;1,0.1;show;Show\nNodes]" ..
"tooltip[save;Shows what nodes the packed Digtron will occupy if unpacked]" ..
"button_exit[2.5,1.2;1,0.1;unpack;Unpack]" ..
"tooltip[unpack;Attempts to unpack the Digtron on this location]"
@ -71,12 +73,13 @@ minetest.register_node("digtron:loaded_crate", {
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
if fields.unpack or fields.save then
if fields.unpack or fields.save or fields.show then
meta:set_string("title", fields.title)
meta:set_string("infotext", fields.title)
end
if not fields.unpack then
if not (fields.unpack or fields.show) then
return
end
@ -90,6 +93,16 @@ minetest.register_node("digtron:loaded_crate", {
return
end
for _, node_image in pairs(layout.all) do
if not vector.equals(pos, node_image.pos) then
minetest.add_entity(node_image.pos, "digtron:marker_crate")
end
end
if not fields.unpack then
return
end
local pos_diff = vector.subtract(pos, layout.controller)
layout.controller = pos
for _, node_image in pairs(layout.all) do

@ -50,6 +50,32 @@ minetest.register_entity("digtron:marker_vertical", {
end,
})
minetest.register_entity("digtron:marker_crate", {
initial_properties = {
visual = "cube",
visual_size = {x=1.05, y=1.05},
textures = {"digtron_crate.png", "digtron_crate.png", "digtron_crate.png", "digtron_crate.png", "digtron_crate.png", "digtron_crate.png"},
collisionbox = {-0.525, -0.525, -0.525, 0.525, 0.525, 0.525},
physical = false,
},
on_activate = function(self, staticdata)
minetest.after(5.0,
function(self)
self.object:remove()
end,
self)
end,
on_rightclick=function(self, clicker)
self.object:remove()
end,
on_punch = function(self, hitter)
self.object:remove()
end,
})
minetest.register_entity("digtron:builder_item", {
initial_properties = {

@ -2,11 +2,13 @@
-- Note that inventories are digtron group 2.
minetest.register_node("digtron:inventory",
{
description = "Digtron Inventory Hopper",
description = "Digtron Inventory Storage",
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 2, tubedevice = 1, tubedevice_receiver = 1},
drop = "digtron:inventory",
sounds = digtron.metal_sounds,
paramtype2= "facedir",
drawtype = "nodebox",
paramtype = "light",
is_ground_content = false,
tiles = {"digtron_plate.png^digtron_inventory.png"},
@ -61,11 +63,13 @@ minetest.register_node("digtron:inventory",
-- Note that fuel stores are digtron group 5.
minetest.register_node("digtron:fuelstore",
{
description = "Digtron Fuel Hopper",
description = "Digtron Fuel Storage",
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 5, tubedevice = 1, tubedevice_receiver = 1},
drop = "digtron:fuelstore",
sounds = digtron.metal_sounds,
paramtype2= "facedir",
drawtype = "nodebox",
paramtype = "light",
is_ground_content = false,
tiles = {"digtron_plate.png^digtron_fuelstore.png"},
@ -145,6 +149,8 @@ minetest.register_node("digtron:combined_storage",
drop = "digtron:combined_storage",
sounds = digtron.metal_sounds,
paramtype2= "facedir",
drawtype = "nodebox",
paramtype = "light",
is_ground_content = false,
tiles = {"digtron_plate.png^digtron_combined_storage.png"},