Difference between revisions of "Digiline HV reactor monitor"

From Pandorabox
Jump to navigation Jump to search
(Created page with " === Overview === Howto for a digiline controlled HV Reactor monitor === Lua Controller === <syntaxhighlight lang="Lua"> if event.type == "interrupt" then digiline_sen...")
 
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
=== Overview ===
 
=== Overview ===
  
Howto for a digiline controlled [[HV Reactor]] monitor
+
Howto for a [[Digiline]] controlled [[HV Reactor]] monitor.
 +
Polls a [[Node detector]] periodically and sets a green or red lightstone if the reactor is on or off.
  
 
=== Lua Controller ===
 
=== Lua Controller ===
Line 9: Line 10:
 
if event.type == "interrupt" then
 
if event.type == "interrupt" then
 
  digiline_send("sensor", "GET")
 
  digiline_send("sensor", "GET")
  interrupt(1)
+
  interrupt(5)
 
end
 
end
  
Line 16: Line 17:
 
end
 
end
  
if event.type == "digiline" then
+
if event.type == "digiline" and event.channel == "sensor" then
 
  if event.msg == "technic:hv_nuclear_reactor_core_active" then
 
  if event.msg == "technic:hv_nuclear_reactor_core_active" then
 
   port.a = false
 
   port.a = false
Line 28: Line 29:
  
 
=== Setup ===
 
=== Setup ===
 +
 +
The [[Node detector]] has a range of 3 blocks and listens on the channel "''sensor''"
  
 
<gallery>
 
<gallery>
Line 34: Line 37:
 
File:screenshot_20190920_190614.png
 
File:screenshot_20190920_190614.png
 
</gallery>
 
</gallery>
 +
 +
[[Category:Tutorial]]
 +
[[Category:Digiline]]
 +
[[Category:Lua controller]]

Latest revision as of 13:47, 19 April 2021

Overview

Howto for a Digiline controlled HV Reactor monitor. Polls a Node detector periodically and sets a green or red lightstone if the reactor is on or off.

Lua Controller

if event.type == "interrupt" then
 digiline_send("sensor", "GET")
 interrupt(5)
end

if event.type == "program" then
 interrupt(1)
end

if event.type == "digiline" and event.channel == "sensor" then
 if event.msg == "technic:hv_nuclear_reactor_core_active" then
  port.a = false
  port.c = true
 else
  port.a = true
  port.c = false
 end
end

Setup

The Node detector has a range of 3 blocks and listens on the channel "sensor"