From 734858c9263c4a9047c375829be4edee09e7e4ce Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Sun, 25 Apr 2021 20:35:59 -0400 Subject: [PATCH] Try to fix pre-release bug and fail --- export_presets.cfg | 123 ++++++++++++++++++++++++++++++++++++++ src/GameState.gd | 45 +++++++++++--- src/ui/EncounterChoice.gd | 16 +++-- src/ui/Encounters.gd | 9 ++- src/ui/Map.gd | 10 +++- 5 files changed, 183 insertions(+), 20 deletions(-) create mode 100644 export_presets.cfg diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..e9cb98d --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,123 @@ +[preset.0] + +name="HTML5" +platform="HTML5" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="build/ld48-gravity_limbo.html" +patch_list=PoolStringArray( ) +script_export_mode=1 +script_encryption_key="" + +[preset.0.options] + +vram_texture_compression/for_desktop=true +vram_texture_compression/for_mobile=false +html/custom_html_shell="" +html/head_include="" +custom_template/release="" +custom_template/debug="" + +[preset.1] + +name="Linux/X11" +platform="Linux/X11" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="build/ld48-gravity_limbo.x86_64" +patch_list=PoolStringArray( ) +script_export_mode=1 +script_encryption_key="" + +[preset.1.options] + +texture_format/bptc=false +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +texture_format/no_bptc_fallbacks=true +binary_format/64_bits=true +binary_format/embed_pck=false +custom_template/release="" +custom_template/debug="" + +[preset.2] + +name="Windows Desktop" +platform="Windows Desktop" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="build/ld48-gravity_limbo.exe" +patch_list=PoolStringArray( ) +script_export_mode=1 +script_encryption_key="" + +[preset.2.options] + +texture_format/bptc=false +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +texture_format/no_bptc_fallbacks=true +binary_format/64_bits=true +binary_format/embed_pck=false +custom_template/release="" +custom_template/debug="" +codesign/enable=false +codesign/identity="" +codesign/password="" +codesign/timestamp=true +codesign/timestamp_server_url="" +codesign/digest_algorithm=1 +codesign/description="" +codesign/custom_options=PoolStringArray( ) +application/icon="" +application/file_version="" +application/product_version="" +application/company_name="" +application/product_name="" +application/file_description="" +application/copyright="" +application/trademarks="" + +[preset.3] + +name="Mac OSX" +platform="Mac OSX" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="build/ld48-gravity_limbo.macosx.zip" +patch_list=PoolStringArray( ) +script_export_mode=1 +script_encryption_key="" + +[preset.3.options] + +custom_template/debug="" +custom_template/release="" +application/name="" +application/info="Made with Godot Engine" +application/icon="" +application/identifier="" +application/signature="" +application/short_version="1.0" +application/version="1.0" +application/copyright="" +display/high_res=false +privacy/camera_usage_description="" +privacy/microphone_usage_description="" +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false diff --git a/src/GameState.gd b/src/GameState.gd index 36c5559..5b5c24e 100644 --- a/src/GameState.gd +++ b/src/GameState.gd @@ -300,8 +300,27 @@ const EncounterData = { } } }, - "Comet" : {}, - "Debris" : {}, + "Comet" : { + "tooltip": "", + "situations": { + 0: { + "title": "Extra-solar fly-by", + "picture": null, + "text": "A large comet blazes through the system, passing nearby. It leaves sparkling trails of ice and gases in it's wake", + "choices": { + 0: { + "title": "Observer the comet", + "then": "You direct the majority of the sensors on your ship to observe the comet, and the crew crams in the observation deck to catch glimpses of the fly-by", + "results": { + + }, + }, + }, + }, + }, + }, + "Debris" : { + }, #"Gases" : {}, "Mystery" : {}, "Alien" : {}, @@ -543,15 +562,21 @@ func generate_encounter_instance(data, level = null, index = null): self.encounters[level][index]["instance"] = instance return instance -func goto_scene(scene, current = null): - call_deferred("_deferred_goto_scene", scene, current) +func goto_scene(scene, current = null, free = true): + call_deferred("_deferred_goto_scene", scene, current, free) -func _deferred_goto_scene(scene, current = null): +func _deferred_goto_scene(scene, current = null, free = true): get_tree().get_root().print_tree_pretty() if current: - current.free() + if free: + current.free() + else: + current.set_visible(false) elif self.current_scene: - self.current_scene.free() + if free: + self.current_scene.free() + else: + self.current_scene.set_visible(false) var next = ResourceLoader.load(scene).instance() get_tree().get_root().add_child(next) get_tree().set_current_scene(next) @@ -573,10 +598,12 @@ func start_encounters(picks): x += 1 if self.current_state < 5: self.current_state = 5 + self.goto_scene("res://src/ui/Encounters.tscn") if self.current_state > 5: self.current_state = 8 + self.goto_scene("res://src/ui/Encounters.tscn", null, false) - self.goto_scene("res://src/ui/Encounters.tscn") + func choose_flightpath_out(): GameState.current_state = 7 @@ -584,7 +611,7 @@ func choose_flightpath_out(): self.ship_stats['starting_position'] = get_tree().get_root().get_node("Encounters/Map/Ship").get_global_position() self.encounters.erase(GameState.current_depth) GameState.current_depth -= 1 - self.goto_scene("res://src/ui/ChooseFlightIn.tscn") + self.goto_scene("res://src/ui/ChooseFlightIn.tscn", null, false) func update_stats(d): for k in d.keys(): diff --git a/src/ui/EncounterChoice.gd b/src/ui/EncounterChoice.gd index a729f30..2aca674 100644 --- a/src/ui/EncounterChoice.gd +++ b/src/ui/EncounterChoice.gd @@ -19,7 +19,8 @@ func _ready(): # Bind button callbacks for n in buttonNames: var button = self.find_node(n) - button.connect("toggled", self, "_on_option_button_pressed", [n]) + if button: + button.connect("toggled", self, "_on_option_button_pressed", [n]) func initialize(l = null, nOptions = null): self.level = l @@ -68,19 +69,24 @@ func get_active_position(): var i = get_active_option_index() if i == null: return null - return get_node("Option" + str(i)).get_global_position() + var n = "Option" + str(i) + if get_node(n): + return get_node(n).get_global_position() + else: + return null func has_active(): var active = false for n in buttonNames: - active = active or (self.get_node(n).is_pressed() and self.get_node(n).is_visible()) + if get_node(n): + active = active or (self.get_node(n).is_pressed() and self.get_node(n).is_visible()) return active func _on_option_button_pressed(state, buttonName): for n in buttonNames: if n != buttonName: - if state: - self.find_node(n).set_pressed(false) + if state and get_node(n): + self.get_node(n).set_pressed(false) emit_signal("encounter_choice_changed") #for n in buttonNames: # if self.find_node(n).is_pressed(): diff --git a/src/ui/Encounters.gd b/src/ui/Encounters.gd index fdfd452..5dc3304 100644 --- a/src/ui/Encounters.gd +++ b/src/ui/Encounters.gd @@ -46,8 +46,10 @@ func _on_encounter_complete(instance): self.next_encounter() func next_encounter(): + print("Heading to next encounter") print(GameState.current_depth) print(GameState.current_state) + print(GameState.encounters) if GameState.current_state != 5 and GameState.current_state != 8: return if (self.direction == 1 and GameState.current_depth < (len(GameState.encounters) - 1)) \ @@ -58,9 +60,10 @@ func next_encounter(): "supplies": -GameState.get_supply_upkeep(), }) if get_node("Map/Level" + str(GameState.current_depth)): - GameState.update_stats({ - "target_position": get_node("Map/Level" + str(GameState.current_depth)).get_active_position(), - }) + if get_node("Map/Level" + str(GameState.current_depth)).get_active_position(): + GameState.update_stats({ + "target_position": get_node("Map/Level" + str(GameState.current_depth)).get_active_position(), + }) GameState.update_orbit({ "altitude": -self.direction * (GameState.get_difficulty_data("starting_altitude") - GameState.get_difficulty_data("minimum_altitude")) / len(GameState.encounters) }) diff --git a/src/ui/Map.gd b/src/ui/Map.gd index bb74929..fdb800b 100644 --- a/src/ui/Map.gd +++ b/src/ui/Map.gd @@ -56,6 +56,10 @@ func _ready(): #n.set_normal_texture(n.get_pressed_texture()) if GameState.encounters[level][x]["visited"]: n.set_visible(false) + # Don't free, because we have some bugs where we refer to the option again. + # This is a problem and leads to weird behaviour but I guess we'll have to live + # with it. + #n.free() x += 1 if GameState.current_state == 4: # picking course choice.activate_options() @@ -64,9 +68,10 @@ func _ready(): choice.connect("encounter_choice_changed", self, "_on_encounter_choice_changed") self.draw_course() -func _process(delta): +func _process(_delta): var s = get_node("Ship") - #print(GameState.ship_stats["target_position"]) + if GameState.ship_stats["target_position"] == null: + GameState.ship_stats["target_position"] = Vector2(0, 0) if s.get_global_position().distance_to(GameState.ship_stats["target_position"]) >= 5: ship_moving = true s.set_global_position(s.get_global_position().move_toward(GameState.ship_stats["target_position"], 5.0)) @@ -92,7 +97,6 @@ func draw_course(): while x < (len(GameState.encounters) - 1): pairs.append([x, x+1]) x += 1 - var paths = [] print(pairs) for p in pairs: var first = get_node("Level" + str(p[0]))