Sensor

The type of structures returned by LIST SENSORS IN SOMEVARIABLE. This is not fully understood because the type of PartModule in the KSP API called ModuleEnviroSensor, which all Sensors are a kind of, is not well documented. Here is an example of using Sensor:

PRINT "Full Sensor Dump:".
LIST SENSORS IN SENSELIST.

// TURN EVERY SINGLE SENSOR ON
FOR S IN SENSELIST {
  PRINT "SENSOR: " + S:TYPE.
  PRINT "VALUE:  " + S:DISPLAY.
  IF S:ACTIVE {
    PRINT "     SENSOR IS ALREADY ON.".
  } ELSE {
    PRINT "     SENSOR WAS OFF.  TURNING IT ON.".
    S:TOGGLE().
  }
}
structure Sensor

Suffix

Type

Description

All suffixes of Part

Sensor objects are a type of Part

ACTIVE

Boolean

Check if this sensor is active

TYPE

DISPLAY

String

Value of the readout

POWERCONSUMPTION

Scalar

Rate of required electric charge

TOGGLE()

Call to activate/deactivate

Note

A Sensor is a type of Part, and therefore can use all the suffixes of Part.

Sensor:ACTIVE
Access

Get only

Type

Boolean

True of the sensor is enabled. Can SET to cause the sensor to activate or de-activate.

Sensor:TYPE
Access

Get only

Sensor:DISPLAY
Access

Get only

Type

String

The value of the sensor’s readout, usualy including the units.

Sensor:POWERCONSUMPTION
Access

Get only

Type

Scalar

The rate at which this sensor drains ElectricCharge.

Sensor:TOGGLE()

Call this method to cause the sensor to switch between active and deactivated or visa versa.