Files
stationeers/Lights/OccupancyBasedSimple.ic10
2025-10-13 11:25:05 -05:00

51 lines
1.3 KiB
Plaintext

# ===== Config =====
# seconds to hold lights on after activate
define HoldOnTime 10
# ===== Aliases =====
alias IsOccupied r0
alias ProximityDetected r1
alias wantLights r2
# ===== Hashes (sensors) =====
define HashOcc HASH("StructureOccupancySensor")
define HashProx HASH("StructureProximitySensor")
# ===== Hashes (lights) from Kit (Lights) page =====
define HashLightWallRegular -1860064656
define HashLightWallLong 797794350
define HashLightWallLongWide 555215790
define HashLightWallLongAngled 1847265835
define HashLightWallBattery -1306415132
define HashLightRound 1514476632
define HashLightRoundAngled 1592905386
define HashLightRoundSmall 1436121888
Start:
LoadVariables:
lb IsOccupied HashOcc Activate Average
lb ProximityDetected HashProx Activate Sum
# Set wantLights if IsOccupied > 0
sgtz wantLights IsOccupied
add wantLights wantLights ProximityDetected
SetLights:
# Batch write On to each light type
sb HashLightWallRegular On wantLights
sb HashLightWallLong On wantLights
sb HashLightWallLongWide On wantLights
sb HashLightWallLongAngled On wantLights
sb HashLightWallBattery On wantLights
sb HashLightRound On wantLights
sb HashLightRoundAngled On wantLights
sb HashLightRoundSmall On wantLights
beqz wantLights End
sleep HoldOnTime
End:
yield
j Start