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 alias counter r0
move counter 0 move counter 0
@ -8,6 +13,7 @@ alias IsItem r4
define INPUTSLOT 0 define INPUTSLOT 0
# Replace hashes below with the ones you need.
push 1724793494 # Coal push 1724793494 # Coal
push -983091249 # Cobalt push -983091249 # Cobalt
push -707307845 # Copper push -707307845 # Copper
@ -20,12 +26,15 @@ push -190236170 # Lead
#push -1516581844 # Uranium #push -1516581844 # Uranium
start: start:
# Loops over screws to instruct attached Sorters,
# loops over all sorters every tick.
bdseal dr0 sort bdseal dr0 sort
add counter counter 1 add counter counter 1
bgt counter 5 reset bgt counter 5 reset
j start j start
sort: sort:
# Compares Sorter input-slot with hash in stack
move sp counter move sp counter
add sp sp 1 add sp sp 1
peek hash peek hash
@ -38,6 +47,7 @@ s dr0 Output IsItem
j ra j ra
reset: reset:
# Resets counter to 0 zero so we can loop over again
move counter 0 move counter 0
yield yield
j start j start

View File

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

View File

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

View File

@ -106,4 +106,4 @@ beqz FilterHash ra
#if you are still here then it is an error so end #if you are still here then it is an error so end
s filtration On 0 s filtration On 0
j start j start

File diff suppressed because one or more lines are too long