Skip to content

Commit

Permalink
add digilines doc file and document switching station interface
Browse files Browse the repository at this point in the history
partially attends to #53
  • Loading branch information
BuckarooBanzay committed Jun 18, 2020
1 parent b0e45d4 commit 3caab20
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
32 changes: 32 additions & 0 deletions technic/doc/digilines.md
Original file line number Diff line number Diff line change
@@ -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
```

0 comments on commit 3caab20

Please sign in to comment.