Alarms#
- public class AlarmManager#
Alarm manager. Obtained by calling
getAlarmManager().- 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
nullif 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.
- static Alarm addVesselAlarm(Connection connection, double time, Vessel vessel, String title, String description)#
Create an alarm linked to a vessel.
- static Alarm addApoapsisAlarm(Connection connection, Vessel vessel, double offset, String title, String description)#
Create an alarm for the given vessel’s next apoapsis.
- static Alarm addPeriapsisAlarm(Connection connection, Vessel vessel, double offset, String title, String description)#
Create an alarm for the given vessel’s next periapsis.
- 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:
- 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.
- 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.
- 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.
- 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 SOI_CHANGE#
An alarm for the next sphere of influence change on the vessel’s flight path.
- 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.