Alarms#

public class AlarmManager#

Alarm manager. Obtained by calling getAlarmManager().

java.util.List<Alarm> getAlarms()#

A list of all alarms.

java.util.List<Alarm> alarmsWithType(AlarmType type)#

A list of all alarms of the given type.

Parameters:
  • type (AlarmType) – The type of alarm to return.

Alarm alarmWithName(String name)#

Returns the first alarm with the given title, or null if no such alarm exists. Alarm titles are not guaranteed to be unique; if more than one alarm shares the given title, the first one found is returned.

Parameters:
  • name (String) – The title of the alarm to return.

static Alarm addAlarm(Connection connection, double time, String title, String description)#

Create an alarm.

Parameters:
  • time (double) – Number of seconds from now that the alarm should trigger.

  • title (String) – Title for the alarm.

  • description (String) – Description for the alarm.

static Alarm addVesselAlarm(Connection connection, double time, Vessel vessel, String title, String description)#

Create an alarm linked to a vessel.

Parameters:
  • time (double) – Number of seconds from now that the alarm should trigger.

  • vessel (Vessel) – Vessel to link the alarm to.

  • title (String) – Title for the alarm.

  • description (String) – Description for the alarm.

static Alarm addApoapsisAlarm(Connection connection, Vessel vessel, double offset, String title, String description)#

Create an alarm for the given vessel’s next apoapsis.

Parameters:
  • vessel (Vessel) – The vessel.

  • offset (double) – Time in seconds to offset the alarm by.

  • title (String) – Title for the alarm.

  • description (String) – Description for the alarm.

static Alarm addPeriapsisAlarm(Connection connection, Vessel vessel, double offset, String title, String description)#

Create an alarm for the given vessel’s next periapsis.

Parameters:
  • vessel (Vessel) – The vessel.

  • offset (double) – Time in seconds to offset the alarm by.

  • title (String) – Title for the alarm.

  • description (String) – Description for the alarm.

static Alarm addManeuverNodeAlarm(Connection connection, Vessel vessel, Node node, double offset, boolean addBurnTime, String title, String description)#

Create an alarm for the given vessel and maneuver node.

Parameters:
  • vessel (Vessel) – The vessel.

  • node (Node) – The maneuver node.

  • offset (double) – Time in seconds to offset the alarm by.

  • addBurnTime (boolean) – Whether the node’s burn time should be included in the alarm.

  • title (String) – Title for the alarm.

  • description (String) – Description for the alarm.

static Alarm addSOIAlarm(Connection connection, Vessel vessel, double offset, String title, String description)#

Create an alarm for the given vessel’s next sphere of influence change.

Parameters:
  • vessel (Vessel) – The vessel.

  • offset (double) – Time in seconds to offset the alarm by.

  • title (String) – Title for the alarm.

  • description (String) – Description for the alarm.

static Alarm addTransferWindowAlarm(Connection connection, Vessel vessel, CelestialBody target, String title, String description)#

Create an alarm for the next planetary transfer window from the vessel’s current parent body to the target body.

Parameters:
  • vessel (Vessel) – The vessel.

  • target (CelestialBody) – The target body.

  • title (String) – Title for the alarm.

  • description (String) – Description for the alarm.

Note

This relies on KSP’s stock transfer-window alarm logic. If KSP cannot compute a transfer from the vessel’s current parent body to the target, the resulting alarm may not fire at a useful time; in that case the properties on the returned alarm can still be used to inspect or adjust it.

public class Alarm#

An alarm. Can be accessed using getAlarmManager().

int getID()#

Unique identifier of the alarm. KSP destroys and recreates an alarm when it is edited. This id will remain constant between the old and new alarms.

AlarmType getType()#

Type of alarm.

String getTitle()#
void setTitle(String value)#

Title of the alarm.

String getDescription()#
void setDescription(String value)#

Description of the alarm.

double getTime()#
void setTime(double value)#

Time the alarm will trigger, in seconds since epoch.

double getTimeUntil()#

Time until the alarm triggers, in seconds.

double getEventOffset()#
void setEventOffset(double value)#

Seconds between the alarm going off and the event it references.

Vessel getVessel()#

Vessel the alarm references. null if it does not reference a vessel.

Node getNode()#
void setNode(Node value)#

Maneuver node the alarm references. Only valid for alarms of type AlarmType.MANEUVER.

Note

Throws an exception if the alarm is not of type AlarmType.MANEUVER.

CelestialBody getOriginBody()#
void setOriginBody(CelestialBody value)#

Origin body for the transfer window. Only valid for alarms of type AlarmType.TRANSFER_WINDOW.

Note

Throws an exception if the alarm is not of type AlarmType.TRANSFER_WINDOW.

CelestialBody getDestinationBody()#
void setDestinationBody(CelestialBody value)#

Destination body for the transfer window. Only valid for alarms of type AlarmType.TRANSFER_WINDOW.

Note

Throws an exception if the alarm is not of type AlarmType.TRANSFER_WINDOW.

AlarmWarpAction getWarpAction()#
void setWarpAction(AlarmWarpAction value)#

The action taken on time warp when the alarm fires.

AlarmMessageAction getMessageAction()#
void setMessageAction(AlarmMessageAction value)#

The on-screen message behavior when the alarm fires.

boolean getPlaySound()#
void setPlaySound(boolean value)#

Whether the alarm plays a sound when it fires.

boolean getDeleteOnDismiss()#
void setDeleteOnDismiss(boolean value)#

Whether the alarm is deleted automatically once the player has dismissed the triggered message.

boolean getTriggered()#

Whether the time of the alarm has passed and its actions have been triggered.

boolean getActioned()#

Whether the alarm’s actions were triggered and then completed or closed.

void remove()#

Removes the alarm.

public enum AlarmType#

The type of an alarm. See Alarm.getType().

public AlarmType RAW#

An alarm for a specific date/time or a specific period in the future.

public AlarmType APOAPSIS#

An alarm for the next apoapsis of a vessel.

public AlarmType PERIAPSIS#

An alarm for the next periapsis of a vessel.

public AlarmType MANEUVER#

An alarm based on a maneuver node on the vessel’s flight path.

public AlarmType SOI_CHANGE#

An alarm for the next sphere of influence change on the vessel’s flight path.

public AlarmType TRANSFER_WINDOW#

An alarm for the next planetary transfer window from the vessel’s current orbit to a target body.

public AlarmType UNKNOWN#

The alarm is of a type not recognized by kRPC. Typically this is a type introduced by a mod.

public enum AlarmWarpAction#

The warp action taken when an alarm fires. See Alarm.getWarpAction().

public AlarmWarpAction NO_CHANGE#

Do not change time warp when the alarm fires.

public AlarmWarpAction STOP_WARP#

Drop out of time warp when the alarm fires.

public AlarmWarpAction PAUSE_GAME#

Pause the game when the alarm fires.

public enum AlarmMessageAction#

The on-screen message action taken when an alarm fires. See Alarm.getMessageAction().

public AlarmMessageAction NO_MESSAGE#

Do not display a message when the alarm fires.

public AlarmMessageAction MESSAGE#

Display a message when the alarm fires.

public AlarmMessageAction MESSAGE_IF_NOT_ACTIVE_VESSEL#

Display a message only if the alarm’s vessel is not the currently active vessel.