summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaceDeer <derksenmobile@gmail.com>2017-01-17 00:56:54 -0700
committerFaceDeer <derksenmobile@gmail.com>2017-01-17 00:56:54 -0700
commit960d4e4155c3156c029c5be14c0ac4dbf1e08b45 (patch)
tree10302799ef6f8d83f8977ec69edc0c24c37410b0
parent9ddec013de650dbfc87c6c960a1e27df820f2977 (diff)
Add visual markers for crated Digtron image
-rw-r--r--crate.lua21
-rw-r--r--entities.lua26
-rw-r--r--node_storage.lua10
3 files changed, 51 insertions, 6 deletions
diff --git a/crate.lua b/crate.lua
index ddcc594..f7577ff 100644
--- a/crate.lua
+++ b/crate.lua
@@ -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,18 +73,19 @@ 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
local layout_string = meta:get_string("crated_layout")
local layout = DigtronLayout.deserialize(layout_string)
-
+
if layout == nil then
meta:set_string("infotext", meta:get_string("title") .. "\nUnable to read layout from crate metadata, regrettably this Digtron may be corrupted or lost.")
minetest.sound_play("buzzer", {gain=0.5, pos=pos})
@@ -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
diff --git a/entities.lua b/entities.lua
index ae997af..fa109b7 100644
--- a/entities.lua
+++ b/entities.lua
@@ -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 = {
diff --git a/node_storage.lua b/node_storage.lua
index 86a3eff..add4555 100644
--- a/node_storage.lua
+++ b/node_storage.lua
@@ -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"},