Content deleted Content added
Hail12Pink (talk | contribs) m Reverted edits by Superhaihi (talk) to last revision by Hail12Pink Tag: Rollback |
Hail12Pink (talk | contribs) fixed my code |
||
Line 1: | Line 1: | ||
<br /> |
<br /> |
||
[[File:AutomaticReactor2.png|right |
[[File:AutomaticReactor2.png|right]] |
||
Automatic Reactor is a term used for [[Reactor|reactors]] which are regulated through mechanisms rather than the player. They are necessary for feasible multi-reactor power systems. |
Automatic Reactor is a term used for [[Reactor|reactors]] which are regulated through mechanisms rather than the player. They are necessary for feasible multi-reactor power systems. |
||
Line 10: | Line 10: | ||
Additionally, you can place a Mode 2 polysilicon and a button to eject uranium from the reactor. |
Additionally, you can place a Mode 2 polysilicon and a button to eject uranium from the reactor. |
||
To refill a reactor, you need to attach a microcontroller to the dispenser and the reactor using ports. The code will use port ID 1 to read the reactor's fuel status, and port ID 2 to control the dispenser. |
To refill a reactor, you need to attach a microcontroller to the dispenser and the reactor using ports. The code will use port ID 1 to read the reactor's fuel status, and port ID 2 to control the dispenser. |
||
<syntaxhighlight lang="lua" line="1"> |
|||
local reactor = GetPartFromPort(1, "Reactor") |
local reactor = GetPartFromPort(1, "Reactor") |
||
local dispenser = GetPartFromPort(2, "Dispenser") |
local dispenser = GetPartFromPort(2, "Dispenser") |
||
Line 18: | Line 20: | ||
for i = 1, #fuel do |
for i = 1, #fuel do |
||
if fuel[i] <= 0 then |
if fuel[i] <= 0 then |
||
dispenser: |
dispenser:Dispense() |
||
wait(1) |
wait(1) |
||
dispenser:Trigger() |
|||
end |
end |
||
end |
end |
||
end |
end |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
Note: Microcontrollers have to be powered to function. |
|||
[[Category:Tutorials]] |
[[Category:Tutorials]] |