Advertisement
SemlerPDX

Stationeers Basic Solar Array & Backup Generator Control Script

Jun 2nd, 2024 (edited)
130
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | Gaming | 0 0
  1. #Basic Solar Array & Backup Generator Control Script
  2. # by SemlerPDX Dec2022
  3.  
  4. define MinPowerRatio 0.25 #25% Battery Charge, adjust as desired
  5.  
  6. define StationBatteries -1388288459 #Large Station Batteries
  7. define CableAnalyzers 1036015121 #on power line from solar array to batteries
  8. define SolidGenerators 813146305 #Solid Fuel Generator(s)
  9.  
  10. #Signal Wire connection facing 0 (North, see offset note below)
  11. define SolarArray -1545574413 #Heavy Dual Solar Panels (basic dual == -539224550)
  12.  
  13. #Signal Wire connection facing 180 (South, see offset note below)
  14. define DaylightSensor 1076425094 #Sensor face pointed towards sky
  15.  
  16. #Offset value is relative to array & sensor orientations listed above, is NOT the ONLY way
  17. define RelativeOffset 90 #0, 90, 180, or 270 (see solar tracking guides)
  18.  
  19. define MorningV 165 #point at morning sun to get this Vertical value
  20. define MorningH 186 #point at morning sun to get this Horizontal value
  21.  
  22.  
  23. main:
  24. yield
  25.  
  26. #Engage generator if power low (during night only)
  27. lb r0 CableAnalyzers PowerActual Maximum
  28. slez r0 r0
  29. lb r1 Batteries Ratio Average
  30. sle r1 r1 MinPowerRatio
  31. and r0 r0 r1
  32. lb r1 SolidGenerators On Maximum
  33. breq r0 r1 2 #skip 2 lines if On state already matches r0
  34. sb SolidGenerators On r0
  35.  
  36. #Check time of day
  37. lb r0 DaylightSensor SolarIrradiance Maximum
  38. blt r0 1 resetAngles
  39.  
  40. #Follow Sun (during daytime only)
  41. lb r0 DaylightSensor Vertical Maximum
  42. lb r1 DaylightSensor Horizontal Maximum
  43. add r0 r0 RelativeOffset
  44. add r1 r1 RelativeOffset
  45. sb SolarArray Vertical r0
  46. sb SolarArray Horizontal r1
  47. j main
  48.  
  49. resetAngles:
  50. #Early return if already set
  51. lb r0 SolarArray Vertical Maximum
  52. beq r0 MorningV main
  53.  
  54. #Point array at morning sun
  55. sb SolarArray Vertical MorningV
  56. sb SolarArray Horizontal MorningH
  57. j main
Tags: #stationeers
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement