ksp::debug
Provides utility functions to draw in-game markers that can be helpful to visualize why an algorithm went haywire.
Types
Debug
Collection of debug helper
Methods
add_billboard
debug.add_billboard ( positionProvider : sync fn() -> ksp::math::GlobalPosition,
textProvider : sync fn() -> string,
color : ksp::console::RgbaColor,
fontSize : int ) -> ksp::debug::DebugBillboard
Parameters
Name |
Type |
Optional |
Description |
---|---|---|---|
positionProvider |
sync fn() -> ksp::math::GlobalPosition |
||
textProvider |
sync fn() -> string |
||
color |
ksp::console::RgbaColor |
||
fontSize |
int |
add_ground_marker
debug.add_ground_marker ( geoCoordinates : ksp::orbit::GeoCoordinates,
color : ksp::console::RgbaColor,
rotation : float ) -> ksp::debug::GroundMarker
Parameters
Name |
Type |
Optional |
Description |
---|---|---|---|
geoCoordinates |
ksp::orbit::GeoCoordinates |
||
color |
ksp::console::RgbaColor |
||
rotation |
float |
add_line
debug.add_line ( startProvider : sync fn() -> ksp::math::GlobalPosition,
endProvider : sync fn() -> ksp::math::GlobalPosition,
color : ksp::console::RgbaColor,
label : string,
width : float ) -> ksp::debug::DebugVector
Draws a line from start
to end
with a specified color
and width
in the current game scene.
The line may have a label
at its mid-point.
Parameters
Name |
Type |
Optional |
Description |
---|---|---|---|
startProvider |
sync fn() -> ksp::math::GlobalPosition |
||
endProvider |
sync fn() -> ksp::math::GlobalPosition |
||
color |
ksp::console::RgbaColor |
||
label |
string |
||
width |
float |
add_path
debug.add_path ( path : ksp::math::GlobalPosition[],
color : ksp::console::RgbaColor,
width : float ) -> ksp::debug::DebugPath
Parameters
Name |
Type |
Optional |
Description |
---|---|---|---|
path |
ksp::math::GlobalPosition[] |
||
color |
ksp::console::RgbaColor |
||
width |
float |
add_vector
debug.add_vector ( startProvider : sync fn() -> ksp::math::GlobalPosition,
vectorProvider : sync fn() -> ksp::math::GlobalVector,
color : ksp::console::RgbaColor,
label : string,
width : float ) -> ksp::debug::DebugVector
Draws a vector
positioned at start
with a specified color
and width
in the current game scene.
The vector may have a label
at its mid-point.
Parameters
Name |
Type |
Optional |
Description |
---|---|---|---|
startProvider |
sync fn() -> ksp::math::GlobalPosition |
||
vectorProvider |
sync fn() -> ksp::math::GlobalVector |
||
color |
ksp::console::RgbaColor |
||
label |
string |
||
width |
float |
clear_markers
debug.clear_markers ( ) -> Unit
Remove all markers from the game-scene.
DebugBillboard
Represents a ground marker on a given celestial body.
Fields
Name |
Type |
Read-only |
Description |
---|---|---|---|
color |
R/W |
The color of the billboard text |
|
font_size |
int |
R/W |
|
visible |
bool |
R/W |
Controls if the billboard is currently visible (initially |
Methods
remove
debugbillboard.remove ( ) -> Unit
DebugPath
Represents a debugging path in the current scene.
Fields
Name |
Type |
Read-only |
Description |
---|---|---|---|
color |
R/W |
The color of the debugging path |
|
path |
R/W |
||
visible |
bool |
R/W |
Controls if the debug path is currently visible (initially |
width |
float |
R/W |
The width of the debugging path |
Methods
remove
debugpath.remove ( ) -> Unit
DebugVector
Represents a debugging vector in the current scene.
Fields
Name |
Type |
Read-only |
Description |
---|---|---|---|
color |
R/W |
The color of the debugging vector |
|
end |
R/W |
The current end position of the debugging vector. |
|
pointy |
bool |
R/W |
Controls if an arrow should be drawn at the end. |
scale |
float |
R/W |
|
start |
R/W |
The current starting position of the debugging vector. |
|
visible |
bool |
R/W |
Controls if the debug-vector is currently visible (initially |
width |
float |
R/W |
The width of the debugging vector |
Methods
remove
debugvector.remove ( ) -> Unit
set_end_provider
debugvector.set_end_provider ( endProvider : sync fn() -> ksp::math::GlobalPosition ) -> Unit
Change the function providing the end position of the debug vector.
Parameters
Name |
Type |
Optional |
Description |
---|---|---|---|
endProvider |
sync fn() -> ksp::math::GlobalPosition |
set_start_provider
debugvector.set_start_provider ( startProvider : sync fn() -> ksp::math::GlobalPosition ) -> Unit
Change the function providing the start position of the debug vector.
Parameters
Name |
Type |
Optional |
Description |
---|---|---|---|
startProvider |
sync fn() -> ksp::math::GlobalPosition |
set_vector_provider
debugvector.set_vector_provider ( vectorProvider : sync fn() -> ksp::math::GlobalVector ) -> Unit
Change the function providing the vector/direction of the debug vector.
Parameters
Name |
Type |
Optional |
Description |
---|---|---|---|
vectorProvider |
sync fn() -> ksp::math::GlobalVector |
GroundMarker
Represents a ground marker on a given celestial body.
Fields
Name |
Type |
Read-only |
Description |
---|---|---|---|
color |
R/W |
The color of the ground marker vector |
|
geo_coordinates |
R/W |
||
rotation |
float |
R/W |
|
visible |
bool |
R/W |
Controls if the ground marker is currently visible (initially |
Methods
remove
groundmarker.remove ( ) -> Unit
LogFile
Represents a log file.
Methods
log
logfile.log ( message : string ) -> Unit
Write a log message to the file.
Parameters
Name |
Type |
Optional |
Description |
---|---|---|---|
message |
string |
read_lines
logfile.read_lines ( ) -> string[]
Read all previous log entries
truncate
logfile.truncate ( ) -> Unit
Truncate/clear the log file.
SaveLoadControl
Control load/save of game
Fields
Name |
Type |
Read-only |
Description |
---|---|---|---|
is_loaded |
bool |
R/O |
|
is_loading |
bool |
R/O |
|
is_saving |
bool |
R/O |
|
quick_load_allowed |
bool |
R/O |
Check if quick load is allowed by the game settings |
Methods
quick_load
saveloadcontrol.quick_load ( ) -> Unit
Trigger a quick load. Note: This will implicitly terminate all running scripts.
quick_save
saveloadcontrol.quick_save ( ) -> Unit
Trigger a quick save
try_recover_vessel
saveloadcontrol.try_recover_vessel ( ) -> bool
Try to recover the current vessel. Currently a vessel is only recoverable if splashed or landed on Kerbin. This will implicitly terminate the running script if successful.
Constants
Name |
Type |
Description |
---|---|---|
DEBUG |
ksp::debug::Debug |
Collection of debug helper |
MAIN_LOG |
ksp::debug::LogFile |
Main script specific log file |
SAVE_LOAD_CONTROL |
ksp::debug::SaveLoadControl |
Control save/load of game |
Functions
open_log_file
pub sync fn open_log_file ( name : string ) -> ksp::debug::LogFile
Parameters
Name |
Type |
Optional |
Description |
---|---|---|---|
name |
string |