summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README3
-rw-r--r--init.lua90
-rw-r--r--textures/digistuff_adwaita_edit-undo.pngbin0 -> 1382 bytes
-rw-r--r--textures/digistuff_adwaita_emblem-default.pngbin0 -> 2062 bytes
-rw-r--r--textures/digistuff_adwaita_go-down.pngbin0 -> 1732 bytes
-rw-r--r--textures/digistuff_adwaita_go-next.pngbin0 -> 1701 bytes
-rw-r--r--textures/digistuff_adwaita_go-previous.pngbin0 -> 1671 bytes
-rw-r--r--textures/digistuff_adwaita_go-up.pngbin0 -> 1673 bytes
-rw-r--r--textures/digistuff_panel_back.pngbin0 -> 14208 bytes
-rw-r--r--textures/digistuff_panel_bg.pngbin0 -> 8169 bytes
-rw-r--r--textures/digistuff_panel_front.pngbin0 -> 9961 bytes
11 files changed, 92 insertions, 1 deletions
diff --git a/README b/README
index 4517e94..eacfbd3 100644
--- a/README
+++ b/README
@@ -4,7 +4,8 @@ Digilines Stuff
License:
Code - LGPL v3 or later (contains some code from mesecons and digilines)
-Textures - CC BY-SA 3.0 Generic (contains modified versions of textures from mesecons and digilines)
+Textures WITHOUT "adwaita" in the file name - CC BY-SA 3.0 Generic (contains modified versions of textures from mesecons and digilines)
+Textures WITH "adwaita" in the file name - These are icons by the GNOME Project, licensed under GNU LGPL v3 or CC BY-SA 3.0.
Depends:
diff --git a/init.lua b/init.lua
index 809df1e..d172ed5 100644
--- a/init.lua
+++ b/init.lua
@@ -1,5 +1,52 @@
digistuff = {}
+digistuff.update_panel_formspec = function (pos,dispstr)
+ local meta = minetest.get_meta(pos)
+ local fs = "size[10,8]"..
+ "background[0,0;0,0;digistuff_panel_bg.png;true]"..
+ "label[0,0;%s]"..
+ "image_button[2,4.5;1,1;digistuff_adwaita_go-up.png;up;]"..
+ "image_button[1,5;1,1;digistuff_adwaita_go-previous.png;left;]"..
+ "image_button[3,5;1,1;digistuff_adwaita_go-next.png;right;]"..
+ "image_button[2,5.5;1,1;digistuff_adwaita_go-down.png;down;]"..
+ "image_button[1,6.5;1,1;digistuff_adwaita_edit-undo.png;back;]"..
+ "image_button[3,6.5;1,1;digistuff_adwaita_emblem-default.png;enter;]"..
+ "field[6,5.75;2,1;channel;Channel;${channel}]"..
+ "button[8,5.5;1,1;savechan;Set]"
+ fs = fs:format(minetest.formspec_escape(dispstr))
+ meta:set_string("formspec",fs)
+end
+
+digistuff.panel_on_digiline_receive = function (pos, node, channel, msg)
+ local meta = minetest.get_meta(pos)
+ local setchan = meta:get_string("channel")
+ if channel ~= setchan then return end
+ if type(msg) ~= "string" then return end
+ digistuff.update_panel_formspec(pos,msg)
+end
+
+digistuff.panel_on_receive_fields = function(pos, formname, fields, sender)
+ local meta = minetest.get_meta(pos)
+ local setchan = meta:get_string("channel")
+ if fields.savechan then
+ meta:set_string("channel",fields.channel)
+ local helpmsg = "Channel has been set. Waiting for data..."
+ digistuff.update_panel_formspec(pos,helpmsg)
+ elseif fields.up then
+ digiline:receptor_send(pos, digiline.rules.default, setchan, "up")
+ elseif fields.down then
+ digiline:receptor_send(pos, digiline.rules.default, setchan, "down")
+ elseif fields.left then
+ digiline:receptor_send(pos, digiline.rules.default, setchan, "left")
+ elseif fields.right then
+ digiline:receptor_send(pos, digiline.rules.default, setchan, "right")
+ elseif fields.back then
+ digiline:receptor_send(pos, digiline.rules.default, setchan, "back")
+ elseif fields.enter then
+ digiline:receptor_send(pos, digiline.rules.default, setchan, "enter")
+ end
+end
+
digistuff.button_turnoff = function (pos)
local node = minetest.get_node(pos)
if node.name=="digistuff:button_on" then --has not been dug
@@ -233,6 +280,40 @@ minetest.register_abm({
end
})
+minetest.register_node("digistuff:panel", {
+ description = "Digilines Control Panel",
+ groups = {cracky=3},
+ on_construct = function(pos)
+ local helpmsg = "Please set a channel."
+ digistuff.update_panel_formspec(pos,helpmsg)
+ end,
+ drawtype = "nodebox",
+ tiles = {
+ "digistuff_panel_back.png",
+ "digistuff_panel_back.png",
+ "digistuff_panel_back.png",
+ "digistuff_panel_back.png",
+ "digistuff_panel_back.png",
+ "digistuff_panel_front.png"
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 }
+ }
+ },
+ on_receive_fields = digistuff.panel_on_receive_fields,
+ digiline =
+ {
+ receptor = {},
+ effector = {
+ action = digistuff.panel_on_digiline_receive
+ },
+ },
+})
+
minetest.register_craft({
output = "digistuff:detector",
recipe = {
@@ -241,3 +322,12 @@ minetest.register_craft({
{"digilines:wire_std_00000000"}
}
})
+
+minetest.register_craft({
+ output = "digistuff:panel",
+ recipe = {
+ {"","digistuff:button",""},
+ {"digistuff:button","digilines:lcd","digistuff:button"},
+ {"","digistuff:button",""}
+ }
+})
diff --git a/textures/digistuff_adwaita_edit-undo.png b/textures/digistuff_adwaita_edit-undo.png
new file mode 100644
index 0000000..ab01729
--- /dev/null
+++ b/textures/digistuff_adwaita_edit-undo.png
Binary files differ
diff --git a/textures/digistuff_adwaita_emblem-default.png b/textures/digistuff_adwaita_emblem-default.png
new file mode 100644
index 0000000..4caba38
--- /dev/null
+++ b/textures/digistuff_adwaita_emblem-default.png
Binary files differ
diff --git a/textures/digistuff_adwaita_go-down.png b/textures/digistuff_adwaita_go-down.png
new file mode 100644
index 0000000..53cedf0
--- /dev/null
+++ b/textures/digistuff_adwaita_go-down.png
Binary files differ
diff --git a/textures/digistuff_adwaita_go-next.png b/textures/digistuff_adwaita_go-next.png
new file mode 100644
index 0000000..3b7d049
--- /dev/null
+++ b/textures/digistuff_adwaita_go-next.png
Binary files differ
diff --git a/textures/digistuff_adwaita_go-previous.png b/textures/digistuff_adwaita_go-previous.png
new file mode 100644
index 0000000..0df44ef
--- /dev/null
+++ b/textures/digistuff_adwaita_go-previous.png
Binary files differ
diff --git a/textures/digistuff_adwaita_go-up.png b/textures/digistuff_adwaita_go-up.png
new file mode 100644
index 0000000..e13742a
--- /dev/null
+++ b/textures/digistuff_adwaita_go-up.png
Binary files differ
diff --git a/textures/digistuff_panel_back.png b/textures/digistuff_panel_back.png
new file mode 100644
index 0000000..b1a5344
--- /dev/null
+++ b/textures/digistuff_panel_back.png
Binary files differ
diff --git a/textures/digistuff_panel_bg.png b/textures/digistuff_panel_bg.png
new file mode 100644
index 0000000..d357b1b
--- /dev/null
+++ b/textures/digistuff_panel_bg.png
Binary files differ
diff --git a/textures/digistuff_panel_front.png b/textures/digistuff_panel_front.png
new file mode 100644
index 0000000..d3083fa
--- /dev/null
+++ b/textures/digistuff_panel_front.png
Binary files differ