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
-
alarms_with_type(type:
SpaceCenter.AlarmType):List# A list of all alarms of the given type.
- Parameters:
type – The type of alarm to return.
-
alarm_with_name(name:
string):SpaceCenter.Alarm|nil# 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 – The title of the alarm to return.
-
staticmethod add_alarm(time:
number,title?:string,description?:string):SpaceCenter.Alarm# Create an alarm.
- Parameters:
time – Number of seconds from now that the alarm should trigger.
title – Title for the alarm. Defaults to
'Alarm'.description – Description for the alarm. Defaults to
''.
-
staticmethod add_vessel_alarm(
time:number,
vessel:SpaceCenter.Vessel,
title?:string,
description?:string
):SpaceCenter.Alarm# Create an alarm linked to a vessel.
- Parameters:
time – Number of seconds from now that the alarm should trigger.
vessel – Vessel to link the alarm to.
title – Title for the alarm. Defaults to
'Vessel Alarm'.description – Description for the alarm. Defaults to
''.
-
staticmethod add_apoapsis_alarm(
vessel:SpaceCenter.Vessel,
offset?:number,
title?:string,
description?:string
):SpaceCenter.Alarm# Create an alarm for the given vessel’s next apoapsis.
- Parameters:
vessel – The vessel.
offset – Time in seconds to offset the alarm by. Defaults to
60.0.title – Title for the alarm. Defaults to
'Apoapsis Alarm'.description – Description for the alarm. Defaults to
''.
-
staticmethod add_periapsis_alarm(
vessel:SpaceCenter.Vessel,
offset?:number,
title?:string,
description?:string
):SpaceCenter.Alarm# Create an alarm for the given vessel’s next periapsis.
- Parameters:
vessel – The vessel.
offset – Time in seconds to offset the alarm by. Defaults to
60.0.title – Title for the alarm. Defaults to
'Periapsis Alarm'.description – Description for the alarm. Defaults to
''.
-
staticmethod add_maneuver_node_alarm(
vessel:SpaceCenter.Vessel,
node:SpaceCenter.Node,
offset?:number,
add_burn_time?:boolean,
title?:string,
description?:string
):SpaceCenter.Alarm# Create an alarm for the given vessel and maneuver node.
- Parameters:
vessel – The vessel.
node – The maneuver node.
offset – Time in seconds to offset the alarm by. Defaults to
60.0.add_burn_time – Whether the node’s burn time should be included in the alarm. Defaults to
true.title – Title for the alarm. Defaults to
'Maneuver Node Alarm'.description – Description for the alarm. Defaults to
''.
-
staticmethod add_soi_alarm(
vessel:SpaceCenter.Vessel,
offset?:number,
title?:string,
description?:string
):SpaceCenter.Alarm# Create an alarm for the given vessel’s next sphere of influence change.
- Parameters:
vessel – The vessel.
offset – Time in seconds to offset the alarm by. Defaults to
60.0.title – Title for the alarm. Defaults to
'SOI Change Alarm'.description – Description for the alarm. Defaults to
''.
-
staticmethod add_transfer_window_alarm(
vessel:SpaceCenter.Vessel,
target:SpaceCenter.CelestialBody,
title?:string,
description?:string
):SpaceCenter.Alarm# Create an alarm for the next planetary transfer window from the vessel’s current parent body to the target body.
- Parameters:
vessel – The vessel.
target – The target body.
title – Title for the alarm. Defaults to
'Transfer Window Alarm'.description – Description for the alarm. Defaults to
''.
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.
-
alarms:
- 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
-
type:
SpaceCenter.AlarmType# Type of alarm.
- Attribute:
Read-only, cannot be set
-
title:
string# Title of the alarm.
- Attribute:
Can be read or written
-
description:
string# Description of the alarm.
- Attribute:
Can be read or written
-
time:
number# Time the alarm will trigger, in seconds since epoch.
- Attribute:
Can be read or written
-
time_until:
number# Time until the alarm triggers, in seconds.
- Attribute:
Read-only, cannot be set
-
event_offset:
number# Seconds between the alarm going off and the event it references.
- Attribute:
Can be read or written
Note
For a maneuver alarm that includes the burn time, setting this sets the margin before the start of the burn, and the value read back includes half the burn time.
-
vessel:
SpaceCenter.Vessel|nil# Vessel the alarm references.
nilif it does not reference a vessel.- Attribute:
Read-only, cannot be set
-
node:
SpaceCenter.Node# Maneuver node the alarm references. Only valid for alarms of type
SpaceCenter.AlarmType.maneuver.- Attribute:
Can be read or written
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
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
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
-
message_action:
SpaceCenter.AlarmMessageAction# The on-screen message behavior when the alarm fires.
- Attribute:
Can be read or written
-
play_sound:
boolean# Whether the alarm plays a sound when it fires.
- Attribute:
Can be read or written
-
delete_on_dismiss:
boolean# Whether the alarm is deleted automatically once the player has dismissed the triggered message.
- Attribute:
Can be read or written
-
triggered:
boolean# Whether the time of the alarm has passed and its actions have been triggered.
- Attribute:
Read-only, cannot be set
-
actioned:
boolean# Whether the alarm’s actions were triggered and then completed or closed.
- Attribute:
Read-only, cannot be set
- remove()#
Removes the alarm.
Note
Any further use of this object throws an exception.
-
id:
- 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.