Alarms#
- class SpaceCenter.AlarmManager#
Alarm manager. Obtained by calling
SpaceCenter.alarm_manager.- alarms: List#
A list of all alarms.
- Attribute:
Read-only, cannot be set
- Return type:
List
- alarms_with_type(type)#
A list of all alarms of the given type.
- Parameters:
type (
SpaceCenter.AlarmType) – The type of alarm to return.- Return type:
List
- alarm_with_name(name)#
Returns the first alarm with the given title, or
nilif 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.- Return type:
- static add_alarm(time[, title = 'Alarm'][, description = ''])#
Create an alarm.
- Parameters:
time (
number) – Number of seconds from now that the alarm should trigger.title (
string) – Title for the alarm.description (
string) – Description for the alarm.
- Return type:
- static add_vessel_alarm(time, vessel[, title = 'Vessel Alarm'][, description = ''])#
Create an alarm linked to a vessel.
- Parameters:
time (
number) – Number of seconds from now that the alarm should trigger.vessel (
SpaceCenter.Vessel) – Vessel to link the alarm to.title (
string) – Title for the alarm.description (
string) – Description for the alarm.
- Return type:
- static add_apoapsis_alarm(vessel[, offset = 60.0][, title = 'Apoapsis Alarm'][, description = ''])#
Create an alarm for the given vessel’s next apoapsis.
- Parameters:
vessel (
SpaceCenter.Vessel) – The vessel.offset (
number) – Time in seconds to offset the alarm by.title (
string) – Title for the alarm.description (
string) – Description for the alarm.
- Return type:
- static add_periapsis_alarm(vessel[, offset = 60.0][, title = 'Periapsis Alarm'][, description = ''])#
Create an alarm for the given vessel’s next periapsis.
- Parameters:
vessel (
SpaceCenter.Vessel) – The vessel.offset (
number) – Time in seconds to offset the alarm by.title (
string) – Title for the alarm.description (
string) – Description for the alarm.
- Return type:
- static add_maneuver_node_alarm(vessel, node[, offset = 60.0][, add_burn_time = True][, title = 'Maneuver Node Alarm'][, description = ''])#
Create an alarm for the given vessel and maneuver node.
- Parameters:
vessel (
SpaceCenter.Vessel) – The vessel.node (
SpaceCenter.Node) – The maneuver node.offset (
number) – Time in seconds to offset the alarm by.add_burn_time (
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.
- Return type:
- static add_soi_alarm(vessel[, offset = 60.0][, title = 'SOI Change Alarm'][, description = ''])#
Create an alarm for the given vessel’s next sphere of influence change.
- Parameters:
vessel (
SpaceCenter.Vessel) – The vessel.offset (
number) – Time in seconds to offset the alarm by.title (
string) – Title for the alarm.description (
string) – Description for the alarm.
- Return type:
- static add_transfer_window_alarm(vessel, target[, title = 'Transfer Window Alarm'][, description = ''])#
Create an alarm for the next planetary transfer window from the vessel’s current parent body to the target body.
- Parameters:
vessel (
SpaceCenter.Vessel) – The vessel.target (
SpaceCenter.CelestialBody) – The target body.title (
string) – Title for the alarm.description (
string) – Description for the alarm.
- Return type:
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.
- class SpaceCenter.Alarm#
An alarm. Can be accessed using
SpaceCenter.alarm_manager.- id: number#
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.
- Attribute:
Read-only, cannot be set
- Return type:
number
- type: SpaceCenter.AlarmType#
Type of alarm.
- Attribute:
Read-only, cannot be set
- Return type:
- title: string#
Title of the alarm.
- Attribute:
Can be read or written
- Return type:
string
- description: string#
Description of the alarm.
- Attribute:
Can be read or written
- Return type:
string
- time: number#
Time the alarm will trigger, in seconds since epoch.
- Attribute:
Can be read or written
- Return type:
number
- time_until: number#
Time until the alarm triggers, in seconds.
- Attribute:
Read-only, cannot be set
- Return type:
number
- event_offset: number#
Seconds between the alarm going off and the event it references.
- Attribute:
Can be read or written
- Return type:
number
- vessel: SpaceCenter.Vessel#
Vessel the alarm references.
nilif it does not reference a vessel.- Attribute:
Read-only, cannot be set
- Return type:
- node: SpaceCenter.Node#
Maneuver node the alarm references. Only valid for alarms of type
SpaceCenter.AlarmType.maneuver.- Attribute:
Can be read or written
- Return type:
Note
Throws an exception if the alarm is not of type
SpaceCenter.AlarmType.maneuver.
- origin_body: SpaceCenter.CelestialBody#
Origin body for the transfer window. Only valid for alarms of type
SpaceCenter.AlarmType.transfer_window.- Attribute:
Can be read or written
- Return type:
Note
Throws an exception if the alarm is not of type
SpaceCenter.AlarmType.transfer_window.
- destination_body: SpaceCenter.CelestialBody#
Destination body for the transfer window. Only valid for alarms of type
SpaceCenter.AlarmType.transfer_window.- Attribute:
Can be read or written
- Return type:
Note
Throws an exception if the alarm is not of type
SpaceCenter.AlarmType.transfer_window.
- warp_action: SpaceCenter.AlarmWarpAction#
The action taken on time warp when the alarm fires.
- Attribute:
Can be read or written
- Return type:
- message_action: SpaceCenter.AlarmMessageAction#
The on-screen message behavior when the alarm fires.
- Attribute:
Can be read or written
- Return type:
- play_sound: boolean#
Whether the alarm plays a sound when it fires.
- Attribute:
Can be read or written
- Return type:
boolean
- delete_on_dismiss: boolean#
Whether the alarm is deleted automatically once the player has dismissed the triggered message.
- Attribute:
Can be read or written
- Return type:
boolean
- triggered: boolean#
Whether the time of the alarm has passed and its actions have been triggered.
- Attribute:
Read-only, cannot be set
- Return type:
boolean
- actioned: boolean#
Whether the alarm’s actions were triggered and then completed or closed.
- Attribute:
Read-only, cannot be set
- Return type:
boolean
- remove()#
Removes the alarm.
- class SpaceCenter.AlarmType#
The type of an alarm. See
SpaceCenter.Alarm.type.- raw#
An alarm for a specific date/time or a specific period in the future.
- apoapsis#
An alarm for the next apoapsis of a vessel.
- periapsis#
An alarm for the next periapsis of a vessel.
- maneuver#
An alarm based on a maneuver node on the vessel’s flight path.
- soi_change#
An alarm for the next sphere of influence change on the vessel’s flight path.
- transfer_window#
An alarm for the next planetary transfer window from the vessel’s current orbit to a target body.
- unknown#
The alarm is of a type not recognized by kRPC. Typically this is a type introduced by a mod.
- class SpaceCenter.AlarmWarpAction#
The warp action taken when an alarm fires. See
SpaceCenter.Alarm.warp_action.- no_change#
Do not change time warp when the alarm fires.
- stop_warp#
Drop out of time warp when the alarm fires.
- pause_game#
Pause the game when the alarm fires.
- class SpaceCenter.AlarmMessageAction#
The on-screen message action taken when an alarm fires. See
SpaceCenter.Alarm.message_action.- no_message#
Do not display a message when the alarm fires.
- message#
Display a message when the alarm fires.
- message_if_not_active_vessel#
Display a message only if the alarm’s vessel is not the currently active vessel.