Implement scanner module

This commit is contained in:
Christopher Head 2020-11-24 22:38:20 -08:00
parent 8e2b2fa782
commit 8feede413f
No known key found for this signature in database
GPG Key ID: 211CEB0BE447577B
2 changed files with 37 additions and 0 deletions

26
scanner/README.md Normal file
View File

@ -0,0 +1,26 @@
Pipeworks Lua Tube Scanner
==========================
The scanner script serves as a polyfill for the modern Digiline Detecting
Pneumatic Tube Segment for use on servers running older versions of Pipeworks.
It should be a drop-in replacement, so if the server is upgraded, the Lua
Controlled Sorting Tube can be replaced with an actual Digiline Detecting
Pneumatic Tube Segment without affecting the rest of the system.
In the current version of Pipeworks, the Digiline Detecting Pneumatic Tube
Segment sends a Digiline message in table format with details of the itemstack
passing through the segment. In older versions of Pipeworks, however, the
segment instead sent a string representation of the itemstack. When playing on
server running an older version of Pipeworks, this scanner script installed on
a Lua Controlled Sorting Tube can fill in for the detecting tube, as it sends
the itemstack information in table format.
Configuration
-------------
The `output_direction` string is the colour of output direction where all items
should be sent.
The `channel` string is the Digiline channel to which item-passing messages
will be sent.

11
scanner/scanner.lua Normal file
View File

@ -0,0 +1,11 @@
-- Where passing items should be sent.
local output_direction = "yellow"
-- The channel to which item-passing messages should be sent, each of which is
-- an itemstack in table form.
local channel = "scanner:1"
if event.type == "item" then
digiline_send(channel, event.item)
return output_direction
end