2025-12-02 01:21:10 +00:00
extends Node
2025-12-06 16:43:37 +00:00
func _ready ( ) - > void :
load_settings ( )
2025-12-06 21:19:46 +00:00
LimboConsole . register_command ( set_story_progress , " set_story_progress " , " Sets the current story_progress variable " )
2025-12-08 15:20:28 +00:00
LimboConsole . register_command ( set_active_mission , " set_active_mission " , " Sets the current active_mission variable " )
2025-12-06 16:43:37 +00:00
2025-12-02 21:00:10 +00:00
var ground_location = null
2025-12-02 01:21:10 +00:00
var orbit_zones = [
2025-12-02 19:51:40 +00:00
{
" name " : " The Star " ,
" distance " : 2048 * 1.5 ,
" spawns " : [ ]
} ,
2025-12-02 01:21:10 +00:00
{
" name " : " Test Zone " ,
" distance " : 0 ,
" spawns " : [
{
" type " : " asteroid " ,
" chance_percent " : 100 ,
" amount_min " : 4 ,
" amount_max " : 5 ,
}
]
} ,
2025-12-02 19:51:40 +00:00
2025-12-02 01:21:10 +00:00
]
2025-12-04 21:32:46 +00:00
2025-12-08 02:12:30 +00:00
var missions = {
" waking_up " : {
2025-12-07 21:13:25 +00:00
" id " : " waking_up " ,
" name " : " Waking Up " ,
" desc " : " Welcome back, spaceperson. " ,
" rewards " : {
" marks " : 500
} ,
" objectives " : {
" desk " : " Visit the doctor at their desk " ,
" follow " : " Follow the doctor " ,
" run " : " My suggestion: RUN! " ,
" escape " : " Escape to your ship "
}
} ,
2025-12-08 02:12:30 +00:00
" test_contract " : {
2025-12-07 21:13:25 +00:00
" id " : " test_contract " ,
" name " : " HEMA Removal " ,
" desc " : " Space station 02 is currently overrun with HEMA mercenaries. We know they have a bomb in the storage warehouse. We want someone to plant that bomb on the station. " ,
" rewards " : {
" marks " : 500
} ,
" objectives " : {
" arrive " : " Enter Space Station 02 (navigate to it via your navagent) " ,
" collect_bomb " : " Collect the bomb in the back room " ,
" plant_bomb " : " Plant the bomb in the main foyer " ,
" escape " : " Escape "
}
} ,
2025-12-08 02:12:30 +00:00
}
2025-12-07 21:13:25 +00:00
2025-12-08 15:20:28 +00:00
var contracts = [ " test_contract " ]
2025-12-07 00:33:42 +00:00
var ground_guns = {
" pistol " : {
" name " : " Oni " ,
2025-12-07 06:34:20 +00:00
" type " : " kinetic " ,
2025-12-07 00:33:42 +00:00
" damage " : 10 ,
" magazine_size " : 12 ,
" fire_rate " : 0.3
2025-12-07 06:34:20 +00:00
} ,
2025-12-07 18:36:35 +00:00
" docgun " : {
" name " : " Docgun " ,
" type " : " kinetic " ,
" damage " : 150 ,
" magazine_size " : 12 ,
" fire_rate " : 0.25
} ,
2025-12-07 06:34:20 +00:00
" smg " : {
" name " : " Ripper " ,
" type " : " energy " ,
" damage " : 8 ,
" magazine_size " : 24 ,
" fire_rate " : 1.0 / 6.0
2025-12-07 00:33:42 +00:00
}
}
2025-12-07 06:34:20 +00:00
var checkpoint = null
func load_checkpoint ( ) :
if checkpoint :
get_tree ( ) . change_scene_to_packed ( checkpoint )
2025-12-06 16:43:37 +00:00
func generate_save ( ) :
var save_dict = {
" stats " : stats
}
return save_dict
## Saves the game in its current state.
func save_game ( ) :
var save_file = FileAccess . open ( " user://savegame.save " , FileAccess . WRITE )
var json_string = JSON . stringify ( generate_save ( ) )
save_file . store_line ( json_string )
func save_settings ( ) :
var save_file = FileAccess . open ( " user://settings.json " , FileAccess . WRITE )
var json_string = JSON . stringify ( settings )
save_file . store_line ( json_string )
## Loads the game data from the savegame.save file.
func load_game ( ) :
if not FileAccess . file_exists ( " user://savegame.save " ) :
return
var save_file = FileAccess . open ( " user://savegame.save " , FileAccess . READ )
var json = JSON . new ( )
var parse_result = json . parse ( save_file . get_as_text ( ) )
if not parse_result == OK :
print ( " JSON Parse Error: " , json . get_error_message ( ) , " in " , parse_result , " at line " , json . get_error_line ( ) )
return
2025-12-07 03:06:34 +00:00
if json . data . stats : stats = json . data . stats
2025-12-06 16:43:37 +00:00
func load_settings ( ) :
if not FileAccess . file_exists ( " user://settings.json " ) :
return
var save_file = FileAccess . open ( " user://settings.json " , FileAccess . READ )
var json = JSON . new ( )
var parse_result = json . parse ( save_file . get_as_text ( ) )
if not parse_result == OK :
print ( " JSON Parse Error: " , json . get_error_message ( ) , " in " , parse_result , " at line " , json . get_error_line ( ) )
return
settings = json . data
func delete_game ( ) :
await DirAccess . remove_absolute ( " user://savegame.save " )
2025-12-06 21:19:46 +00:00
func set_story_progress ( value : int ) - > void :
stats . story_progress = value
2025-12-08 15:20:28 +00:00
func set_active_mission ( value = null ) - > void :
stats . active_mission = value
2025-12-06 16:43:37 +00:00
2025-12-06 19:33:22 +00:00
var default_stats = {
2025-12-06 16:43:37 +00:00
" loaded " : false ,
2025-12-07 21:13:25 +00:00
" fuel " : 75 ,
2025-12-04 21:32:46 +00:00
" fuel_tank_size " : 1 ,
" speed " : 512 ,
" boost_tank_size " : 1 ,
" marks " : 200 ,
2025-12-07 06:34:20 +00:00
" location " : " space_station_1 " ,
2025-12-07 03:06:34 +00:00
" position " : Vector2 ( ) ,
" rotation " : 0 ,
2025-12-07 06:34:20 +00:00
" story_progress " : 0 ,
2025-12-06 22:03:58 +00:00
" navigation_goal " : null ,
2025-12-07 06:34:20 +00:00
" equipped_ground_gun " : null ,
" gun_holstered " : true ,
2025-12-07 21:13:25 +00:00
2025-12-08 02:12:30 +00:00
" active_mission " : null ,
2025-12-07 21:13:25 +00:00
" mission_progress " : 0 ,
" completed_missions " : [ ] ,
2025-12-04 21:32:46 +00:00
}
2025-12-06 03:34:56 +00:00
2025-12-06 19:33:22 +00:00
var stats = default_stats . duplicate_deep ( )
2025-12-06 03:34:56 +00:00
var settings = {
" master_volume " : 1.0 ,
" music_volume " : 1.0 ,
" sfx_volume " : 1.0 ,
}