diff options
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | init.lua | 90 | ||||
-rw-r--r-- | textures/digistuff_adwaita_edit-undo.png | bin | 0 -> 1382 bytes | |||
-rw-r--r-- | textures/digistuff_adwaita_emblem-default.png | bin | 0 -> 2062 bytes | |||
-rw-r--r-- | textures/digistuff_adwaita_go-down.png | bin | 0 -> 1732 bytes | |||
-rw-r--r-- | textures/digistuff_adwaita_go-next.png | bin | 0 -> 1701 bytes | |||
-rw-r--r-- | textures/digistuff_adwaita_go-previous.png | bin | 0 -> 1671 bytes | |||
-rw-r--r-- | textures/digistuff_adwaita_go-up.png | bin | 0 -> 1673 bytes | |||
-rw-r--r-- | textures/digistuff_panel_back.png | bin | 0 -> 14208 bytes | |||
-rw-r--r-- | textures/digistuff_panel_bg.png | bin | 0 -> 8169 bytes | |||
-rw-r--r-- | textures/digistuff_panel_front.png | bin | 0 -> 9961 bytes |
11 files changed, 92 insertions, 1 deletions
@@ -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: @@ -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 Binary files differnew file mode 100644 index 0000000..ab01729 --- /dev/null +++ b/textures/digistuff_adwaita_edit-undo.png diff --git a/textures/digistuff_adwaita_emblem-default.png b/textures/digistuff_adwaita_emblem-default.png Binary files differnew file mode 100644 index 0000000..4caba38 --- /dev/null +++ b/textures/digistuff_adwaita_emblem-default.png diff --git a/textures/digistuff_adwaita_go-down.png b/textures/digistuff_adwaita_go-down.png Binary files differnew file mode 100644 index 0000000..53cedf0 --- /dev/null +++ b/textures/digistuff_adwaita_go-down.png diff --git a/textures/digistuff_adwaita_go-next.png b/textures/digistuff_adwaita_go-next.png Binary files differnew file mode 100644 index 0000000..3b7d049 --- /dev/null +++ b/textures/digistuff_adwaita_go-next.png diff --git a/textures/digistuff_adwaita_go-previous.png b/textures/digistuff_adwaita_go-previous.png Binary files differnew file mode 100644 index 0000000..0df44ef --- /dev/null +++ b/textures/digistuff_adwaita_go-previous.png diff --git a/textures/digistuff_adwaita_go-up.png b/textures/digistuff_adwaita_go-up.png Binary files differnew file mode 100644 index 0000000..e13742a --- /dev/null +++ b/textures/digistuff_adwaita_go-up.png diff --git a/textures/digistuff_panel_back.png b/textures/digistuff_panel_back.png Binary files differnew file mode 100644 index 0000000..b1a5344 --- /dev/null +++ b/textures/digistuff_panel_back.png diff --git a/textures/digistuff_panel_bg.png b/textures/digistuff_panel_bg.png Binary files differnew file mode 100644 index 0000000..d357b1b --- /dev/null +++ b/textures/digistuff_panel_bg.png diff --git a/textures/digistuff_panel_front.png b/textures/digistuff_panel_front.png Binary files differnew file mode 100644 index 0000000..d3083fa --- /dev/null +++ b/textures/digistuff_panel_front.png |