Skip to content

Instantly share code, notes, and snippets.

@Twipped
Created May 27, 2024 17:35
Show Gist options
  • Save Twipped/77bf1bcdaa74a9bad404f937e0f40cf0 to your computer and use it in GitHub Desktop.
Save Twipped/77bf1bcdaa74a9bad404f937e0f40cf0 to your computer and use it in GitHub Desktop.
Stationeers Power Controller IC10 Script
define DISPLAY -815193061 # small LED display
define ANALYZER 1036015121 # cable analyzer
define BATTERYSMALL -400115994
define BATTERYLARGE -1388288459
define MEMORY -851746783
alias dispInput d0
alias dispOutput d1
alias dispStorePerc d2
alias dispOverPerc d3
alias ocLight d4
alias totalInput r5
alias totalOutput r6
alias totalUseStored r7
alias totalUseMax r8
alias totalOverStored r9
alias totalOverMax r10
alias overcharged r11
start:
yield
# Load all our values
lbn totalInput ANALYZER HASH("Power Input") PowerPotential 1
lbn totalOutput ANALYZER HASH("Power Output") PowerActual 1
lb totalUseStored BATTERYSMALL Charge 1
lb totalUseMax BATTERYSMALL Maximum 1
lb totalOverStored BATTERYLARGE Charge 1
lb totalOverMax BATTERYLARGE Maximum 1
s db Setting totalOverStored
# Set the power input display
s dispInput Setting totalInput
s dispInput Mode 2
# Set the power consumption display
s dispOutput Setting totalOutput
s dispOutput Mode 2
# Set the normal storage display
div r0 totalUseStored totalUseMax
s dispStorePerc Setting r0
s dispStorePerc Mode 1
# Set the overcharge percentage displau
div r1 totalOverStored totalOverMax
s dispOverPerc Setting r1
s dispOverPerc Mode 1
seq r2 r0 1 # base charge is 100%
sge r3 r1 0.5 # over charge is above 50%
and overcharged r2 r3 # we are in overcharge mode
# Set the memory we use for logic readers elsewhere
sbn MEMORY HASH("Overcharged") Setting overcharged
# Turn on the overcharge indicator
s ocLight On overcharged
j start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment