Alarms#

class AlarmManager#

Alarm manager. Obtained by calling alarm_manager().

std::vector<Alarm> alarms()#

A list of all alarms.

std::vector<Alarm> alarms_with_type(AlarmType type)#

A list of all alarms of the given type.

Parameters:
  • type – The type of alarm to return.

Alarm alarm_with_name(std::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 – The title of the alarm to return.

static Alarm add_alarm(Client &connection, double time, std::string title = "Alarm", std::string description = "")#

Create an alarm.

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

  • title – Title for the alarm.

  • description – Description for the alarm.

static Alarm add_vessel_alarm(Client &connection, double time, Vessel vessel, std::string title = "Vessel Alarm", std::string description = "")#

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.

  • description – Description for the alarm.

static Alarm add_apoapsis_alarm(Client &connection, Vessel vessel, double offset = 60.0, std::string title = "Apoapsis Alarm", std::string description = "")#

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

Parameters:
  • vessel – The vessel.

  • offset – Time in seconds to offset the alarm by.

  • title – Title for the alarm.

  • description – Description for the alarm.

static Alarm add_periapsis_alarm(Client &connection, Vessel vessel, double offset = 60.0, std::string title = "Periapsis Alarm", std::string description = "")#

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

Parameters:
  • vessel – The vessel.

  • offset – Time in seconds to offset the alarm by.

  • title – Title for the alarm.

  • description – Description for the alarm.

static Alarm add_maneuver_node_alarm(Client &connection, Vessel vessel, Node node, double offset = 60.0, bool add_burn_time = true, std::string title = "Maneuver Node Alarm", std::string description = "")#

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.

  • add_burn_time – Whether the node’s burn time should be included in the alarm.

  • title – Title for the alarm.

  • description – Description for the alarm.

static Alarm add_soi_alarm(Client &connection, Vessel vessel, double offset = 60.0, std::string title = "SOI Change Alarm", std::string description = "")#

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.

  • title – Title for the alarm.

  • description – Description for the alarm.

static Alarm add_transfer_window_alarm(Client &connection, Vessel vessel, CelestialBody target, std::string title = "Transfer Window Alarm", std::string description = "")#

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.

  • description – 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.

class Alarm#

An alarm. Can be accessed using alarm_manager().

uint32_t id()#

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 type()#

Type of alarm.

std::string title()#
void set_title(std::string value)#

Title of the alarm.

std::string description()#
void set_description(std::string value)#

Description of the alarm.

double time()#
void set_time(double value)#

Time the alarm will trigger, in seconds since epoch.

double time_until()#

Time until the alarm triggers, in seconds.

double event_offset()#
void set_event_offset(double value)#

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

Vessel vessel()#

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

Node node()#
void set_node(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 origin_body()#
void set_origin_body(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 destination_body()#
void set_destination_body(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 warp_action()#
void set_warp_action(AlarmWarpAction value)#

The action taken on time warp when the alarm fires.

AlarmMessageAction message_action()#
void set_message_action(AlarmMessageAction value)#

The on-screen message behavior when the alarm fires.

bool play_sound()#
void set_play_sound(bool value)#

Whether the alarm plays a sound when it fires.

bool delete_on_dismiss()#
void set_delete_on_dismiss(bool value)#

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

bool triggered()#

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

bool actioned()#

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

void remove()#

Removes the alarm.

enum struct AlarmType#

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

enumerator raw#

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

enumerator apoapsis#

An alarm for the next apoapsis of a vessel.

enumerator periapsis#

An alarm for the next periapsis of a vessel.

enumerator maneuver#

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

enumerator soi_change#

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

enumerator transfer_window#

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

enumerator unknown#

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

enum struct AlarmWarpAction#

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

enumerator no_change#

Do not change time warp when the alarm fires.

enumerator stop_warp#

Drop out of time warp when the alarm fires.

enumerator pause_game#

Pause the game when the alarm fires.

enum struct AlarmMessageAction#

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

enumerator no_message#

Do not display a message when the alarm fires.

enumerator message#

Display a message when the alarm fires.

enumerator message_if_not_active_vessel#

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