diff --git a/common/game_data/scripts/game_data.gd b/common/game_data/scripts/game_data.gd index 7a9a026..396748f 100644 --- a/common/game_data/scripts/game_data.gd +++ b/common/game_data/scripts/game_data.gd @@ -1,16 +1,28 @@ extends Resource class_name GameData -enum GameMode {STORY} +enum Mode {STORY, INFINITE} signal current_run_updated(r : RunData) signal current_region_data_updated(p : RegionData) - + +func _init( + _game_mode : Mode = Mode.STORY +): + game_mode = _game_mode + if game_mode == Mode.STORY: + progression_data = StoryProgressionData.new() + elif game_mode == Mode.INFINITE: + progression_data = InfiniteProgressionData.new() + + +@export var game_mode : Mode = GameData.Mode.STORY + @export var player_data : PlayerData = PlayerData.new() -@export var progression_data : ProgressionData = ProgressionData.new() +@export var progression_data : ProgressionData -@export var current_run : RunData = start_run() : +@export var current_run : RunData : set(v): current_run = v current_run_updated.emit(v) @@ -30,8 +42,6 @@ signal current_region_data_updated(p : RegionData) @export var item_announced = [] -@export var game_mode : GameMode = GameMode.STORY - @export var dialogs_done : Array[String] = [] #Chemin des dialogues terminés @export var tutorials_done : Array[String] = [] @@ -39,7 +49,7 @@ func start_run() -> RunData: player_data.clear_inventory() player_data.update_with_artefacts([]) current_run = RunData.new() - current_run.story_step = progression_data.story_step.duplicate_deep() + current_run.story_step = progression_data.get_story_step().duplicate_deep() current_run.generate_next_run_points() current_run.current_run_point_changed.connect( func(rp : RunPoint): @@ -59,12 +69,14 @@ func start_region(region_param : RegionParameter): current_region_data = RegionData.new(region_param) func give_up(): + progression_data.finish_run(current_run) current_region_data = null current_run = null start_run() - SceneManager.change_to_scene(progression_data.story_step.get_respawn_scene()) + SceneManager.change_to_scene(progression_data.get_story_step().get_respawn_scene()) func finish_story_step(): + progression_data.finish_run(current_run) progression_data.next_story_step() current_region_data = null start_run() diff --git a/common/game_data/scripts/infinite_progression_data.gd b/common/game_data/scripts/infinite_progression_data.gd new file mode 100644 index 0000000..9c068ee --- /dev/null +++ b/common/game_data/scripts/infinite_progression_data.gd @@ -0,0 +1,29 @@ +extends ProgressionData +class_name InfiniteProgressionData + +func get_story_step() -> StoryStep: + return InfiniteStoryStep.new(run_number) + +func get_story_progression() -> float: + return 0. + +func discover_mutation(_pm : PlantMutation) -> void: + pass + +func get_mutations_discovered() -> Array[String]: + var mutation_discovered : Array[String] = [] + for m in get_all_mutations(): + mutation_discovered.append(m.get_mutation_id()) + return mutation_discovered + +func next_story_step() -> void: + pass + +func are_all_mutations_unlocked() -> bool: + return true + +func unlock_new_mutation() -> PlantMutation: + return null + +func get_available_mutations() -> Array[PlantMutation]: + return get_all_mutations() diff --git a/common/game_data/scripts/infinite_progression_data.gd.uid b/common/game_data/scripts/infinite_progression_data.gd.uid new file mode 100644 index 0000000..5b3cb90 --- /dev/null +++ b/common/game_data/scripts/infinite_progression_data.gd.uid @@ -0,0 +1 @@ +uid://iigxgqiyn0p4 diff --git a/common/game_data/scripts/progression_data.gd b/common/game_data/scripts/progression_data.gd index 1624313..45db3bb 100644 --- a/common/game_data/scripts/progression_data.gd +++ b/common/game_data/scripts/progression_data.gd @@ -1,25 +1,25 @@ +@abstract extends Resource class_name ProgressionData -@export var planted_mutation_ids: Array[String] = [] -@export var story_step_i := 0 -@export var mutations_unlocked = 8 +@export var run_number : int = 0 +@export var best_run : int = 0 -var all_mutations: Array[PlantMutation] : get = get_all_mutations -var available_mutations: Array[PlantMutation] : get = get_available_mutations -var available_artefacts: Array[Artefact] : get = get_all_artifacts -var story_step : StoryStep : get = get_story_step +@abstract func get_story_step() -> StoryStep -func get_story_step() -> StoryStep: - return get_all_story_steps()[story_step_i] +@abstract func get_story_progression() -> float -func next_story_step() -> void: - get_story_step()._on_finish() - if story_step_i + 1 < len(get_all_story_steps()): - story_step_i += 1 +@abstract func next_story_step() -> void -func get_available_mutations() -> Array[PlantMutation]: - return get_all_mutations().slice(0, mutations_unlocked) +@abstract func get_available_mutations() -> Array[PlantMutation] + +@abstract func are_all_mutations_unlocked() -> bool + +@abstract func discover_mutation(_pm : PlantMutation) -> void + +@abstract func get_mutations_discovered() -> Array[String] + +@abstract func unlock_new_mutation() -> PlantMutation func get_all_mutations() -> Array[PlantMutation]: return [ @@ -49,7 +49,6 @@ func get_all_artifacts() -> Array[Artefact]: TalionSoilArtifact.new(), ] - func get_all_story_steps() -> Array[StoryStep]: return [ TutorialStoryStep.new(), @@ -57,3 +56,7 @@ func get_all_story_steps() -> Array[StoryStep]: MercuryStoryStep.new(), BoreaStoryStep.new() ] + +func finish_run(run : RunData): + run_number += 1 + best_run = max(best_run, run.level) diff --git a/common/game_data/scripts/story/infinite_story_step.gd b/common/game_data/scripts/story/infinite_story_step.gd new file mode 100644 index 0000000..9ea6688 --- /dev/null +++ b/common/game_data/scripts/story/infinite_story_step.gd @@ -0,0 +1,36 @@ +@tool +extends StoryStep +class_name InfiniteStoryStep + +var run_number := 0 + +func _init( + _run_number := 0 +): + run_number = _run_number + + +func get_respawn_scene() -> Scene: + return RelayBaseScene.new( + "INFINITE_MODE", + str(run_number), + true + ) + +func get_cave_occurence(_level : int) -> int: + return 0 + +func is_region_sequence_infinite() -> bool: + return true + +func get_region_sequence_length() -> int: + return 1000 + +func is_run_point_dangerous(level : int) -> bool: + return level%6 == 0 and level != 0 + +func get_destination_text() -> String: + return tr("INFINITE") + +func get_destination_scene() -> Scene: + return BoreaScene.new() \ No newline at end of file diff --git a/common/game_data/scripts/story/infinite_story_step.gd.uid b/common/game_data/scripts/story/infinite_story_step.gd.uid new file mode 100644 index 0000000..5e62253 --- /dev/null +++ b/common/game_data/scripts/story/infinite_story_step.gd.uid @@ -0,0 +1 @@ +uid://bdonub7t01xmi diff --git a/common/game_data/scripts/story/story_step.gd b/common/game_data/scripts/story/story_step.gd index 1ba2913..d5f0836 100644 --- a/common/game_data/scripts/story/story_step.gd +++ b/common/game_data/scripts/story/story_step.gd @@ -12,6 +12,8 @@ func get_destination_scene() -> Scene: return BoreaScene.new() func get_run_progress(level : int) -> int: + if is_region_sequence_infinite(): + return 0 return get_region_sequence_length() - level func get_ship_dialog_path(_level : int, _ship_in_space := true) -> String: @@ -19,8 +21,13 @@ func get_ship_dialog_path(_level : int, _ship_in_space := true) -> String: #region ------------------ Run ------------------ func is_run_finished(level : int) -> bool: + if is_region_sequence_infinite(): + return false return level == get_region_sequence_length() - 1 +func is_region_sequence_infinite() -> bool: + return false + func get_region_sequence_length() -> int: return 7 @@ -48,6 +55,8 @@ func get_charge_number(_level : int) -> int: return 10 func is_run_point_dangerous(level : int) -> bool: + if is_region_sequence_infinite(): + return false return level == get_region_sequence_length() - 2 func get_objective_for_region(level : int) -> int: diff --git a/common/game_data/scripts/story/story_steps/1_2_mercury_story_step.gd b/common/game_data/scripts/story/story_steps/1_2_mercury_story_step.gd index 2e96af0..7525732 100644 --- a/common/game_data/scripts/story/story_steps/1_2_mercury_story_step.gd +++ b/common/game_data/scripts/story/story_steps/1_2_mercury_story_step.gd @@ -1,3 +1,4 @@ +@tool extends StoryStep class_name MercuryStoryStep diff --git a/common/game_data/scripts/story_progression_data.gd b/common/game_data/scripts/story_progression_data.gd new file mode 100644 index 0000000..6570b8a --- /dev/null +++ b/common/game_data/scripts/story_progression_data.gd @@ -0,0 +1,36 @@ +extends ProgressionData +class_name StoryProgressionData + +@export var planted_mutation_ids: Array[String] = [] +@export var story_step_i := 0 +@export var mutations_unlocked = 8 + +func get_story_step() -> StoryStep: + return get_all_story_steps()[story_step_i] + +func get_story_progression() -> float: + return max(0,float(story_step_i)) / len( + get_all_story_steps() + ) + +func discover_mutation(pm : PlantMutation) -> void: + planted_mutation_ids.append(pm.id) + +func get_mutations_discovered() -> Array[String]: + return planted_mutation_ids + +func next_story_step() -> void: + get_story_step()._on_finish() + if story_step_i + 1 < len(get_all_story_steps()): + story_step_i += 1 + +func get_available_mutations() -> Array[PlantMutation]: + return get_all_mutations().slice(0, mutations_unlocked) + +func are_all_mutations_unlocked() -> bool: + return mutations_unlocked >= len(get_all_mutations()) + +func unlock_new_mutation() -> PlantMutation: + var new_mutation = get_all_mutations()[mutations_unlocked] + mutations_unlocked += 1 + return new_mutation \ No newline at end of file diff --git a/common/game_data/scripts/story_progression_data.gd.uid b/common/game_data/scripts/story_progression_data.gd.uid new file mode 100644 index 0000000..cf8ce31 --- /dev/null +++ b/common/game_data/scripts/story_progression_data.gd.uid @@ -0,0 +1 @@ +uid://vcoy8pt780cl diff --git a/common/game_info/game_info.gd b/common/game_info/game_info.gd index 17fae0d..3d3b459 100644 --- a/common/game_info/game_info.gd +++ b/common/game_info/game_info.gd @@ -1,35 +1,62 @@ extends Node -const SAVE_GAME_LOCATION = "user://stw_playtest_2_save.tres" +const SAVE_NAME = "playtest_2" + +const SAVE_STORY_GAME_LOCATION = "user://stw_%s_save.tres" % SAVE_NAME +const SAVE_INFINTE_GAME_LOCATION = "user://stw_%s_infinite_save.tres" % SAVE_NAME const SAVE_SETTINGS_LOCATION = "user://stw_settings.tres" signal game_loaded -signal game_data_updated(g : GameData) + +var game_mode_choosen := GameData.Mode.STORY var game_data : GameData : - set(v): - game_data = v - game_data_updated.emit(v) + get(): + if game_mode_choosen == GameData.Mode.STORY: + return story_game_data + elif game_mode_choosen == GameData.Mode.INFINITE: + return infinite_game_data + return null + +var story_game_data : GameData +var infinite_game_data : GameData var settings_data : SettingsData var current_dialog_path : String -func load_game_data() -> GameData: - game_data = null - if ResourceLoader.exists(SAVE_GAME_LOCATION) and ResourceLoader.load(SAVE_GAME_LOCATION): - game_data = ResourceLoader.load(SAVE_GAME_LOCATION).duplicate_deep() +func load_story_game_data() -> GameData: + story_game_data = null + if ResourceLoader.exists(SAVE_STORY_GAME_LOCATION) and ResourceLoader.load(SAVE_STORY_GAME_LOCATION): + story_game_data = ResourceLoader.load(SAVE_STORY_GAME_LOCATION).duplicate_deep() game_loaded.emit() - return game_data + return story_game_data + +func load_infinite_game_data() -> GameData: + infinite_game_data = null + if ResourceLoader.exists(SAVE_INFINTE_GAME_LOCATION) and ResourceLoader.load(SAVE_INFINTE_GAME_LOCATION): + infinite_game_data = ResourceLoader.load(SAVE_INFINTE_GAME_LOCATION).duplicate_deep() + + return infinite_game_data func start_game_data(): - game_data = GameData.new() + if game_mode_choosen == GameData.Mode.STORY: + story_game_data = GameData.new(GameData.Mode.STORY) + story_game_data.start_run() + else: + infinite_game_data = GameData.new(GameData.Mode.INFINITE) + infinite_game_data.start_run() + save_game_data() func save_game_data(): - if game_data: - ResourceSaver.save(game_data, SAVE_GAME_LOCATION) + if game_mode_choosen == GameData.Mode.STORY: + if story_game_data: + ResourceSaver.save(story_game_data, SAVE_STORY_GAME_LOCATION) + elif game_mode_choosen == GameData.Mode.INFINITE: + if infinite_game_data: + ResourceSaver.save(infinite_game_data, SAVE_INFINTE_GAME_LOCATION) func load_settings_data() -> SettingsData: if ResourceLoader.exists(SAVE_SETTINGS_LOCATION): @@ -45,7 +72,8 @@ func save_settings(): ResourceSaver.save(settings_data, SAVE_SETTINGS_LOCATION) func _init(): - load_game_data() + load_story_game_data() + load_infinite_game_data() load_settings_data() update_language_settings() update_video_settings() @@ -91,3 +119,5 @@ func update_inputs(s : SettingsData = settings_data): InputMap.action_erase_events(s.action_remapped[i]) InputMap.action_add_event(s.action_remapped[i], s.input_remapped[i]) +func has_unlocked_infinite_mode(): + return true \ No newline at end of file diff --git a/common/icons/dots.svg b/common/icons/dots.svg new file mode 100644 index 0000000..bba0329 --- /dev/null +++ b/common/icons/dots.svg @@ -0,0 +1,35 @@ + + + + + + + + diff --git a/common/icons/dots.svg.import b/common/icons/dots.svg.import new file mode 100644 index 0000000..fa01baa --- /dev/null +++ b/common/icons/dots.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://elds8r780ted" +path="res://.godot/imported/dots.svg-c5aaef419fc83aaf7bc0ae28dabbcd0f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://common/icons/dots.svg" +dest_files=["res://.godot/imported/dots.svg-c5aaef419fc83aaf7bc0ae28dabbcd0f.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=2.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/entities/interactable_3d/cristal/scripts/cristal.gd b/entities/interactable_3d/cristal/scripts/cristal.gd index 803cc90..b87035a 100644 --- a/entities/interactable_3d/cristal/scripts/cristal.gd +++ b/entities/interactable_3d/cristal/scripts/cristal.gd @@ -35,15 +35,14 @@ func update_model(): func unlock_mutation(): var progression = GameInfo.game_data.progression_data - if progression.mutations_unlocked < len(progression.get_all_mutations()): - var new_mutation : PlantMutation = progression.get_all_mutations()[progression.mutations_unlocked] - progression.mutations_unlocked += 1 + if not progression.are_all_mutations_unlocked(): + var new_mutation : PlantMutation = progression.unlock_new_mutation() get_tree().create_timer(1.).timeout.connect( func (): %MutationAnnounce.announce_mutation = new_mutation ); - if progression.mutations_unlocked == len(progression.get_all_mutations()): + if progression.are_all_mutations_unlocked(): SteamConnection.unlock_achievement(SteamConnection.ACH_UNLOCK_ALL_MUTATION) else: diff --git a/entities/plants/scripts/texture_builder/part_assembler.gd b/entities/plants/scripts/texture_builder/part_assembler.gd index 32164bb..b690e95 100644 --- a/entities/plants/scripts/texture_builder/part_assembler.gd +++ b/entities/plants/scripts/texture_builder/part_assembler.gd @@ -61,7 +61,7 @@ func generate_plants(): elif plant_state == PlantData.State.DEAD: plant_data.day = plant_data.get_lifetime() for j in n_mutation_per_plant: - var picked_mutation: PlantMutation = GameInfo.game_data.progression_data.available_mutations.pick_random().duplicate() + var picked_mutation: PlantMutation = GameInfo.game_data.progression_data.get_available_mutations().pick_random().duplicate() picked_mutation.level = randi_range(min_level, max_level) plant_data.mutations.append(picked_mutation) var plant: Plant = Plant.new(plant_data) diff --git a/entities/player/inventory/scripts/items/seed.gd b/entities/player/inventory/scripts/items/seed.gd index c75f4c5..61184de 100644 --- a/entities/player/inventory/scripts/items/seed.gd +++ b/entities/player/inventory/scripts/items/seed.gd @@ -174,7 +174,7 @@ static func generate_first_mutations(rarity := 0) -> Array[PlantMutation]: if rarity < 0: return [] - var possible_mutation : PlantMutation = GameInfo.game_data.progression_data.available_mutations.filter( + var possible_mutation : PlantMutation = GameInfo.game_data.progression_data.get_available_mutations().filter( func (m : PlantMutation): return m.get_base_rarity() <= rarity ).pick_random().duplicate_deep() @@ -211,7 +211,7 @@ class MutationPossibility: class AddMutation extends MutationPossibility: func mutate(mutations : Array[PlantMutation])-> Array[PlantMutation]: var new_mutations = mutations.duplicate_deep() - var possible_new_mutations = GameInfo.game_data.progression_data.available_mutations.duplicate_deep() + var possible_new_mutations = GameInfo.game_data.progression_data.get_available_mutations().duplicate_deep() possible_new_mutations = possible_new_mutations.filter( func (m : PlantMutation): diff --git a/gui/game/scripts/game_gui.gd b/gui/game/scripts/game_gui.gd index b839d9f..e87a10c 100644 --- a/gui/game/scripts/game_gui.gd +++ b/gui/game/scripts/game_gui.gd @@ -95,7 +95,7 @@ func score_update(with_animation = true): func state_update(region_data : RegionData): if region_data.state == RegionData.State.SUCCEEDED: objective_text = "COLLECT_YOUR_SEEDS_AND_TAKE_OFF" - if GameInfo.game_data.current_run.story_step is TutorialStoryStep: + if GameInfo.game_data.current_run.get_st is TutorialStoryStep: objective_text = "PASS_THE_MYSTERIOUS_DOOR" elif region_data.state == RegionData.State.FAILED: objective_text = "NO_RECHARGE_LEFT" diff --git a/gui/pause/pause.tscn b/gui/pause/pause.tscn index 640d565..842f3e8 100644 --- a/gui/pause/pause.tscn +++ b/gui/pause/pause.tscn @@ -8,6 +8,7 @@ [ext_resource type="Texture2D" uid="uid://cixd5j8yqpavg" path="res://common/icons/settings.svg" id="6_yj6f1"] [ext_resource type="Texture2D" uid="uid://bkwhrq4sp5dcp" path="res://common/icons/device-gamepad.svg" id="7_7c7ks"] [ext_resource type="Texture2D" uid="uid://dex283rx00fjb" path="res://common/icons/logout.svg" id="7_yj6f1"] +[ext_resource type="Texture2D" uid="uid://bcjkds8n5qu6x" path="res://common/icons/rotate-rectangle.svg" id="8_5hfp2"] [ext_resource type="Texture2D" uid="uid://b43thuq8piv18" path="res://common/icons/skull.svg" id="8_mnkqy"] [ext_resource type="PackedScene" uid="uid://b4qe1dwwsk87t" path="res://gui/menu/controls/controls.tscn" id="11_urlqn"] @@ -155,6 +156,11 @@ layout_mode = 2 text = "GIVE_UP" icon = ExtResource("8_mnkqy") +[node name="TitleScreen" type="Button" parent="Container/MarginContainer/Pause/HBoxContainer" unique_id=1549423194] +layout_mode = 2 +text = "RETURN_TO_TITLE_SCREEN" +icon = ExtResource("8_5hfp2") + [node name="Quit" type="Button" parent="Container/MarginContainer/Pause/HBoxContainer" unique_id=1740895928] layout_mode = 2 text = "QUIT" @@ -185,4 +191,5 @@ libraries/ = SubResource("AnimationLibrary_yj6f1") [connection signal="pressed" from="Container/MarginContainer/Pause/HBoxContainer/Settings" to="." method="_on_settings_pressed"] [connection signal="pressed" from="Container/MarginContainer/Pause/HBoxContainer/Controls" to="." method="_on_controls_pressed"] [connection signal="pressed" from="Container/MarginContainer/Pause/HBoxContainer/GiveUp" to="." method="_on_give_up_pressed"] +[connection signal="pressed" from="Container/MarginContainer/Pause/HBoxContainer/TitleScreen" to="." method="_on_title_screen_pressed"] [connection signal="pressed" from="Container/MarginContainer/Pause/HBoxContainer/Quit" to="." method="_on_quit_pressed"] diff --git a/gui/pause/scripts/pause.gd b/gui/pause/scripts/pause.gd index 0f44f00..3f9454e 100644 --- a/gui/pause/scripts/pause.gd +++ b/gui/pause/scripts/pause.gd @@ -62,3 +62,7 @@ func _on_give_up_pressed(): if GameInfo.game_data: GameInfo.game_data.give_up() pause = false + +func _on_title_screen_pressed(): + SceneManager.change_to_scene(TitleScene.new()) + pause = false diff --git a/gui/pointer/scripts/pointer.gd b/gui/pointer/scripts/pointer.gd index f9e3cae..545599b 100644 --- a/gui/pointer/scripts/pointer.gd +++ b/gui/pointer/scripts/pointer.gd @@ -129,7 +129,7 @@ func process_player_actions(delta: float): and current_selected_item.is_action_need_press_time() and not press_action_done and not can_interact - and not inspected is InventoryGuiItemMouseDetector + and not (inspected and inspected is InventoryGuiItemMouseDetector) ): %ActionProgressBar.value = press_time / current_selected_item.get_action_press_time() * 100 if not %ActionProgressPlayer.playing: diff --git a/stages/3d_scenes/astra_base/scripts/astra_base.gd b/stages/3d_scenes/astra_base/scripts/astra_base.gd index 7d6b8aa..6987634 100644 --- a/stages/3d_scenes/astra_base/scripts/astra_base.gd +++ b/stages/3d_scenes/astra_base/scripts/astra_base.gd @@ -50,7 +50,7 @@ func story(): AudioManager.play_sfx("Respawn") if ( - GameInfo.game_data.progression_data.story_step is TutorialStoryStep + GameInfo.game_data.progression_data.get_story_step() is TutorialStoryStep and not TutorialStoryStep.INTRO_DIALOG in GameInfo.game_data.dialogs_done ): %Phone.play_audio() @@ -80,7 +80,7 @@ func story(): func finish_scene(): GameInfo.game_data.start_run() - if GameInfo.game_data.progression_data.story_step is TutorialStoryStep: + if GameInfo.game_data.progression_data.get_story_step() is TutorialStoryStep: GameInfo.game_data.current_run.choose_next_run_point() SceneManager.change_to_scene(RegionScene.new(GameInfo.game_data.current_region_data)) else: diff --git a/stages/3d_scenes/backrooms/backrooms.tscn b/stages/3d_scenes/backrooms/backrooms.tscn index 43981a9..a3f1324 100644 --- a/stages/3d_scenes/backrooms/backrooms.tscn +++ b/stages/3d_scenes/backrooms/backrooms.tscn @@ -32,9 +32,4 @@ visible = false [node name="InteractTutorial" parent="Player3D/CanvasLayer/3dTutorial" parent_id_path=PackedInt32Array(549819967, 259323543) index="1" unique_id=1117243867] visible = false -[node name="Camera3D" type="Camera3D" parent="." unique_id=281886327] -transform = Transform3D(-0.98900557, 0.015714146, -0.14704114, -9.0072927e-10, 0.99433786, 0.10626406, 0.14787856, 0.10509577, -0.9834057, -2.3532534, 1.3807694, -30.463974) -current = true -fov = 90.9 - [editable path="Player3D"] diff --git a/stages/3d_scenes/cockpit_scene/cockpit.tscn b/stages/3d_scenes/cockpit_scene/cockpit.tscn index 2906b4a..9644227 100644 --- a/stages/3d_scenes/cockpit_scene/cockpit.tscn +++ b/stages/3d_scenes/cockpit_scene/cockpit.tscn @@ -11,6 +11,7 @@ [ext_resource type="PackedScene" uid="uid://dd6k80rhux1do" path="res://stages/3d_scenes/cockpit_scene/cockpit_elements/plant_info_screen.tscn" id="12_pxmsf"] [ext_resource type="PackedScene" uid="uid://da7a74dg30q1l" path="res://entities/player_3d/player_3D.tscn" id="13_a2cx2"] [ext_resource type="PackedScene" uid="uid://cd8j7v7qtybi8" path="res://stages/3d_scenes/cockpit_scene/ship_tutorial.tscn" id="13_u7lr8"] +[ext_resource type="PackedScene" uid="uid://dxap4l7udy5ek" path="res://stages/3d_scenes/cockpit_scene/cockpit_elements/infinite_mode_screen/infinite_mode_screen.tscn" id="13_wrlf0"] [ext_resource type="Material" uid="uid://cr7bp4fhh1ipr" path="res://entities/player_3d/resources/materials/post_process_quad.tres" id="14_d1blr"] [ext_resource type="PackedScene" uid="uid://ci4x1q326lvyy" path="res://stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/mutation_discovery_screen.tscn" id="15_q4ojn"] [ext_resource type="PackedScene" uid="uid://cn2hob1i72a25" path="res://stages/3d_scenes/cockpit_scene/fail_tutorial.tscn" id="15_wrlf0"] @@ -202,8 +203,14 @@ unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.239, 0, 4.02) [node name="MutationDiscoveryScreen" parent="." unique_id=1948337200 instance=ExtResource("15_q4ojn")] +unique_name_in_owner = true transform = Transform3D(-1, 0, 8.742278e-08, 0, 1, 0, -8.742278e-08, 0, -1, 1.1896521, 0.015508115, 3.982) +[node name="InfiniteModeScreen" parent="." unique_id=1282307433 instance=ExtResource("13_wrlf0")] +unique_name_in_owner = true +transform = Transform3D(-1, 0, 1.509958e-07, 0, 1, 0, -1.509958e-07, 0, -1, 1.1896521, 0.015508115, 3.982) +visible = false + [node name="ShipTutorial" parent="." unique_id=868547496 node_paths=PackedStringArray("player") instance=ExtResource("13_u7lr8")] unique_name_in_owner = true player = NodePath("../Player3D") diff --git a/stages/3d_scenes/cockpit_scene/cockpit_elements/dashboard.tscn b/stages/3d_scenes/cockpit_scene/cockpit_elements/dashboard.tscn index 52543e4..cd3d49e 100644 --- a/stages/3d_scenes/cockpit_scene/cockpit_elements/dashboard.tscn +++ b/stages/3d_scenes/cockpit_scene/cockpit_elements/dashboard.tscn @@ -241,6 +241,7 @@ size = Vector2i(1000, 512) [node name="TravelScreenContent" parent="TravelScreen/SubViewport" unique_id=1386845472 instance=ExtResource("17_emtfq")] unique_name_in_owner = true current_position = 4.0 +start = 4 [node name="StatusScreen" type="Sprite3D" parent="." unique_id=1257606535] unique_name_in_owner = true diff --git a/stages/3d_scenes/cockpit_scene/cockpit_elements/infinite_mode_screen/infinite_mode_screen.tscn b/stages/3d_scenes/cockpit_scene/cockpit_elements/infinite_mode_screen/infinite_mode_screen.tscn new file mode 100644 index 0000000..30052d3 --- /dev/null +++ b/stages/3d_scenes/cockpit_scene/cockpit_elements/infinite_mode_screen/infinite_mode_screen.tscn @@ -0,0 +1,109 @@ +[gd_scene format=3 uid="uid://dxap4l7udy5ek"] + +[ext_resource type="Script" uid="uid://c1pmeo36i3ltn" path="res://stages/3d_scenes/cockpit_scene/cockpit_elements/infinite_mode_screen/scripts/infinite_mode_screen.gd" id="1_ubdy2"] +[ext_resource type="Texture2D" uid="uid://sdrr43mek1cl" path="res://common/icons/globe.svg" id="2_fuw08"] +[ext_resource type="Texture2D" uid="uid://uckrw5fan88k" path="res://common/icons/flag-2.svg" id="4_fuw08"] +[ext_resource type="FontFile" uid="uid://qt80w6o01q5s" path="res://gui/ressources/fonts/TitanOne-Regular.ttf" id="6_8ylkf"] +[ext_resource type="PackedScene" uid="uid://i28ngc4hgq85" path="res://stages/3d_scenes/cockpit_scene/assets/3d/furnitures/screen.blend" id="7_sftbg"] + +[sub_resource type="ViewportTexture" id="ViewportTexture_c5x8t"] +viewport_path = NodePath("Sprite3D/SubViewport") + +[sub_resource type="LabelSettings" id="LabelSettings_5jpjd"] +font = ExtResource("6_8ylkf") +font_size = 40 + +[sub_resource type="LabelSettings" id="LabelSettings_ye21k"] +font = ExtResource("6_8ylkf") +font_size = 100 + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_wrlf0"] + +[node name="InfiniteModeScreen" type="Node3D" unique_id=1881622243] +script = ExtResource("1_ubdy2") + +[node name="Sprite3D" type="Sprite3D" parent="." unique_id=1624784968] +transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -0.011004657, 0, 0) +pixel_size = 0.001 +texture = SubResource("ViewportTexture_c5x8t") + +[node name="SubViewport" type="SubViewport" parent="Sprite3D" unique_id=1689184715] +disable_3d = true +transparent_bg = true +size = Vector2i(813, 592) + +[node name="VBoxContainer" type="VBoxContainer" parent="Sprite3D/SubViewport" unique_id=1462242714] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +theme_override_constants/separation = 16 +alignment = 1 + +[node name="ActualDistanceTitle" type="HBoxContainer" parent="Sprite3D/SubViewport/VBoxContainer" unique_id=100436141] +layout_mode = 2 +size_flags_vertical = 4 +alignment = 1 + +[node name="TextureRect" type="TextureRect" parent="Sprite3D/SubViewport/VBoxContainer/ActualDistanceTitle" unique_id=1852125670] +custom_minimum_size = Vector2(100, 100) +layout_mode = 2 +size_flags_vertical = 4 +texture = ExtResource("2_fuw08") +expand_mode = 1 +stretch_mode = 5 + +[node name="ActualDistanceTitleLabel" type="Label" parent="Sprite3D/SubViewport/VBoxContainer/ActualDistanceTitle" unique_id=1148366912] +layout_mode = 2 +size_flags_vertical = 1 +text = "ACTUAL_DISTANCE" +label_settings = SubResource("LabelSettings_5jpjd") +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="ActualDistanceValue" type="Label" parent="Sprite3D/SubViewport/VBoxContainer" unique_id=691842407] +unique_name_in_owner = true +layout_mode = 2 +size_flags_vertical = 1 +text = "0" +label_settings = SubResource("LabelSettings_ye21k") +horizontal_alignment = 1 +autowrap_mode = 3 + +[node name="HSeparator" type="HSeparator" parent="Sprite3D/SubViewport/VBoxContainer" unique_id=464982333] +layout_mode = 2 +theme_override_styles/separator = SubResource("StyleBoxEmpty_wrlf0") + +[node name="BestDistanceTitle" type="HBoxContainer" parent="Sprite3D/SubViewport/VBoxContainer" unique_id=906856317] +layout_mode = 2 +size_flags_vertical = 4 +alignment = 1 + +[node name="TextureRect" type="TextureRect" parent="Sprite3D/SubViewport/VBoxContainer/BestDistanceTitle" unique_id=1113494421] +custom_minimum_size = Vector2(100, 100) +layout_mode = 2 +size_flags_vertical = 4 +texture = ExtResource("4_fuw08") +expand_mode = 1 +stretch_mode = 5 + +[node name="BestDistanceTitleLabel" type="Label" parent="Sprite3D/SubViewport/VBoxContainer/BestDistanceTitle" unique_id=2111278269] +layout_mode = 2 +size_flags_vertical = 1 +text = "BEST_DISTANCE" +label_settings = SubResource("LabelSettings_5jpjd") +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="BestDistanceValue" type="Label" parent="Sprite3D/SubViewport/VBoxContainer" unique_id=44844379] +unique_name_in_owner = true +layout_mode = 2 +size_flags_vertical = 1 +text = "0" +label_settings = SubResource("LabelSettings_ye21k") +horizontal_alignment = 1 +autowrap_mode = 3 + +[node name="ScreenModel" parent="." unique_id=1871285491 instance=ExtResource("7_sftbg")] diff --git a/stages/3d_scenes/cockpit_scene/cockpit_elements/infinite_mode_screen/scripts/infinite_mode_screen.gd b/stages/3d_scenes/cockpit_scene/cockpit_elements/infinite_mode_screen/scripts/infinite_mode_screen.gd new file mode 100644 index 0000000..d3ca0dd --- /dev/null +++ b/stages/3d_scenes/cockpit_scene/cockpit_elements/infinite_mode_screen/scripts/infinite_mode_screen.gd @@ -0,0 +1,39 @@ +@tool +extends Node3D +class_name InfiniteModeScreen + +const YELLOW_COLOR = Color("e29f32") + +@export var actual_distance : int = 0 : + set(v): + actual_distance = v + update() +@export var best_distance : int = 0 : + set(v): + best_distance = v + update() +@export var colored_distance : bool = false : + set(v): + colored_distance = v + update() + +func _ready(): + if not Engine.is_editor_hint(): + fetch_game_values() + update() + +func fetch_game_values() -> void: + actual_distance = GameInfo.game_data.current_run.level * 100 + best_distance = max( + GameInfo.game_data.current_run.level * 100, + GameInfo.game_data.progression_data.best_run * 100 + ) + colored_distance = actual_distance == best_distance + +func update(): + if is_node_ready(): + %ActualDistanceValue.text = str(actual_distance) + %BestDistanceValue.text = str(best_distance) + + %ActualDistanceValue.modulate = YELLOW_COLOR if colored_distance else Color.WHITE + %BestDistanceValue.modulate = YELLOW_COLOR if colored_distance else Color.WHITE diff --git a/stages/3d_scenes/cockpit_scene/cockpit_elements/infinite_mode_screen/scripts/infinite_mode_screen.gd.uid b/stages/3d_scenes/cockpit_scene/cockpit_elements/infinite_mode_screen/scripts/infinite_mode_screen.gd.uid new file mode 100644 index 0000000..a903547 --- /dev/null +++ b/stages/3d_scenes/cockpit_scene/cockpit_elements/infinite_mode_screen/scripts/infinite_mode_screen.gd.uid @@ -0,0 +1 @@ +uid://c1pmeo36i3ltn diff --git a/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/scripts/mutation_discovery_screen.gd b/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/scripts/mutation_discovery_screen.gd index a847218..d698cbe 100644 --- a/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/scripts/mutation_discovery_screen.gd +++ b/stages/3d_scenes/cockpit_scene/cockpit_elements/mutation_discovered_screen/scripts/mutation_discovery_screen.gd @@ -12,9 +12,9 @@ const MUTATION_DISCOVERY_ELEMENT_SCENE = preload("res://stages/3d_scenes/cockpit # Called when the node enters the scene tree for the first time. func _ready(): if not Engine.is_editor_hint(): - all_mutations = GameInfo.game_data.progression_data.all_mutations - mutations_unlocked = GameInfo.game_data.progression_data.mutations_unlocked - planted_mutation_ids = GameInfo.game_data.progression_data.planted_mutation_ids + all_mutations = GameInfo.game_data.progression_data.get_all_mutations() + mutations_unlocked = len(GameInfo.game_data.progression_data.get_available_mutations()) + planted_mutation_ids = GameInfo.game_data.progression_data.get_mutations_discovered() update() func update(): diff --git a/stages/3d_scenes/cockpit_scene/cockpit_elements/travel_screen/scripts/travel_screen_content.gd b/stages/3d_scenes/cockpit_scene/cockpit_elements/travel_screen/scripts/travel_screen_content.gd index 477bc93..77ce80a 100644 --- a/stages/3d_scenes/cockpit_scene/cockpit_elements/travel_screen/scripts/travel_screen_content.gd +++ b/stages/3d_scenes/cockpit_scene/cockpit_elements/travel_screen/scripts/travel_screen_content.gd @@ -7,6 +7,7 @@ const START_ICON = preload("res://common/icons/device-floppy.svg") const REGION_ICON = preload("res://common/icons/globe.svg") const DESTINATION_ICON = preload("res://common/icons/flag-2.svg") const DANGER_ICON = preload("res://common/icons/alert-triangle.svg") +const AND_MORE_ICON = preload("res://common/icons/dots.svg") const PREVIOUS_COLOR = Color("2364AAAA") const CURRENT_COLOR = Color("e29f32") @@ -14,53 +15,78 @@ const NEXT_COLOR = Color("96B3DB") const WIDTH = 800 const V_DIST = 50 +const ANIMATION_SPEED := 5.0 +const MAX_STEP = 8 @export_tool_button("Update", "Callable") var update_action = update +@export_tool_button("Update recreate", "Callable") var update_recreate_action = func (): update(true, true) @export var current_position : float = 0 @export var story_step : StoryStep +@export var start : int = 0 func _ready(): - update() + update(false, true) var ship_icon : Sprite2D -func update(with_animation := true): +func update(with_animation := true, recreate_map = false): + if is_node_ready() and story_step: + if recreate_map or not ship_icon: + + if story_step and get_step_number() < story_step.get_region_sequence_length(): + start = floori(current_position) + else: + start = 0 + + for c in %Icons.get_children(): + c.queue_free() + + for i in range(get_step_number()): + var level = i + start + var icon = REGION_ICON + if story_step and level == 0: + icon = START_ICON + elif story_step and level == story_step.get_region_sequence_length() - 1: + icon = DESTINATION_ICON + + var color = NEXT_COLOR + if level < current_position - start: + color = PREVIOUS_COLOR + elif level == current_position - start: + color = CURRENT_COLOR + + var modifiers := story_step.get_story_modifiers_for_region(level) + modifiers.append_array(story_step.get_gameplay_modifiers_for_region(level)) + for m_i in range(len(modifiers)): + spawn_icon(modifiers[m_i].get_icon(), Vector2(i,-m_i - 1),color, 0.7) + + if story_step.is_run_point_dangerous(level): + spawn_icon(DANGER_ICON, Vector2(i,-len(modifiers) - 1),color, 0.7) + + spawn_icon(icon, Vector2(i,0),color) + + ship_icon = spawn_icon(SHIP_ICON, Vector2(current_position - start, 1), CURRENT_COLOR, 1) + + if story_step and get_step_number() + start < story_step.get_region_sequence_length(): + spawn_icon(AND_MORE_ICON, Vector2(get_step_number(), 0), NEXT_COLOR) + if ship_icon and with_animation: var tween = create_tween() tween.set_trans(Tween.TRANS_SPRING) - tween.tween_property(ship_icon,"position",coord_to_pos(Vector2(current_position, 1)),5.) - + tween.tween_property(ship_icon,"position",coord_to_pos(Vector2(current_position - start, 1)),ANIMATION_SPEED) + await tween.finished - - for c in %Icons.get_children(): - c.queue_free() - for i in range(get_step_number()): - var icon = REGION_ICON - if i == 0: - icon = START_ICON - elif i == get_step_number() - 1: - icon = DESTINATION_ICON + for icon in %Icons.get_children(): + var color = NEXT_COLOR + if icon.position.x < ship_icon.position.x: + color = PREVIOUS_COLOR + elif icon.position.x == ship_icon.position.x: + color = CURRENT_COLOR + icon.modulate = color - var color = NEXT_COLOR - if i < current_position: - color = PREVIOUS_COLOR - elif i == current_position: - color = CURRENT_COLOR - - var modifiers := story_step.get_story_modifiers_for_region(i) - modifiers.append_array(story_step.get_gameplay_modifiers_for_region(i)) - for m_i in range(len(modifiers)): - spawn_icon(modifiers[m_i].get_icon(), Vector2(i,-m_i - 1),color, 0.7) - - if story_step.is_run_point_dangerous(i): - spawn_icon(DANGER_ICON, Vector2(i,-len(modifiers) - 1),color, 0.7) - - spawn_icon(icon, Vector2(i,0),color) - - ship_icon = spawn_icon(SHIP_ICON, Vector2(current_position, 1), CURRENT_COLOR, 1) func spawn_icon(texture : Texture, coord := Vector2.ZERO, color := Color.WHITE, scaling := 1.) -> Sprite2D: var new_icon = Sprite2D.new() @@ -76,7 +102,7 @@ func spawn_icon(texture : Texture, coord := Vector2.ZERO, color := Color.WHITE, func get_step_number() -> int: if story_step: - return story_step.get_region_sequence_length() + return min(story_step.get_region_sequence_length(), MAX_STEP) return 0 func coord_to_pos(coord : Vector2) -> Vector2: diff --git a/stages/3d_scenes/cockpit_scene/cockpit_elements/travel_screen/topology_content.tscn b/stages/3d_scenes/cockpit_scene/cockpit_elements/travel_screen/topology_content.tscn index 03bf369..7ff3ef0 100644 --- a/stages/3d_scenes/cockpit_scene/cockpit_elements/travel_screen/topology_content.tscn +++ b/stages/3d_scenes/cockpit_scene/cockpit_elements/travel_screen/topology_content.tscn @@ -7,6 +7,7 @@ shader = ExtResource("1_5gx2n") shader_parameter/line_number = 6.0 shader_parameter/line_color = Color(0.13725491, 0.39215687, 0.6666667, 1) shader_parameter/line_thickness = 0.002000000095 +shader_parameter/inverse_result = false [sub_resource type="FastNoiseLite" id="FastNoiseLite_psxhb"] noise_type = 2 diff --git a/stages/3d_scenes/cockpit_scene/cockpit_elements/travel_screen/travel_screen_content.tscn b/stages/3d_scenes/cockpit_scene/cockpit_elements/travel_screen/travel_screen_content.tscn index 954a28b..1fd12e5 100644 --- a/stages/3d_scenes/cockpit_scene/cockpit_elements/travel_screen/travel_screen_content.tscn +++ b/stages/3d_scenes/cockpit_scene/cockpit_elements/travel_screen/travel_screen_content.tscn @@ -1,11 +1,18 @@ [gd_scene format=3 uid="uid://dj4u5grx00ky1"] [ext_resource type="Script" uid="uid://r1gn83h8re8m" path="res://stages/3d_scenes/cockpit_scene/cockpit_elements/travel_screen/scripts/travel_screen_content.gd" id="1_u6tks"] +[ext_resource type="Script" uid="uid://bdonub7t01xmi" path="res://common/game_data/scripts/story/infinite_story_step.gd" id="2_xeca8"] + +[sub_resource type="Resource" id="Resource_iergx"] +script = ExtResource("2_xeca8") +metadata/_custom_type_script = "uid://bdonub7t01xmi" [node name="TravelScreenContent" type="Node2D" unique_id=1386845472] position = Vector2(500, 256) script = ExtResource("1_u6tks") -current_position = 2.0 +current_position = 3.0 +story_step = SubResource("Resource_iergx") +start = 2 [node name="Icons" type="Node2D" parent="." unique_id=1787603855] unique_name_in_owner = true diff --git a/stages/3d_scenes/cockpit_scene/scripts/cockpit.gd b/stages/3d_scenes/cockpit_scene/scripts/cockpit.gd index d96f5d9..a465de3 100644 --- a/stages/3d_scenes/cockpit_scene/scripts/cockpit.gd +++ b/stages/3d_scenes/cockpit_scene/scripts/cockpit.gd @@ -35,10 +35,9 @@ func _ready(): if not "ship" in GameInfo.game_data.tutorials_done: await get_tree().create_timer(1).timeout %ShipTutorial.appear() - - if GameInfo.game_data.game_mode == GameData.GameMode.STORY: - update_dialogs() + %MutationDiscoveryScreen.visible = GameInfo.game_data.game_mode == GameData.Mode.STORY + %InfiniteModeScreen.visible = GameInfo.game_data.game_mode == GameData.Mode.INFINITE func update_dialogs(): if GameInfo.game_data and GameInfo.game_data.current_run: @@ -87,6 +86,7 @@ func _on_phone_clicked(): func move_to_choosen_run_point(): GameInfo.game_data.current_run.choose_next_run_point(choosen_run_point) + %InfiniteModeScreen.fetch_game_values() func can_exit() -> bool: return ( diff --git a/stages/3d_scenes/cockpit_scene/scripts/cockpit_scene.gd b/stages/3d_scenes/cockpit_scene/scripts/cockpit_scene.gd index 7cb5dea..2960e66 100644 --- a/stages/3d_scenes/cockpit_scene/scripts/cockpit_scene.gd +++ b/stages/3d_scenes/cockpit_scene/scripts/cockpit_scene.gd @@ -6,12 +6,7 @@ func _ready(): %TakeOffAnimationPlayer.play("TookOff") if GameInfo.game_data: - %Planet3d.fertility_factor = ( - max(0,float(GameInfo.game_data.progression_data.story_step_i - 1)) - / len( - GameInfo.game_data.progression_data.get_all_story_steps() - ) - 1 - ) + %Planet3d.fertility_factor = (GameInfo.game_data.progression_data.get_story_progression()) %Ship.take_off.connect(_on_ship_take_off) %Ship.land.connect(_on_ship_land) diff --git a/stages/3d_scenes/vending_machine_room/scripts/vending_machine_room.gd b/stages/3d_scenes/vending_machine_room/scripts/vending_machine_room.gd index e9e3a88..73e8206 100644 --- a/stages/3d_scenes/vending_machine_room/scripts/vending_machine_room.gd +++ b/stages/3d_scenes/vending_machine_room/scripts/vending_machine_room.gd @@ -10,7 +10,7 @@ func setup_room(door_id : int): var all_vending_machines = %VendingMachines.get_children() as Array[VendingMachine3d] var vending_machine : VendingMachine3d = all_vending_machines[rng.randi()%len(all_vending_machines)] - var available_artefacts = GameInfo.game_data.progression_data.available_artefacts + var available_artefacts = GameInfo.game_data.progression_data.get_all_artifacts() var artefacts = [] while len(artefacts) < 2: diff --git a/stages/terrain/region/scripts/region.gd b/stages/terrain/region/scripts/region.gd index 5c80960..949e6d6 100644 --- a/stages/terrain/region/scripts/region.gd +++ b/stages/terrain/region/scripts/region.gd @@ -271,8 +271,8 @@ func plant( add_entity(new_plant, plant_position) for m in new_plant_data.mutations: - if not m.get_mutation_id() in GameInfo.game_data.progression_data.planted_mutation_ids: - GameInfo.game_data.progression_data.planted_mutation_ids.append(m.get_mutation_id()) + if not m.get_mutation_id() in GameInfo.game_data.progression_data.get_mutations_discovered(): + GameInfo.game_data.progression_data.discover_mutation(m) return true diff --git a/stages/title_screen/scripts/title_screen.gd b/stages/title_screen/scripts/title_screen.gd index 9ef408d..6a5fb96 100644 --- a/stages/title_screen/scripts/title_screen.gd +++ b/stages/title_screen/scripts/title_screen.gd @@ -14,7 +14,9 @@ var planet_spin_ach_sended = false func _ready(): %Version.text = ProjectSettings.get_setting("application/config/version") - %Start.text = tr("CONTINUE") if GameInfo.game_data else tr("START") + %Start.text = tr("CONTINUE") if GameInfo.story_game_data else tr("START") + %StartInfinite.visible = GameInfo.has_unlocked_infinite_mode() + %StartInfinite.text = tr("INFINITE_MODE") %Restart.visible = GameInfo.game_data != null %Settings.close_settings() %Controls.close_controls() @@ -27,6 +29,7 @@ func _ready(): decontaminate_3D_planet(GameInfo.game_data) func _on_start_pressed(): + GameInfo.game_mode_choosen = GameData.Mode.STORY if GameInfo.game_data : if GameInfo.game_data.last_game_scene: SceneManager.change_to_scene(GameInfo.game_data.last_game_scene) @@ -38,11 +41,8 @@ func _on_start_pressed(): func decontaminate_3D_planet(game_data): %Planet3d.fertility_factor = ( - max(0,float(GameInfo.game_data.progression_data.story_step_i)) - / len( - GameInfo.game_data.progression_data.get_all_story_steps() - ) - ) + GameInfo.game_data.progression_data.get_story_progression() + ) func _process(delta): next_mouse_pos = get_viewport().get_mouse_position() @@ -76,6 +76,7 @@ func _process(delta): func _on_restart_button_down(): + GameInfo.game_mode_choosen = GameData.Mode.STORY GameInfo.start_game_data() SceneManager.change_to_scene(IntroScene.new()) @@ -88,3 +89,15 @@ func _on_controls_button_down(): func _on_quit_button_down(): get_tree().quit() +func _on_start_infinite_pressed(): + GameInfo.game_mode_choosen = GameData.Mode.INFINITE + if GameInfo.game_data : + if GameInfo.game_data.last_game_scene: + SceneManager.change_to_scene(GameInfo.game_data.last_game_scene) + else : + SceneManager.change_to_scene(CockpitScene.new()) + else: + GameInfo.start_game_data() + SceneManager.change_to_scene( + GameInfo.game_data.progression_data.get_story_step().get_respawn_scene() + ) diff --git a/stages/title_screen/title_screen.tscn b/stages/title_screen/title_screen.tscn index 06bff4a..1dd910d 100644 --- a/stages/title_screen/title_screen.tscn +++ b/stages/title_screen/title_screen.tscn @@ -3,8 +3,8 @@ [ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/hud.tres" id="1_4ph5l"] [ext_resource type="Script" uid="uid://cwmp2une7hobe" path="res://stages/title_screen/scripts/title_screen.gd" id="1_6yuhi"] [ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="3_6yuhi"] -[ext_resource type="Texture2D" uid="uid://cdpqg3pkjcw2h" path="res://stages/title_screen/assets/textures/title.png" id="3_lwj2x"] [ext_resource type="Texture2D" uid="uid://cvvnrj8wi3f3r" path="res://common/icons/brand-twitch.svg" id="3_gn4uv"] +[ext_resource type="Texture2D" uid="uid://cdpqg3pkjcw2h" path="res://stages/title_screen/assets/textures/title.png" id="3_lwj2x"] [ext_resource type="FontFile" uid="uid://qt80w6o01q5s" path="res://gui/ressources/fonts/TitanOne-Regular.ttf" id="4_ofiho"] [ext_resource type="Texture2D" uid="uid://bewr0t1wi8pff" path="res://common/icons/rotate.svg" id="5_6yuhi"] [ext_resource type="PackedScene" uid="uid://cm5b7w7j6527f" path="res://stages/title_screen/planet_3d.tscn" id="5_7a1qq"] @@ -66,48 +66,12 @@ _data = { &"bounce": SubResource("Animation_0vds4") } -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_rf16a"] -bg_color = Color(1, 0, 0.43137255, 1) -border_width_left = 10 -border_width_top = 10 -border_width_right = 10 -border_width_bottom = 10 -border_color = Color(1, 0, 0.43137255, 1) -corner_radius_top_left = 5 -corner_radius_top_right = 5 -corner_radius_bottom_right = 5 -corner_radius_bottom_left = 5 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gn4uv"] -bg_color = Color(0.78039217, 0, 0.3372549, 1) -border_width_left = 10 -border_width_top = 10 -border_width_right = 10 -border_width_bottom = 10 -border_color = Color(0.78, 0, 0.33800003, 1) -corner_radius_top_left = 5 -corner_radius_top_right = 5 -corner_radius_bottom_right = 5 -corner_radius_bottom_left = 5 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ofiho"] -bg_color = Color(1, 0.24000001, 0.5693334, 1) -border_width_left = 10 -border_width_top = 10 -border_width_right = 10 -border_width_bottom = 10 -border_color = Color(1, 0.23921569, 0.5686275, 1) -corner_radius_top_left = 5 -corner_radius_top_right = 5 -corner_radius_bottom_right = 5 -corner_radius_bottom_left = 5 - [sub_resource type="ShaderMaterial" id="ShaderMaterial_lwj2x"] shader = ExtResource("8_pjo5j") shader_parameter/strength = 5.00000023424012 shader_parameter/mix_percentage = 0.3 -[sub_resource type="FastNoiseLite" id="FastNoiseLite_rf16a"] +[sub_resource type="FastNoiseLite" id="FastNoiseLite_gn4uv"] frequency = 1.0 [sub_resource type="Animation" id="Animation_gn4uv"] @@ -207,6 +171,18 @@ tracks/7/keys = { "update": 1, "values": [1.0] } +tracks/8/type = "value" +tracks/8/imported = false +tracks/8/enabled = true +tracks/8/path = NodePath("%StartInfinite:modulate:a") +tracks/8/interp = 1 +tracks/8/loop_wrap = true +tracks/8/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [1.0] +} [sub_resource type="Animation" id="Animation_ofiho"] resource_name = "arrive" @@ -306,6 +282,18 @@ tracks/7/keys = { "update": 0, "values": [0.0, 1.0] } +tracks/8/type = "value" +tracks/8/imported = false +tracks/8/enabled = true +tracks/8/path = NodePath("%StartInfinite:modulate:a") +tracks/8/interp = 2 +tracks/8/loop_wrap = true +tracks/8/keys = { +"times": PackedFloat32Array(0.33333334, 0.5), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [0.0, 1.0] +} [sub_resource type="AnimationLibrary" id="AnimationLibrary_1xafb"] _data = { @@ -409,6 +397,18 @@ theme_override_font_sizes/font_size = 33 text = "START" icon = ExtResource("3_6yuhi") +[node name="StartInfinite" type="Button" parent="MarginContainer/GridContainer/VBoxContainer/VBoxContainer" unique_id=1255171640] +unique_name_in_owner = true +z_index = 1 +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 +theme = ExtResource("1_4ph5l") +theme_override_font_sizes/font_size = 33 +text = "INFINITE_MODE" +icon = ExtResource("12_igvpv") +flat = true + [node name="Settings" type="Button" parent="MarginContainer/GridContainer/VBoxContainer/VBoxContainer" unique_id=381312431] layout_mode = 2 size_flags_horizontal = 4 @@ -430,7 +430,7 @@ layout_mode = 2 size_flags_horizontal = 4 size_flags_vertical = 4 theme = ExtResource("1_4ph5l") -text = "RESTART_DEMO" +text = "RESTART_HISTORY_MODE" icon = ExtResource("5_6yuhi") flat = true @@ -523,7 +523,7 @@ size = Vector2i(1980, 1080) [node name="Planet3d" parent="SubViewport" unique_id=926789923 instance=ExtResource("5_7a1qq")] unique_name_in_owner = true -noise = SubResource("FastNoiseLite_rf16a") +noise = SubResource("FastNoiseLite_gn4uv") [node name="Camera3D" type="Camera3D" parent="SubViewport" unique_id=806252928] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -14.369979, 0, 64.323425) @@ -554,6 +554,7 @@ z_index = 100 mouse_filter = 2 [connection signal="pressed" from="MarginContainer/GridContainer/VBoxContainer/VBoxContainer/Start" to="." method="_on_start_pressed"] +[connection signal="pressed" from="MarginContainer/GridContainer/VBoxContainer/VBoxContainer/StartInfinite" to="." method="_on_start_infinite_pressed"] [connection signal="button_down" from="MarginContainer/GridContainer/VBoxContainer/VBoxContainer/Settings" to="." method="_on_settings_button_down"] [connection signal="button_down" from="MarginContainer/GridContainer/VBoxContainer/VBoxContainer/Controls" to="." method="_on_controls_button_down"] [connection signal="button_down" from="MarginContainer/GridContainer/VBoxContainer/VBoxContainer/Restart" to="." method="_on_restart_button_down"] diff --git a/translation/game/gui.csv b/translation/game/gui.csv index 417729c..e6d4885 100644 --- a/translation/game/gui.csv +++ b/translation/game/gui.csv @@ -14,17 +14,20 @@ OK,Ok,Ok GARDEN,Garden,Jardin COMMA,", ","," OR," or "," ou " -PAUSE,Pause,Pause +PAUSE,Pause,Pause& CONTROLS,Controls,Contrôles RESUME_GAME,Resume,Reprendre RESTART,Restart,Recommencer RESTART_DEMO,Restart demo,Recommencer la démo +RESTART_HISTORY_MODE,Restart History Mode,Recommencer le mode histoire QUIT,Quit,Quitter +RETURN_TO_TITLE_SCREEN,Return to title screen,Retour à l'écran titre TWITCH_INTEGRATION_IN_THE_SETTINGS,Twitch integration in the settings!,Intégration twitch dans les paramètres ! THIS_GAME_USE_AUTOSAVE,This game use autosave,Ce jeu sauvegarde votre progression automatiquement CHOOSE_GAME_MODE,Choose game mode,Choisissez le mode de jeu STORY_MODE,Story Mode,Mode Histoire INFINITE_MODE,Infinite Mode,Mode Infini +CONTINUE_INFINITE_MODE,Continue Infinite Mode,Continuer le mode infini SEED,Seed,Graine TAKE,Take,Prendre PACKAGE,Crate,Caisse de matériel @@ -370,6 +373,8 @@ GET_YOUR_ITEM,Get your item,Récupérez votre objet PLANT_DEFAULT_ATTRIBUTES,Plant Default Attributes,Attributs des plantes par défaut DISCOVERED_MUTATIONS,Discovered Mutations,Mutations découvertes PLANT_SEEDS_TO_DISCOVER_MUTATIONS,Plant seeds to discover mutations,Plantez des graines pour découvrir des mutations +ACTUAL_DISTANCE,Actual Distance,Distance actuelle +BEST_DISTANCE,Best Distance,Meilleure Distance INSPECT,Inspect,Inspecter VENDING_MACHINE,Vending Machine,Distributeur VENDING_MACHINE_ROOM,Vending Machine Room,Local de Distributeur