From 3caab20e486a31afaba8e08b2dbbafb8b84917e1 Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Thu, 18 Jun 2020 11:31:37 +0200 Subject: [PATCH] add digilines doc file and document switching station interface partially attends to #53 --- README.md | 1 + technic/doc/digilines.md | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 technic/doc/digilines.md diff --git a/README.md b/README.md index 0a40001..d398d0c 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ Ingame: * [Powered machines](./technic/doc/machines.md) * [Generators](./technic/doc/generators.md) * [Forceload anchor](./technic/doc/anchor.md) +* [Digilines](./technic/doc/digilines.md) Mod development: * [Api](./technic/doc/api.md) diff --git a/technic/doc/digilines.md b/technic/doc/digilines.md new file mode 100644 index 0000000..2c933f2 --- /dev/null +++ b/technic/doc/digilines.md @@ -0,0 +1,32 @@ + +# Technic digilines compatibility + +This document describes the interaction of +technic machines with the `digilines` mod (https://github.com/minetest-mods/digilines) + +## Switching station + +**NOTE**: make sure the channel is set accordingly, "switch" in this case + +Get power and lag stats: +```lua +if event.type == "program" then + -- start interrupt cycle + interrupt(1) +end + +if event.type == "interrupt" then + -- request stats + digiline_send("switch", "GET") +end + +if event.type == "digiline" and event.channel == "switch" then + --[[ + event.msg = { + demand = 0, -- demand in EU's + supply = 0, -- supply in EU's + lag = 0 -- generated lag in microseconds + } + --]] +end +```