summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2024-09-18 18:51:43 -0500
committercheapie <no-email-for-you@example.com>2024-09-18 18:51:43 -0500
commit06ffda5514d7d65140f3a32a28397ef60478f2fc (patch)
tree6c97fbd9da9cc604af1254efe0a09ad75e7d3165
downloadadvtouchscreen-main.tar
advtouchscreen-main.tar.gz
advtouchscreen-main.tar.bz2
advtouchscreen-main.tar.xz
advtouchscreen-main.zip
Add initial contentHEADmain
-rw-r--r--.luacheckrc6
-rw-r--r--LICENSE22
-rw-r--r--README13
-rw-r--r--init.lua89
-rw-r--r--mod.conf5
-rw-r--r--textures/advtouchscreen_front.pngbin0 -> 634 bytes
-rw-r--r--textures/advtouchscreen_sides.pngbin0 -> 5863 bytes
7 files changed, 135 insertions, 0 deletions
diff --git a/.luacheckrc b/.luacheckrc
new file mode 100644
index 0000000..906e1b9
--- /dev/null
+++ b/.luacheckrc
@@ -0,0 +1,6 @@
+max_line_length = 160
+
+read_globals = {
+ "minetest",
+ "digilines",
+}
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..b3dbff0
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,22 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README b/README
new file mode 100644
index 0000000..553dc29
--- /dev/null
+++ b/README
@@ -0,0 +1,13 @@
+Digilines Advanced Touchscreen
+==============================
+
+This is the advanced touchscreen from digistuff. mt-mods removed it when they
+took over maintenance, so here it is again as a standalone mod.
+
+Once a channel is set, simply send a raw formspec to it to display it.
+Fields are sent back on the same channel when the form is interacted with.
+
+Use the "lock" element to control who can interact with the form:
+
+* lock[1] - Only users with access to the area can submit the form
+* lock[0] - Anyone can submit the form
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..850732b
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,89 @@
+minetest.register_node("advtouchscreen:advtouchscreen", {
+ description = "Advanced Digilines Touchscreen",
+ groups = {
+ cracky=3
+ },
+ on_construct = function(pos)
+ minetest.get_meta(pos):set_string("formspec","field[channel;Channel;]")
+ end,
+ drawtype = "nodebox",
+ tiles = {
+ "advtouchscreen_sides.png",
+ "advtouchscreen_sides.png",
+ "advtouchscreen_sides.png",
+ "advtouchscreen_sides.png",
+ "advtouchscreen_sides.png",
+ "advtouchscreen_front.png"
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 }
+ }
+ },
+ _digistuff_channelcopier_fieldname = "channel",
+ _digistuff_channelcopier_onset = function(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_int("init",1)
+ meta:set_string("formspec","")
+ end,
+ on_receive_fields = function(pos,_,fields,player)
+ local meta = minetest.get_meta(pos)
+ local name = player:get_player_name()
+ local protected = minetest.is_protected(pos,name) and not minetest.check_player_privs(name,"protection_bypass")
+ if meta:get_int("init") == 0 then
+ if fields.channel and fields.channel ~= "" then
+ if protected then
+ minetest.record_protection_violation(pos,name)
+ minetest.chat_send_player(name,"You don't have access to set the channel on this screen.")
+ return
+ end
+ meta:set_string("channel",fields.channel)
+ meta:set_int("init",1)
+ meta:set_string("formspec","")
+ end
+ else
+ local locked = meta:get_int("locked") > 0
+ if locked and protected and not fields.quit then
+ minetest.record_protection_violation(pos,name)
+ minetest.chat_send_player(name,"This screen is locked.")
+ return
+ end
+ fields.clicker = name
+ digilines.receptor_send(pos,digilines.rules.default,meta:get_string("channel"),fields)
+ end
+ end,
+ digiline = {
+ receptor = {},
+ effector = {
+ action = function(pos,_,channel,msg)
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("channel") ~= channel or type(msg) ~= "string" then return end
+ local lockcommands
+ local unlockcommands
+ --string.gsub() returns two values, the second one is how many times the replacement happened
+ msg,lockcommands = string.gsub(msg,"lock%[1]","")
+ msg,unlockcommands = string.gsub(msg,"lock%[0]","")
+ if lockcommands > 0 then
+ meta:set_int("locked",1)
+ elseif unlockcommands > 0 then
+ meta:set_int("locked",0)
+ end
+ meta:set_string("formspec",msg)
+ end,
+ },
+ },
+})
+
+minetest.register_alias_force("digistuff:advtouchscreen","advtouchscreen:advtouchscreen")
+
+minetest.register_craft({
+ output = "advtouchscreen:advtouchscreen",
+ type = "shapeless",
+ recipe = {
+ "digistuff:touchscreen",
+ "default:mese_crystal",
+ },
+})
diff --git a/mod.conf b/mod.conf
new file mode 100644
index 0000000..3b0e244
--- /dev/null
+++ b/mod.conf
@@ -0,0 +1,5 @@
+name = advtouchscreen
+title = Advanced Digilines Touchscreen
+description = Touchscreen that accepts raw formspecs over digilines (split from digistuff)
+depends = digilines
+optional_depends = digistuff
diff --git a/textures/advtouchscreen_front.png b/textures/advtouchscreen_front.png
new file mode 100644
index 0000000..5cea485
--- /dev/null
+++ b/textures/advtouchscreen_front.png
Binary files differ
diff --git a/textures/advtouchscreen_sides.png b/textures/advtouchscreen_sides.png
new file mode 100644
index 0000000..29101af
--- /dev/null
+++ b/textures/advtouchscreen_sides.png
Binary files differ