add digilines doc file and document switching station interface

partially attends to #53
This commit is contained in:
BuckarooBanzay 2020-06-18 11:31:37 +02:00
parent b0e45d4012
commit 3caab20e48
2 changed files with 33 additions and 0 deletions

View File

@ -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)

32
technic/doc/digilines.md Normal file
View File

@ -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
```