This commit is contained in:
Snorre Selmer 2023-04-01 16:50:55 +02:00
commit 992a3b38dc
5 changed files with 90 additions and 23 deletions

View File

@ -1,3 +1,8 @@
# Controls Sorters to sort items based on hash.
# Reads item-hashes from stack to decide if it
# should be split off or passed on.
# Connect one Sorter to each screw on the IC.
alias counter r0
move counter 0
@ -8,6 +13,7 @@ alias IsItem r4
define INPUTSLOT 0
# Replace hashes below with the ones you need.
push 1724793494 # Coal
push -983091249 # Cobalt
push -707307845 # Copper
@ -20,12 +26,15 @@ push -190236170 # Lead
#push -1516581844 # Uranium
start:
# Loops over screws to instruct attached Sorters,
# loops over all sorters every tick.
bdseal dr0 sort
add counter counter 1
bgt counter 5 reset
j start
sort:
# Compares Sorter input-slot with hash in stack
move sp counter
add sp sp 1
peek hash
@ -38,6 +47,7 @@ s dr0 Output IsItem
j ra
reset:
# Resets counter to 0 zero so we can loop over again
move counter 0
yield
j start

View File

@ -1,6 +1,4 @@
# automatic gas-canister filler.
# only works with player-made cans, starter-cans
# have different hashes that won't work
# Automatic gas-canister filler.
# !!! Remember to set volume pump to no more !!!
# !!! than 10l! I have mine at 2l for safety !!!

View File

@ -1,8 +1,23 @@
alias DiodeSlider d0 # Kit (Light) > Diode Slide
alias FirstBattery d1 # The battery closest to your base
alias SecondBattery d2 # Optional second battery type
alias CableAnalyzer d3 # Optional
alias LEDLight d4 # Kit (Light) > LED Light, required if you have Cable Analyzer
# Uses a Diode Slide to show battery-bank fill-level.
# You can add a Cable Analyzer between generators
# and batteries so an LED light can show if system
# is charging or discharging.
# Works best if your batteries are connected in
# series (battery output -> battery input).
# FirstBattery is the battery that faces your base.
# Kit (Light) > Diode Slide
alias DiodeSlider d0
# Battery closest to your base
alias FirstBattery d1
# Optional second battery type
alias SecondBattery d2
# Optional Cable Analyzer
alias CableAnalyzer d3
# Kit (Light) > LED Light,
# required if you have Cable Analyzer
alias LEDLight d4
alias FirstBattCharge r0
alias Type1Hash r1
@ -19,19 +34,30 @@ define GREEN 2
start:
yield
# Checks charge/discharge state if CA connected
bdseal CableAnalyzer systemstate
l Type1Hash FirstBattery PrefabHash
# Sums current and max capacity of batteries of the
# first type
lb Type1Max Type1Hash Maximum Sum
lb Type1Charge Type1Hash Charge Sum
# Gets charge-ratio of FirstBattery
l FirstBattCharge FirstBattery Ratio
# Gets charges from second type of batteries
bdseal SecondBattery t2getcharge
# Creates a ratio from all batteries
div Type1Charge Type1Charge Type1Max
# Displays total charge ratio of battery-bank
s DiodeSlider Setting Type1Charge
slt FirstBattCharge FirstBattCharge 0.99
# Turns on Diode Slide light if FirstBattery
# is less than full (danger low power storage)
slt FirstBattCharge FirstBattCharge 1
s DiodeSlider On FirstBattCharge
j start
t2getcharge:
# Sums current and max capacity of batteries of the
# second type (if present)
l Type2Hash SecondBattery PrefabHash
lb Type2Max Type2Hash Maximum Sum
lb Type2Charge Type2Hash Charge Sum
@ -40,16 +66,16 @@ add Type1Charge Type1Charge Type2Charge
j ra
systemstate:
# Checks if system is generating more or less power
# than it's consuming
s LEDLight On 1
l ChargeIn CableAnalyzer PowerPotential
l ChargeOut FirstBattery PowerActual
sub r9 ChargeIn ChargeOut
s db Setting r9
move r10 ra
bgtzal r9 charging
bgtz r9 charging
s LEDLight Color RED
j ra
charging:
s LEDLight Color GREEN
j r10
j ra

File diff suppressed because one or more lines are too long