Computers Integration - igentuman/NuclearCraft-Neoteric GitHub Wiki
This document outlines the integration between NuclearCraft-Neoteric and computer mods (ComputerCraft: Tweaked and OpenComputers 2), allowing you to monitor and control various NuclearCraft machines using computers.
ComputerCraft: Tweaked Integration
Available Peripherals
| Peripheral Type | Description |
|---|---|
nc_fission_reactor |
Solid Fission Reactor Controller |
nc_fusion_reactor_core |
Fusion Reactor Core |
nc_processor |
Any NuclearCraft Processor (Manufactory, Alloy Furnace, etc.) |
nc_turbine |
Steam Turbine Controller |
nc_kugelblitz |
Kugelblitz Controller |
nc_accelerator |
Linear and Ring Accelerator Controllers |
nc_target_chamber |
Target Chamber |
Fission Reactor Methods
-- Get basic information
reactor.isFormed() -- Returns true if the multiblock structure is valid
reactor.getName() -- Returns the name of the reactor
reactor.hasRecipe() -- Returns true if the reactor has fuel
-- Control methods
reactor.enableReactor() -- Enables the reactor
reactor.disableReactor() -- Disables the reactor
reactor.voidFuel() -- Voids the fuel in the reactor
reactor.setModerationLevel(level) -- Sets the moderation level (neutron flux)
-- Status methods
reactor.getDepletionProgress() -- Returns the depletion progress (0-100)
reactor.getMaxHeatCapacity() -- Returns the maximum heat capacity
reactor.getHeatStored() -- Returns the current heat level
reactor.getEnergyPerTick() -- Returns energy generation per tick
reactor.getEnergyStored() -- Returns stored energy
reactor.getHeatMultiplier() -- Returns the heat multiplier
reactor.getCooling() -- Returns cooling per tick
reactor.getHeat() -- Returns heat generation per tick
-- Component information
reactor.getModeratorsCount() -- Returns the number of moderators
reactor.getHeatSinksCount() -- Returns the number of heat sinks
reactor.getFuelCellsCount() -- Returns the number of fuel cells
reactor.getFuelInSlot() -- Returns information about the fuel
-- Steam mode
reactor.isSteamMode() -- Returns true if in steam mode
reactor.getSteamRate() -- Returns the steam generation rate
Fusion Reactor Methods
-- Get basic information
reactor.isFormed() -- Returns true if the multiblock structure is valid
reactor.getName() -- Returns the name of the reactor
reactor.hasRecipe() -- Returns true if the reactor has fuel
-- Control methods
reactor.enableReactor() -- Enables the reactor
reactor.disableReactor() -- Disables the reactor
reactor.voidFuel() -- Voids the fuel in the reactor
reactor.setRFAmplification(level) -- Sets the RF amplification ratio (1-100)
-- Status methods
reactor.getMaxHeatCapacity() -- Returns the maximum heat capacity
reactor.getHeatStored() -- Returns the current heat level
reactor.getEnergyPerTick() -- Returns energy generation per tick
reactor.getEnergyStored() -- Returns stored energy
reactor.getPlasmaStability() -- Returns the plasma stability percentage
Processor Methods
-- Get basic information
processor.getName() -- Returns the name of the processor
processor.hasRecipe() -- Returns true if the processor has a valid recipe
-- Status methods
processor.getRecipeProgress() -- Returns the current recipe progress (0-100)
processor.getSlotsCount() -- Returns the number of slots in the processor
-- Slot management
processor.getSlotContent(slotId) -- Returns the content of the specified slot
processor.getSlotMode(slotId, direction) -- Returns the mode of the slot in the specified direction
processor.toggleSlotMode(slotId, direction) -- Toggles the mode of the slot in the specified direction
processor.voidSlotContent(slotId) -- Voids the content of the specified slot
Turbine Methods
-- Get basic information
turbine.isFormed() -- Returns true if the multiblock structure is valid
turbine.getName() -- Returns the name of the turbine
turbine.hasRecipe() -- Returns true if the turbine has steam
-- Control methods
turbine.enableTurbine() -- Enables the turbine
turbine.disableTurbine() -- Disables the turbine
-- Status methods
turbine.getEnergyPerTick() -- Returns energy generation per tick
turbine.getEnergyStored() -- Returns stored energy
Kugelblitz Methods
-- Get basic information
kugelblitz.isFormed() -- Returns true if the multiblock structure is valid
kugelblitz.getName() -- Returns the name of the kugelblitz
kugelblitz.hasRecipe() -- Returns true if the kugelblitz has a recipe
-- Status methods
kugelblitz.getEnergyPerTick() -- Returns energy generation per tick
kugelblitz.getEnergyStored() -- Returns stored energy
kugelblitz.getRecipeProgress() -- Returns the recipe progress (0-100)
kugelblitz.getEvaporationRate() -- Returns the evaporation rate
kugelblitz.getFeedingRate() -- Returns the feeding rate
kugelblitz.getBlackholeMass() -- Returns the blackhole mass in kg
kugelblitz.getBlackholeStability() -- Returns the blackhole stability
kugelblitz.getQuantumFrequency() -- Returns the quantum frequency
kugelblitz.getFluxRegulators() -- Returns the number of flux regulators
kugelblitz.getTransformers() -- Returns the number of transformers
kugelblitz.getStabilizers() -- Returns the number of stabilizers
kugelblitz.getTransformationEnergyRate() -- Returns the transformation energy rate
-- Control methods
kugelblitz.setQuantumFrequency(frequency) -- Sets the quantum frequency (0-15)
kugelblitz.setTransformationEnergyRate(rate) -- Sets the transformation energy rate (0-100)
Accelerator Methods (Linear and Ring)
-- Get basic information
accelerator.isFormed() -- Returns true if the multiblock structure is valid
accelerator.getName() -- Returns the name of the accelerator
accelerator.hasParticle() -- Returns true if the accelerator has a particle
-- Status methods
accelerator.getEnergyStored() -- Returns stored energy
accelerator.getTemperature() -- Returns the current temperature
accelerator.getMaxTemperature() -- Returns the maximum temperature
accelerator.getHeatRate() -- Returns the heat generation rate
accelerator.isAcceleratorOn() -- Returns true if the accelerator is enabled
-- Complex data methods
accelerator.getHeatBufferInfo() -- Returns a table with heat_stored and heat_capacity
accelerator.getCoolingInfo() -- Returns a table with cooling_fluid and cooling rate
accelerator.getStats() -- Returns a table with accelerating_voltage, dipole_strength,
-- quadrupole_strength, and input_particle_min_energy
accelerator.getParticleInfo() -- Returns information about the current particle
-- Control methods
accelerator.setEnergyPercentage(percentage) -- Sets the energy percentage (0-100)
Target Chamber Methods
-- Get basic information
chamber.isFormed() -- Returns true if the multiblock structure is valid
chamber.getName() -- Returns the name of the target chamber
chamber.hasRecipe() -- Returns true if the chamber has a recipe
-- Status methods
chamber.getRecipeProgress() -- Returns the recipe progress (0-100)
chamber.getEnergyPerTick() -- Returns energy consumption per tick
chamber.getEnergyStored() -- Returns stored energy
chamber.getFuelInSlot() -- Returns information about the fuel
-- Control methods
chamber.enableReactor() -- Enables the target chamber
chamber.disableReactor() -- Disables the target chamber
chamber.voidFuel() -- Voids the fuel in the chamber
OpenComputers 2 Integration
NuclearCraft-Neoteric also provides integration with OpenComputers 2, offering the same functionality as the ComputerCraft peripherals but through the OC2 device API.
Available Devices
- Fusion Reactor Device
- Fission Reactor Device
- Processor Device
- Turbine Device
- Kugelblitz Device
- Linear Accelerator Device
- Ring Accelerator Device
- Target Chamber Device
The methods available for each device are identical to their ComputerCraft counterparts.
Example Usage
Monitoring a Fission Reactor
-- ComputerCraft example
local reactor = peripheral.wrap("nc_fission_reactor")
while true do
print("Reactor Status: " .. (reactor.isFormed() and "Formed" or "Not Formed"))
print("Heat: " .. reactor.getHeatStored() .. "/" .. reactor.getMaxHeatCapacity())
print("Energy: " .. reactor.getEnergyStored() .. " RF")
print("Energy/t: " .. reactor.getEnergyPerTick() .. " RF/t")
print("Fuel Depletion: " .. reactor.getDepletionProgress() .. "%")
if reactor.getHeatStored() > reactor.getMaxHeatCapacity() * 0.8 then
print("WARNING: Heat level critical!")
reactor.disableReactor()
end
sleep(5)
end
Automating a Processor
-- ComputerCraft example
local processor = peripheral.wrap("nc_processor")
-- Function to check if output slots are full
function checkOutputsFull()
local slotsCount = processor.getSlotsCount()
for i = 0, slotsCount - 1 do
local content = processor.getSlotContent(i)
-- Check if this is an output slot (mode 1) and it's full
if processor.getSlotMode(i, 1) == 1 and content and content[2] >= 64 then
return true
end
end
return false
end
while true do
if processor.hasRecipe() then
print("Processing: " .. processor.getRecipeProgress() .. "%")
else
print("No recipe")
end
-- If outputs are full, void them (or handle differently)
if checkOutputsFull() then
print("Outputs full, handling...")
-- You could void them or signal another system
end
sleep(5)
end
Controlling a Fusion Reactor
-- ComputerCraft example
local reactor = peripheral.wrap("nc_fusion_reactor_core")
-- Function to safely start the reactor
function startReactor()
print("Starting fusion reactor...")
reactor.enableReactor()
reactor.setRFAmplification(50) -- Set to 50% amplification for safety
print("Reactor started")
end
-- Function to monitor and control the reactor
function monitorReactor()
while true do
local stability = reactor.getPlasmaStability()
local heat = reactor.getHeatStored()
local maxHeat = reactor.getMaxHeatCapacity()
print("Plasma Stability: " .. stability .. "%")
print("Heat: " .. heat .. "/" .. maxHeat)
print("Energy Output: " .. reactor.getEnergyPerTick() .. " RF/t")
-- Safety controls
if stability < 50 then
print("WARNING: Low stability, reducing amplification")
reactor.setRFAmplification(25)
elseif heat > maxHeat * 0.9 then
print("WARNING: Heat critical, shutting down")
reactor.disableReactor()
sleep(30) -- Wait for cooldown
startReactor()
end
sleep(5)
end
end
-- Main program
if reactor.isFormed() then
startReactor()
monitorReactor()
else
print("Reactor multiblock not formed!")
end
Monitoring a Kugelblitz
-- ComputerCraft example
local kugelblitz = peripheral.wrap("nc_kugelblitz")
-- Function to monitor and adjust the kugelblitz
function monitorKugelblitz()
while true do
print("Kugelblitz Status: " .. (kugelblitz.isFormed() and "Formed" or "Not Formed"))
print("Recipe Progress: " .. kugelblitz.getRecipeProgress() .. "%")
print("Blackhole Mass: " .. kugelblitz.getBlackholeMass() .. " kg")
print("Stability: " .. kugelblitz.getBlackholeStability() .. "%")
print("Energy Output: " .. kugelblitz.getEnergyPerTick() .. " RF/t")
-- Adjust quantum frequency based on stability
local stability = kugelblitz.getBlackholeStability()
if stability < 50 then
local newFreq = math.min(15, kugelblitz.getQuantumFrequency() + 1)
print("Low stability, adjusting frequency to " .. newFreq)
kugelblitz.setQuantumFrequency(newFreq)
elseif stability > 90 then
-- If very stable, we can optimize for energy production
local currentRate = kugelblitz.getTransformationEnergyRate()
if currentRate < 95 then
print("High stability, increasing energy rate")
kugelblitz.setTransformationEnergyRate(currentRate + 5)
end
end
sleep(5)
end
end
-- Main program
if kugelblitz.isFormed() then
monitorKugelblitz()
else
print("Kugelblitz multiblock not formed!")
end
Controlling an Accelerator
-- ComputerCraft example
local accelerator = peripheral.wrap("nc_accelerator")
-- Function to monitor accelerator temperature and adjust cooling
function monitorAccelerator()
while true do
print("Accelerator Status: " .. (accelerator.isFormed() and "Formed" or "Not Formed"))
if accelerator.hasParticle() then
print("Particle detected!")
-- Get detailed information
local temp = accelerator.getTemperature()
local maxTemp = accelerator.getMaxTemperature()
local heatInfo = accelerator.getHeatBufferInfo()
local stats = accelerator.getStats()
local particle = accelerator.getParticleInfo()
print("Temperature: " .. temp .. "/" .. maxTemp)
print("Heat stored: " .. heatInfo.heat_stored .. "/" .. heatInfo.heat_capacity)
print("Accelerating voltage: " .. stats.accelerating_voltage)
print("Dipole strength: " .. stats.dipole_strength)
-- Temperature management
if temp > maxTemp * 0.8 then
print("WARNING: Temperature approaching critical levels!")
-- Reduce energy to cool down
accelerator.setEnergyPercentage(50)
elseif temp < maxTemp * 0.5 then
-- Safe temperature, can use more energy
accelerator.setEnergyPercentage(90)
end
else
print("No particle in accelerator")
end
sleep(5)
end
end
-- Main program
if accelerator.isFormed() then
monitorAccelerator()
else
print("Accelerator multiblock not formed!")
end