diff --git a/common/audio_manager/audio_manager.tscn b/common/audio_manager/audio_manager.tscn index 02f41eb..c62d3d4 100644 --- a/common/audio_manager/audio_manager.tscn +++ b/common/audio_manager/audio_manager.tscn @@ -1,12 +1,11 @@ -[gd_scene load_steps=30 format=3 uid="uid://b6hscxcrj065q"] +[gd_scene load_steps=28 format=3 uid="uid://b6hscxcrj065q"] [ext_resource type="Script" uid="uid://2p5d6vogtn82" path="res://common/audio_manager/scripts/audio_manager.gd" id="1_0tvca"] -[ext_resource type="AudioStream" uid="uid://dipnmlprwfo12" path="res://common/audio_manager/assets/ambiance/niveau/ambiance_phase_1.ogg" id="2_a4u5m"] -[ext_resource type="AudioStream" uid="uid://bm0tdi6bd2e65" path="res://common/audio_manager/assets/ambiance/niveau/ambiance_phase_2.ogg" id="3_8nsyr"] -[ext_resource type="AudioStream" uid="uid://dftxjfdqgsbd3" path="res://common/audio_manager/assets/ambiance/niveau/ambiance_phase_3.ogg" id="4_athui"] +[ext_resource type="AudioStream" uid="uid://dipnmlprwfo12" path="res://common/audio_manager/assets/ambiance/niveau/ambiance_phase_1.ogg" id="2_tuvql"] [ext_resource type="AudioStream" uid="uid://dcbuhtc085q2x" path="res://common/audio_manager/assets/morceaux/niveau_v2/mines_phase_1.ogg" id="5_ajci6"] [ext_resource type="AudioStream" uid="uid://bqwiaek5b5q00" path="res://common/audio_manager/assets/morceaux/niveau/forest_phase_2.ogg" id="6_ldyhq"] [ext_resource type="AudioStream" uid="uid://d4lqhgf0lhgge" path="res://common/audio_manager/assets/morceaux/niveau/forest_phase_3.ogg" id="7_ol34x"] +[ext_resource type="AudioStream" uid="uid://bpf6witukorka" path="res://common/audio_manager/assets/morceaux/autres/main_menu.ogg" id="7_tuvql"] [ext_resource type="AudioStream" uid="uid://brtjlgjqnrvcb" path="res://common/audio_manager/assets/morceaux/autres/truck_music.ogg" id="8_0e5ja"] [ext_resource type="AudioStream" uid="uid://bnxsnege8qq6e" path="res://common/audio_manager/assets/morceaux/niveau/forest_phase_4.ogg" id="8_ajci6"] [ext_resource type="AudioStream" uid="uid://dfrp66a4isnt6" path="res://common/audio_manager/assets/sfx/dig/dig_1.wav" id="9_gv65y"] @@ -24,15 +23,6 @@ [ext_resource type="AudioStream" uid="uid://d1cpi438ep0ys" path="res://common/audio_manager/assets/sfx/announce/annnounce.wav" id="22_btfwx"] [ext_resource type="AudioStream" uid="uid://ccq04ahrwr3bv" path="res://common/audio_manager/assets/sfx/alarm/alarm.wav" id="23_fwu3w"] -[sub_resource type="AudioStreamSynchronized" id="AudioStreamSynchronized_i5lxw"] -stream_count = 3 -stream_0/stream = ExtResource("2_a4u5m") -stream_0/volume = 0.0 -stream_1/stream = ExtResource("3_8nsyr") -stream_1/volume = -60.0 -stream_2/stream = ExtResource("4_athui") -stream_2/volume = -60.0 - [sub_resource type="AudioStreamPlaylist" id="AudioStreamPlaylist_ajci6"] stream_count = 4 stream_0 = ExtResource("5_ajci6") @@ -66,33 +56,32 @@ streams_count = 2 stream_0/stream = ExtResource("20_pu6t4") stream_1/stream = ExtResource("21_dk5s6") -[node name="AudioManager" type="Node" node_paths=PackedStringArray("playing_soundtracks")] +[node name="AudioManager" type="Node"] process_mode = 3 script = ExtResource("1_0tvca") default_fade_time = 2.0 -garden_phases_scores = Array[int]([0, 10, 30]) -playing_soundtracks = [NodePath("Ambiance/Default")] [node name="Ambiance" type="Node" parent="."] unique_name_in_owner = true -[node name="Default" type="AudioStreamPlayer" parent="Ambiance"] +[node name="Exterior" type="AudioStreamPlayer" parent="Ambiance"] unique_name_in_owner = true -stream = SubResource("AudioStreamSynchronized_i5lxw") -autoplay = true +stream = ExtResource("2_tuvql") [node name="Musics" type="Node" parent="."] unique_name_in_owner = true -[node name="Planet" type="AudioStreamPlayer" parent="Musics"] +[node name="Region" type="AudioStreamPlayer" parent="Musics"] unique_name_in_owner = true stream = SubResource("AudioStreamPlaylist_ajci6") -autoplay = true + +[node name="Title" type="AudioStreamPlayer" parent="Musics"] +unique_name_in_owner = true +stream = ExtResource("7_tuvql") [node name="Truck" type="AudioStreamPlayer" parent="Musics"] unique_name_in_owner = true stream = ExtResource("8_0e5ja") -autoplay = true [node name="Sfx" type="Node" parent="."] unique_name_in_owner = true diff --git a/common/audio_manager/scripts/audio_manager.gd b/common/audio_manager/scripts/audio_manager.gd index 9ca11c9..d575dd7 100644 --- a/common/audio_manager/scripts/audio_manager.gd +++ b/common/audio_manager/scripts/audio_manager.gd @@ -7,132 +7,115 @@ const MAX_VOLUME = 24. @export var default_fade_time = 1.0 -@export var garden_phase = 0 -@export var garden_phases_scores : Array[int] - -@export var playing_soundtracks : Array[AudioStreamPlayer] = [] +@export var playing_music : AudioStreamPlayer = null +@export var playing_ambiance : AudioStreamPlayer = null var default_volumes := {} func _ready(): - GameInfo.game_data.current_planet_data_updated.connect(_on_current_planet_data_updated) - fetch_default_volumes() - setup_volume() - settings.sound_changed.connect( - func(_s) : setup_volume() - ) - for player in get_all_soundtrack_players(): - player.play() + for player in get_all_players(): + player.stop() + + fetch_default_volumes() + setup_volume() + settings.sound_changed.connect( + func(_s) : setup_volume() + ) + SceneManager.scene_loaded.connect(_on_change_scene) + +func _on_change_scene(scene : Scene): + play_ambiance() + + match scene.scene_id: + "TITLE": + play_music("Title") + "REGION": + play_music("Region") + play_ambiance("Exterior") + "COCKPIT": + play_music("Truck") func fetch_default_volumes(): - var all_players := get_all_soundtrack_players() - all_players.append_array(get_all_sfx_players()) + var all_players := get_all_players() - for player in all_players: - default_volumes[player] = player.volume_db + for player in all_players: + default_volumes[player] = player.volume_db func setup_volume(): - for player in get_all_soundtrack_players(): - player.volume_db = get_volume_from_parent(player) if ( - playing_soundtracks.find(player) != -1 - ) else MIN_VOLUME - setup_phase(player) - for player in get_all_sfx_players(): - player.volume_db = get_volume_from_parent(player) + for player in get_all_players(): + player.volume_db = get_volume_from_parent(player) func get_volume_from_parent(player : AudioStreamPlayer) -> float: - var settings_volume = 0.5 + var settings_volume = 0.5 - if player.get_parent() == %Ambiance: - settings_volume = settings.ambiance_volume - elif player.get_parent() == %Sfx: - settings_volume = settings.sfx_volume - elif player.get_parent() == %Musics: - settings_volume = settings.music_volume - - return default_volumes[player] + lerp(MIN_VOLUME, MAX_VOLUME, settings_volume) + if player.get_parent() == %Ambiance: + settings_volume = settings.ambiance_volume + elif player.get_parent() == %Sfx: + settings_volume = settings.sfx_volume + elif player.get_parent() == %Musics: + settings_volume = settings.music_volume + + return default_volumes[player] + lerp(MIN_VOLUME, MAX_VOLUME, settings_volume) -func update_phase(): - for player in get_all_soundtrack_players(): - var playing : bool = player.volume_db != MIN_VOLUME - if playing: - await set_volume(player, MIN_VOLUME).finished - setup_phase(player) - if playing: - set_volume(player, get_volume_from_parent(player)) +func get_all_players() -> Array[AudioStreamPlayer]: + var players : Array[AudioStreamPlayer] = [] + players.append_array(get_players_from_node(%Musics)) + players.append_array(get_players_from_node(%Ambiance)) + players.append_array(get_players_from_node(%Sfx)) -func get_all_soundtrack_players() -> Array[AudioStreamPlayer]: - var players : Array[AudioStreamPlayer] = [] - players.append_array(get_players_from_node(%Musics)) - players.append_array(get_players_from_node(%Ambiance)) - - return players - -func get_all_sfx_players() -> Array[AudioStreamPlayer]: - return get_players_from_node(%Sfx) + return players func get_players_from_node(node : Node) -> Array[AudioStreamPlayer]: - var streams : Array[AudioStreamPlayer] = [] + var streams : Array[AudioStreamPlayer] = [] - for c in node.get_children(): - if c is AudioStreamPlayer: - streams.append(c) - return streams + for c in node.get_children(): + if c is AudioStreamPlayer: + streams.append(c) + return streams +func set_volume(player : AudioStreamPlayer, to : float, fade_time = default_fade_time) -> Tween: + var fade_tween : Tween = get_tree().create_tween() -func _on_current_planet_data_updated(planet_data : PlanetData): - if planet_data: - update_garden_phase(planet_data) - planet_data.updated.connect(update_garden_phase) - -func update_garden_phase(planet_data : PlanetData): - var phase : int = garden_phase - for i in range(len(garden_phases_scores)): - if planet_data.garden_score >= garden_phases_scores[i] and i > garden_phase: - phase = i + fade_tween.tween_property(player, "volume_db", to, fade_time) - if garden_phase != phase: - update_phase() + return fade_tween - garden_phase = phase +func reset_volume(player : AudioStreamPlayer): + player.volume_db = get_volume_from_parent(player) -func enter_planet(): - play_music(%Planet, true) - stop_music(%Truck, true) +func play_sfx(sfx_name : String): + var player := %Sfx.find_child(sfx_name) as AudioStreamPlayer + if player: + player.play() + else: + printerr("Sfx %s not found" % sfx_name) -func enter_truck(): - play_music(%Truck, true) - stop_music(%Planet, true) +func play_music(music_name : String = ""): + if playing_music: + await set_volume(playing_music, MIN_VOLUME).finished + if playing_music: + playing_music.stop() + reset_volume(playing_music) + playing_music = null + if music_name: + var player := %Musics.find_child(music_name) as AudioStreamPlayer + if player: + playing_music = player + player.play() + else: + printerr("Music %s not found" % music_name) -func stop_music(music : AudioStreamPlayer, with_fade = false): - if playing_soundtracks.find(music) != -1: - playing_soundtracks.remove_at(playing_soundtracks.find(music)) - set_volume(music, MIN_VOLUME, with_fade) - -func play_music(player : AudioStreamPlayer, with_fade = false): - playing_soundtracks.append(player) - set_volume(player, get_volume_from_parent(player), with_fade) - -func setup_phase(music : AudioStreamPlayer): - if music.stream is AudioStreamSynchronized: - var sync_stream = music.stream as AudioStreamSynchronized - var phase_stream_id = min(garden_phase, sync_stream.stream_count - 1) - for i in range(sync_stream.stream_count): - sync_stream.set_sync_stream_volume( - i, - 0. if i == phase_stream_id else MIN_VOLUME - ) - -func set_volume(music : AudioStreamPlayer, to : float, fade_time = default_fade_time) -> Tween: - var fade_tween : Tween = get_tree().create_tween() - - fade_tween.tween_property(music, "volume_db", to, fade_time) - - return fade_tween - -func play_sfx(name : String): - var player := %Sfx.find_child(name) as AudioStreamPlayer - if player: - player.play() - else: - printerr("Sfx %s not found" % name) +func play_ambiance(ambiance_name : String = ""): + if playing_ambiance: + await set_volume(playing_ambiance, MIN_VOLUME).finished + if playing_ambiance: + playing_ambiance.stop() + reset_volume(playing_ambiance) + playing_ambiance = null + if ambiance_name: + var player := %Ambiance.find_child(ambiance_name) as AudioStreamPlayer + if player: + playing_ambiance = player + player.play() + else: + printerr("Sfx %s not found" % ambiance_name) diff --git a/common/game_data/scripts/game_data.gd b/common/game_data/scripts/game_data.gd index c44ec68..e3fed55 100644 --- a/common/game_data/scripts/game_data.gd +++ b/common/game_data/scripts/game_data.gd @@ -1,100 +1,31 @@ extends Resource class_name GameData -signal current_planet_data_updated(p : PlanetData) - -func _init(): - set_default_unlocked() - -@export var tutorial_done = false +signal current_region_data_updated(p : RegionData) @export var settings : SettingsData = SettingsData.new() -@export var current_run : RunData = RunData.new() +@export var current_run : RunData = null -@export var current_planet_data : PlanetData : get = get_current_planet_data - +@export var current_region_data : RegionData = null + @export var player_data : PlayerData = PlayerData.new() -@export var unlocked_plant_types : Array[PlantType] = [] -@export var unlocked_plant_mutations : Array[PlantMutation] = [] -@export var unlocked_machines : Array[MachineType] = [] - -@export var truck_data : TruckData = TruckData.new() - -func _ready(): - current_run.run_point_changed.connect( - func(): current_planet_data_updated.emit(get_current_planet_data) - ) - -func set_default_unlocked(): - unlocked_plant_types = all_plant_types() - unlocked_plant_mutations = all_plant_mutations() - unlocked_machines = all_machines() - -func reset_run(): - current_run = RunData.new() - current_planet_data_updated.emit() +func start_run(): + player_data.inventory.clear() + current_run = RunData.new() + current_run.current_run_point_changed.connect( + func(rp : RunPoint): + start_region(rp.region_parameter) + ) func reset_player(): - player_data = PlayerData.new() - -func reset_truck(): - truck_data = TruckData.new() + player_data = PlayerData.new() func reset_all(): - reset_run() - reset_player() - reset_truck() + start_run() + reset_player() - unlocked_plant_types = [] - -func unlock_plant_type(new_plant_type : PlantType): - if not is_plant_type_unlocked(new_plant_type): - unlocked_plant_types.append(new_plant_type.duplicate_deep()) - -func get_locked_plant_types() -> Array[PlantType]: - var locked_plant_type : Array[PlantType] = [] - - for pt in GameInfo.game_data.all_plant_types(): - if not is_plant_type_unlocked(pt): - locked_plant_type.append(pt) - - return locked_plant_type - -func get_current_planet_data(): - return current_run.get_current_planet_data() - -func is_plant_type_unlocked(new_plant_type : PlantType): - return unlocked_plant_types.find_custom( - func (upt : PlantType): return new_plant_type.name == upt.name - ) != -1 - - -func all_plant_types() -> Array[PlantType]: - return [ - preload("res://entities/plants/resources/plant_types/champ.tres"), - preload("res://entities/plants/resources/plant_types/chardi.tres"), - preload("res://entities/plants/resources/plant_types/ferno.tres"), - preload("res://entities/plants/resources/plant_types/maias.tres"), - preload("res://entities/plants/resources/plant_types/philea.tres"), - preload("res://entities/plants/resources/plant_types/pili.tres"), - preload("res://entities/plants/resources/plant_types/solita.tres"), - ] - -func all_machines() -> Array[MachineType]: - return [ - preload("res://entities/interactables/machines/solar_pannel/solar_pannel.tres"), - ] - -func all_plant_mutations() -> Array[PlantMutation]: - return [ - preload("res://entities/plants/resources/plant_mutations/ancient_mutation.tres"), - preload("res://entities/plants/resources/plant_mutations/elitist_mutation.tres"), - preload("res://entities/plants/resources/plant_mutations/ermit_mutation.tres"), - preload("res://entities/plants/resources/plant_mutations/precocious_mutation.tres"), - preload("res://entities/plants/resources/plant_mutations/quality_mutation.tres"), - preload("res://entities/plants/resources/plant_mutations/quick_mutation.tres"), - preload("res://entities/plants/resources/plant_mutations/sociable_mutation.tres"), - preload("res://entities/plants/resources/plant_mutations/strong_mutation.tres"), - ] +func start_region(region_param : RegionParameter): + current_region_data = RegionData.new(region_param) + current_region_data_updated.emit(current_region_data) diff --git a/common/game_data/scripts/run/run_data.gd b/common/game_data/scripts/run/run_data.gd index 22ec73f..037ec9e 100644 --- a/common/game_data/scripts/run/run_data.gd +++ b/common/game_data/scripts/run/run_data.gd @@ -1,22 +1,27 @@ extends Resource class_name RunData -const RUN_POINT_POSITION_DERIVATION = 70 +enum State {STARTED, IN_PROGRESS, FINISHED} + +const RUN_POINT_POSITION_DERIVATION = 100 const DIFFICULTY_INCREASE_BY_LEVEL = 1 const RUN_POINTS_NEXT_NUMBER :Array[int] = [2,3] const RUN_POINT_MAX_LEVEL = 10 -signal run_point_changed +signal current_run_point_changed var run_seed = randi() @export var next_run_points : Array[RunPoint] = [generate_first_run_point()] -@export var current_run_point : RunPoint = null +@export var current_run_point : RunPoint = null : + set(v): + current_run_point = v + current_run_point_changed.emit(v) @export var visited_run_points : Array[RunPoint] = [] #region ------------------ Generation ------------------ func generate_first_run_point() -> RunPoint: - return RunPoint.new(0, PlanetParameter.new()) + return RunPoint.new(0, RegionParameter.new()) func generate_next_run_points(run_point : RunPoint) -> Array[RunPoint]: var nb_next_run_points = RUN_POINTS_NEXT_NUMBER.pick_random() @@ -38,18 +43,18 @@ func generate_next_run_points(run_point : RunPoint) -> Array[RunPoint]: func generate_next_run_point(run_point : RunPoint) -> RunPoint: return RunPoint.new( run_point.level + 1, - generate_difficulty_increased_planet_parameter(run_point.planet_parameter, DIFFICULTY_INCREASE_BY_LEVEL), + generate_difficulty_increased_region_parameter(run_point.region_parameter, DIFFICULTY_INCREASE_BY_LEVEL), (run_point.position + randi_range(-RUN_POINT_POSITION_DERIVATION, RUN_POINT_POSITION_DERIVATION)) % 360 ) -func generate_difficulty_increased_planet_parameter( - planet_parameter : PlanetParameter, +func generate_difficulty_increased_region_parameter( + region_parameter : RegionParameter, difficulty : int = 1 -) -> PlanetParameter: +) -> RegionParameter: var i_diff := difficulty - var new_planet_parameter = PlanetParameter.new( - planet_parameter.charges, - planet_parameter.objective + var new_region_parameter = RegionParameter.new( + region_parameter.charges, + region_parameter.objective ) while i_diff > 0: @@ -58,26 +63,30 @@ func generate_difficulty_increased_planet_parameter( DifficultyIncreaseObjective.new() ].filter( func (mod : DifficultyModifier): - return mod.get_difficulty_cost() <= i_diff and mod.can_modifiy(new_planet_parameter) + return mod.get_difficulty_cost() <= i_diff and mod.can_modifiy(new_region_parameter) ) var selected_difficulty_modifier = available_difficulty_modifier.pick_random() - selected_difficulty_modifier.modify(new_planet_parameter) + selected_difficulty_modifier.modify(new_region_parameter) i_diff -= max(1,selected_difficulty_modifier.get_difficulty_cost()) - return new_planet_parameter + return new_region_parameter #endregion -func get_next_run_points() -> Array[RunPoint]: - return next_run_points +func get_state() -> State: + if not current_run_point: + return State.STARTED + elif current_run_point.level == RUN_POINT_MAX_LEVEL: + return State.FINISHED + else : + return State.IN_PROGRESS -func get_current_planet_data() -> PlanetData: - if current_run_point: - return current_run_point.planet_data - else: - return null +func get_next_run_points() -> Array[RunPoint]: + if current_run_point and current_run_point.level == RUN_POINT_MAX_LEVEL: + return [] + return next_run_points func choose_next_run_point(run_point : RunPoint) -> RunPoint: if current_run_point: @@ -87,22 +96,22 @@ func choose_next_run_point(run_point : RunPoint) -> RunPoint: return current_run_point class DifficultyModifier: - func modify(_planet_parameter : PlanetParameter): + func modify(_region_parameter : RegionParameter): pass - func can_modifiy(_planet_parameter : PlanetParameter) -> bool: + func can_modifiy(_region_parameter : RegionParameter) -> bool: return true func get_difficulty_cost() -> int: return 1 class DifficultyIncreaseObjective extends DifficultyModifier: - func modify(planet_parameter : PlanetParameter): - planet_parameter.objective += 1 + func modify(region_parameter : RegionParameter): + region_parameter.objective += 1 class DifficultyDecreaseCharge extends DifficultyModifier: - func modify(planet_parameter : PlanetParameter): - planet_parameter.charges -= 1 + func modify(region_parameter : RegionParameter): + region_parameter.charges -= 1 - func can_modifiy(planet_parameter : PlanetParameter) -> bool: - return planet_parameter.charges >= 3 \ No newline at end of file + func can_modifiy(region_parameter : RegionParameter) -> bool: + return region_parameter.charges >= 3 \ No newline at end of file diff --git a/common/game_data/scripts/run/run_point.gd b/common/game_data/scripts/run/run_point.gd index c161228..e1855df 100644 --- a/common/game_data/scripts/run/run_point.gd +++ b/common/game_data/scripts/run/run_point.gd @@ -8,53 +8,30 @@ const OBJECTIVE_ICON = preload("res://common/icons/dna.svg") const CHARGE_ICON = preload("res://common/icons/bolt.svg") @export var level : int = 0 # X pos along the planet, and difficulty -@export var planet_parameter : PlanetParameter = PlanetParameter.new() : +@export var region_parameter : RegionParameter = RegionParameter.new() : set(v): - planet_parameter = v - planet_data = PlanetData.new(planet_parameter) -@export var region_name : String = generate_region_name() + region_parameter = v @export var position : int = 0 # Y pos along the planet, 0 to 360 -var planet_data : PlanetData func _init( _level : int = 0, - _planet_parameter : PlanetParameter = PlanetParameter.new(), + _region_parameter : RegionParameter = RegionParameter.new(), _position : int = randi_range(0,360), - _region_name : String = generate_region_name() ): level = _level - planet_parameter = _planet_parameter + region_parameter = _region_parameter position = _position - region_name = _region_name - planet_data = PlanetData.new(planet_parameter) func card_info() -> CardInfo: - var info = CardInfo.new(region_name) + var info = CardInfo.new(region_parameter.name) info.important_stat_icon = DANGER_ICON info.important_stat_text = "%d" % level info.type_icon = TYPE_ICON info.stats.append_array([ - CardStatInfo.new(tr("%d_GARDEN_POINTS") % planet_parameter.objective, OBJECTIVE_ICON), - CardStatInfo.new(tr("%d_CHARGES_AVAILABLE") % planet_parameter.charges, CHARGE_ICON), + CardStatInfo.new(tr("%d_GARDEN_POINTS") % region_parameter.objective, OBJECTIVE_ICON), + CardStatInfo.new(tr("%d_CHARGES_AVAILABLE") % region_parameter.charges, CHARGE_ICON), ]) - return info - -func generate_region_name() -> String: - var vowel = ["a","e","i","o","u","y"] - var consonants = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "z", "'"] - - var word_len = randf_range(4,8) - var word = '' - var last_letter_is_vowel = false - - for i in range(word_len): - if last_letter_is_vowel: - word += consonants.pick_random() - else: - word += vowel.pick_random() - - last_letter_is_vowel = not last_letter_is_vowel - return word.capitalize() \ No newline at end of file + return info \ No newline at end of file diff --git a/common/icons/focus.svg b/common/icons/focus.svg new file mode 100644 index 0000000..57954f9 --- /dev/null +++ b/common/icons/focus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png.import b/common/icons/focus.svg.import similarity index 68% rename from entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png.import rename to common/icons/focus.svg.import index e8ebe9c..b1b8b1d 100644 --- a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png.import +++ b/common/icons/focus.svg.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://cqqlkm14lawpa" -path="res://.godot/imported/panneau_solaire_1.png-b9a4049f295152380ed394a82c03b8e2.ctex" +uid="uid://ba8vh5h3r6pr2" +path="res://.godot/imported/focus.svg-cc30e969e976522254107343300a103b.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png" -dest_files=["res://.godot/imported/panneau_solaire_1.png-b9a4049f295152380ed394a82c03b8e2.ctex"] +source_file="res://common/icons/focus.svg" +dest_files=["res://.godot/imported/focus.svg-cc30e969e976522254107343300a103b.ctex"] [params] @@ -38,3 +38,6 @@ 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/common/icons/hand-stop.svg b/common/icons/hand-stop.svg new file mode 100644 index 0000000..8815943 --- /dev/null +++ b/common/icons/hand-stop.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png.import b/common/icons/hand-stop.svg.import similarity index 67% rename from entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png.import rename to common/icons/hand-stop.svg.import index 01643de..eed0a38 100644 --- a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png.import +++ b/common/icons/hand-stop.svg.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://b1n8nad43usw4" -path="res://.godot/imported/panneau_solaire_2.png-479b68803815c59c599ff8c3a78ca895.ctex" +uid="uid://3slhocr5wy3w" +path="res://.godot/imported/hand-stop.svg-bc0d0e986bcb4b50bdd5686b5bff814b.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png" -dest_files=["res://.godot/imported/panneau_solaire_2.png-479b68803815c59c599ff8c3a78ca895.ctex"] +source_file="res://common/icons/hand-stop.svg" +dest_files=["res://.godot/imported/hand-stop.svg-bc0d0e986bcb4b50bdd5686b5bff814b.ctex"] [params] @@ -38,3 +38,6 @@ 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/common/scene_manager/scene_manager.tscn b/common/scene_manager/scene_manager.tscn new file mode 100644 index 0000000..6a3a2fc --- /dev/null +++ b/common/scene_manager/scene_manager.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=8 format=3 uid="uid://dac5wte80dwj0"] + +[ext_resource type="Script" uid="uid://bb44144ckt2w7" path="res://common/scene_manager/scripts/scene_manager.gd" id="1_1c0qu"] +[ext_resource type="Script" uid="uid://1ejbvr3431ac" path="res://common/scene_manager/scripts/scene.gd" id="2_c1lr7"] +[ext_resource type="Resource" uid="uid://bvksiaiocwob5" path="res://common/scene_manager/scenes/cockpit.tres" id="3_e28ni"] +[ext_resource type="Resource" uid="uid://bvgdq43fpl1xs" path="res://common/scene_manager/scenes/intro.tres" id="4_msho1"] +[ext_resource type="Resource" uid="uid://boqgwjyxyb45r" path="res://common/scene_manager/scenes/region.tres" id="5_ytog4"] +[ext_resource type="Resource" uid="uid://c27wenetitwm" path="res://common/scene_manager/scenes/region_selection.tres" id="6_chs32"] +[ext_resource type="Resource" uid="uid://diro74w272onp" path="res://common/scene_manager/scenes/title.tres" id="7_ol3d5"] + +[node name="SceneManager" type="Node"] +script = ExtResource("1_1c0qu") +scenes = Array[ExtResource("2_c1lr7")]([ExtResource("3_e28ni"), ExtResource("4_msho1"), ExtResource("5_ytog4"), ExtResource("6_chs32"), ExtResource("7_ol3d5")]) diff --git a/common/scene_manager/scenes/cockpit.tres b/common/scene_manager/scenes/cockpit.tres new file mode 100644 index 0000000..6921823 --- /dev/null +++ b/common/scene_manager/scenes/cockpit.tres @@ -0,0 +1,10 @@ +[gd_resource type="Resource" script_class="Scene" load_steps=2 format=3 uid="uid://bvksiaiocwob5"] + +[ext_resource type="Script" uid="uid://1ejbvr3431ac" path="res://common/scene_manager/scripts/scene.gd" id="1_tkiq8"] + +[resource] +script = ExtResource("1_tkiq8") +scene_id = "COCKPIT" +scene_path = "res://stages/cockpit/cockpit.tscn" +mouse_captured = true +metadata/_custom_type_script = "uid://1ejbvr3431ac" diff --git a/common/scene_manager/scenes/intro.tres b/common/scene_manager/scenes/intro.tres new file mode 100644 index 0000000..c57ae5c --- /dev/null +++ b/common/scene_manager/scenes/intro.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" script_class="Scene" load_steps=2 format=3 uid="uid://bvgdq43fpl1xs"] + +[ext_resource type="Script" uid="uid://1ejbvr3431ac" path="res://common/scene_manager/scripts/scene.gd" id="1_6ws88"] + +[resource] +script = ExtResource("1_6ws88") +scene_id = "INTRO" +scene_path = "res://stages/intro/intro.tscn" +metadata/_custom_type_script = "uid://1ejbvr3431ac" diff --git a/common/scene_manager/scenes/region.tres b/common/scene_manager/scenes/region.tres new file mode 100644 index 0000000..6fe361c --- /dev/null +++ b/common/scene_manager/scenes/region.tres @@ -0,0 +1,10 @@ +[gd_resource type="Resource" script_class="Scene" load_steps=2 format=3 uid="uid://boqgwjyxyb45r"] + +[ext_resource type="Script" uid="uid://1ejbvr3431ac" path="res://common/scene_manager/scripts/scene.gd" id="1_10qbh"] + +[resource] +script = ExtResource("1_10qbh") +scene_id = "REGION" +scene_path = "res://stages/terrain/region/region.tscn" +need_terrain_generated = true +metadata/_custom_type_script = "uid://1ejbvr3431ac" diff --git a/common/scene_manager/scenes/region_selection.tres b/common/scene_manager/scenes/region_selection.tres new file mode 100644 index 0000000..09c2fdc --- /dev/null +++ b/common/scene_manager/scenes/region_selection.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" script_class="Scene" load_steps=2 format=3 uid="uid://c27wenetitwm"] + +[ext_resource type="Script" uid="uid://1ejbvr3431ac" path="res://common/scene_manager/scripts/scene.gd" id="1_smjh0"] + +[resource] +script = ExtResource("1_smjh0") +scene_id = "REGION_SELECTION" +scene_path = "res://stages/region_selection/region_selection.tscn" +metadata/_custom_type_script = "uid://1ejbvr3431ac" diff --git a/common/scene_manager/scenes/title.tres b/common/scene_manager/scenes/title.tres new file mode 100644 index 0000000..7b7ae6e --- /dev/null +++ b/common/scene_manager/scenes/title.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" script_class="Scene" load_steps=2 format=3 uid="uid://diro74w272onp"] + +[ext_resource type="Script" uid="uid://1ejbvr3431ac" path="res://common/scene_manager/scripts/scene.gd" id="1_48g2j"] + +[resource] +script = ExtResource("1_48g2j") +scene_id = "TITLE" +scene_path = "res://stages/title_screen/title_screen.tscn" +metadata/_custom_type_script = "uid://1ejbvr3431ac" diff --git a/common/scene_manager/scripts/scene.gd b/common/scene_manager/scripts/scene.gd new file mode 100644 index 0000000..3a3c83b --- /dev/null +++ b/common/scene_manager/scripts/scene.gd @@ -0,0 +1,7 @@ +extends Resource +class_name Scene + +@export var scene_id : String +@export_file_path() var scene_path : String +@export var mouse_captured := false +@export var need_terrain_generated := false \ No newline at end of file diff --git a/common/scene_manager/scripts/scene.gd.uid b/common/scene_manager/scripts/scene.gd.uid new file mode 100644 index 0000000..4376eeb --- /dev/null +++ b/common/scene_manager/scripts/scene.gd.uid @@ -0,0 +1 @@ +uid://1ejbvr3431ac diff --git a/common/scene_manager/scene_manager.gd b/common/scene_manager/scripts/scene_manager.gd similarity index 54% rename from common/scene_manager/scene_manager.gd rename to common/scene_manager/scripts/scene_manager.gd index 141bce2..36d9d7b 100644 --- a/common/scene_manager/scene_manager.gd +++ b/common/scene_manager/scripts/scene_manager.gd @@ -1,25 +1,39 @@ extends Node -const TITLE_SCREEN = "res://stages/title_screen/title_screen.tscn" -const PLANET_SCENE = "res://stages/terrain/planet/planet.tscn" -const TRUCK_SCENE = "res://stages/terrain/truck/truck.tscn" -const INTRO_SCENE = "res://stages/intro/intro.tscn" -const COCKPIT_SCENE = "res://stages/cockpit/cockpit.tscn" -const REGION_SELECTION_SCREEN = "res://stages/region_selection/region_selection.tscn" +@export var scenes : Array[Scene] -signal scene_loaded -signal scene_node_ready +signal scene_loaded(scene : Scene) +signal scene_node_ready(scene : Scene) var loading_scene = false var generating_node = false -var scene_to_load := "" +var actual_scene : Scene = null var next_scene_node : Node @onready var current_scene_node : Node = get_tree().root.get_children().back() -func change_scene(scene_path : String, with_loading = true): +func search_scenes(scene_id : String) -> Scene: + var scene_pos : int = scenes.find_custom( + func (s : Scene): + return s.scene_id == scene_id + ) + if scene_pos == -1: + return null + else : + return scenes[scene_pos] + +func change_scene(scene_id : String, with_loading = true): + + if loading_scene or generating_node: + await scene_node_ready + + var scene = search_scenes(scene_id) + if not scene: + printerr("Scene %s not found" % scene_id) + return + actual_scene = scene loading_scene = true - scene_to_load = scene_path - ResourceLoader.load_threaded_request(scene_to_load) + var scene_path_to_load = scene.scene_path + ResourceLoader.load_threaded_request(scene_path_to_load) LoadingScreen.loading_text = "LOADING_SCENE" var scene_to_hide = current_scene_node if with_loading: @@ -31,16 +45,16 @@ func change_scene(scene_path : String, with_loading = true): if loading_scene: await scene_loaded - next_scene_node = ResourceLoader.load_threaded_get(scene_to_load).instantiate() + next_scene_node = ResourceLoader.load_threaded_get(scene_path_to_load).instantiate() if next_scene_node.has_method("hide"): next_scene_node.hide() get_tree().root.add_child(next_scene_node) + generating_node = true - if next_scene_node is Planet: + if scene.need_terrain_generated: LoadingScreen.loading_text = "GENERATING_TERRAIN" - - if generating_node: - await scene_node_ready + + await scene_node_ready if current_scene_node: current_scene_node.queue_free() @@ -48,23 +62,27 @@ func change_scene(scene_path : String, with_loading = true): if current_scene_node.has_method("show"): current_scene_node.show() + Input.mouse_mode = Input.MOUSE_MODE_CAPTURED if scene.mouse_captured else Input.MOUSE_MODE_VISIBLE + if with_loading: LoadingScreen.hide_loading_screen() func _process(_delta): if loading_scene: var progress = [] - var load_status := ResourceLoader.load_threaded_get_status(scene_to_load, progress) + var load_status := ResourceLoader.load_threaded_get_status(actual_scene.scene_path, progress) LoadingScreen.loading_value = progress[0] if load_status == ResourceLoader.THREAD_LOAD_LOADED: loading_scene = false - scene_loaded.emit() + scene_loaded.emit(actual_scene) + if load_status == ResourceLoader.THREAD_LOAD_FAILED or load_status == ResourceLoader.THREAD_LOAD_INVALID_RESOURCE: + printerr() elif generating_node: - if next_scene_node is Planet: + if next_scene_node is Region: LoadingScreen.loading_value = next_scene_node.generated_value if next_scene_node.is_generated: generating_node = false scene_node_ready.emit() elif next_scene_node.is_node_ready(): generating_node = false - scene_node_ready.emit() + scene_node_ready.emit(actual_scene) diff --git a/common/scene_manager/scene_manager.gd.uid b/common/scene_manager/scripts/scene_manager.gd.uid similarity index 100% rename from common/scene_manager/scene_manager.gd.uid rename to common/scene_manager/scripts/scene_manager.gd.uid diff --git a/common/tools/scripts/math.gd b/common/tools/scripts/math.gd index 704e4fa..47d1ff7 100644 --- a/common/tools/scripts/math.gd +++ b/common/tools/scripts/math.gd @@ -2,33 +2,33 @@ class_name Math static func get_chunk_from_pos(coord) -> Vector2i: return Vector2i( - floori(coord.x / (Planet.CHUNK_TILE_SIZE * Planet.TILE_SIZE)), - floori(coord.y / (Planet.CHUNK_TILE_SIZE * Planet.TILE_SIZE)) + floori(coord.x / (Region.CHUNK_TILE_SIZE * Region.TILE_SIZE)), + floori(coord.y / (Region.CHUNK_TILE_SIZE * Region.TILE_SIZE)) ) static func get_tile_from_pos(coord) -> Vector2i: return Vector2i( - floori(coord.x / (Planet.TILE_SIZE)), - floori(coord.y / (Planet.TILE_SIZE)), + floori(coord.x / (Region.TILE_SIZE)), + floori(coord.y / (Region.TILE_SIZE)), ) static func get_tiles_in_circle(center: Vector2, radius : float) -> Array[Vector2i]: var tiles : Array[Vector2i] = [] for x in range( - floori((center.x - radius/2.) / Planet.TILE_SIZE), - ceili((center.x + radius/2.) / Planet.TILE_SIZE), + floori((center.x - radius/2.) / Region.TILE_SIZE), + ceili((center.x + radius/2.) / Region.TILE_SIZE), ): for y in range( - floori((center.y - radius/2.) / Planet.TILE_SIZE), - ceili((center.y + radius/2.) / Planet.TILE_SIZE), + floori((center.y - radius/2.) / Region.TILE_SIZE), + ceili((center.y + radius/2.) / Region.TILE_SIZE), ): if is_tile_on_circle(Vector2i(x,y), center, radius): tiles.append(Vector2i(x,y)) return tiles static func is_tile_on_circle(tile_coord : Vector2i, circle_center: Vector2, circle_radius : float) -> bool: - var absolute_tile_pos : Vector2 = tile_coord * Planet.TILE_SIZE + var absolute_tile_pos : Vector2 = tile_coord * Region.TILE_SIZE # Loop over tile corners to know if the area collide var corners : Array[Vector2] = [] @@ -36,8 +36,8 @@ static func is_tile_on_circle(tile_coord : Vector2i, circle_center: Vector2, cir for y in [0,1]: corners.append( absolute_tile_pos - + Vector2.RIGHT * x * Planet.TILE_SIZE - + Vector2.DOWN * y * Planet.TILE_SIZE + + Vector2.RIGHT * x * Region.TILE_SIZE + + Vector2.DOWN * y * Region.TILE_SIZE ) # Check if segment touch area diff --git a/common/tools/scripts/random.gd b/common/tools/scripts/random.gd new file mode 100644 index 0000000..263074c --- /dev/null +++ b/common/tools/scripts/random.gd @@ -0,0 +1,45 @@ +class_name Random + +const MIN_WORD_LEN = 4 +const MAX_WORD_LEN = 8 + +const VOWEL = ["a","e","i","o","u","y"] +const CONSONANTS = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "z"] + + +static func generate_random_name(random_seed = randi()) -> String: + var word_len = randf_range(4,8) + var word = '' + var last_letter_is_vowel = false + + for i in range(word_len): + if last_letter_is_vowel: + word += CONSONANTS.pick_random() + else: + word += VOWEL.pick_random() + + last_letter_is_vowel = not last_letter_is_vowel + return word.capitalize() + +static func mutate_name(word : String) -> String: + return word + # TODO + + +func shorten_name(word : String): + if randi()%2 == 0: + return word.left(len(word) - 1).capitalize() + else : + return word.right(len(word) - 1).capitalize() + +func elongate_name(word : String): + if randi()%2 == 0: + var letter = CONSONANTS.pick_random() if word.left(1) in VOWEL else VOWEL.pick_random() + return (letter + word).capitalize() + else : + var letter = CONSONANTS.pick_random() if word.right(1) in VOWEL else VOWEL.pick_random() + return (word + letter).capitalize() + +func replace_character(word : String): + # TODO + return word diff --git a/common/tools/scripts/random.gd.uid b/common/tools/scripts/random.gd.uid new file mode 100644 index 0000000..4d6649a --- /dev/null +++ b/common/tools/scripts/random.gd.uid @@ -0,0 +1 @@ +uid://ukeanrcup7of diff --git a/common/vfx/materials/shaders/3d_outline.gdshader b/common/vfx/materials/shaders/3d_outline.gdshader new file mode 100644 index 0000000..c4462a9 --- /dev/null +++ b/common/vfx/materials/shaders/3d_outline.gdshader @@ -0,0 +1,272 @@ +shader_type spatial; +render_mode unshaded, blend_mix, depth_draw_never, depth_test_disabled; + +/* + AUTHOR: Hannah "EMBYR" Crawford + ENGINE_VERSION: 4.0.3 + + HOW TO USE: + 1. Create a MeshInstance3D node and place it in your scene. + 2. Set it's size to 2x2. + 3. Enable the "Flip Faces" option. + 4. Create a new shader material with this shader. + 5. Assign the material to the MeshInstance3D + + LIMITATIONS: + Does not work well with TAA enabled. + + MOBILE_NOTES: + The mobile renderer does not have access to the normal_roughness texture + so we must rely on techniques to reconstruct this information from the + depth buffer. + + If you require support on mobile please uncomment the SUPPORT_MOBILE line + below. I have done my best to match the appearance between the two modes + however, mobile does not take into account smooth-shaded faces. + + The high-quality reconstruction method used on mobile is rather heavy on + texture samples. If you would like to use the lower-quality recontruction + method for better performance, please uncomment the NAIVE_NORMAL_RECONSTRUCTION + line below. +*/ +//#define SUPPORT_MOBILE +//#define NAIVE_NORMAL_RECONSTRUCTION + +group_uniforms outline; +uniform vec4 outlineColor: source_color = vec4(0.0, 0.0, 0.0, 0.78); +uniform float depth_threshold = 0.025; +uniform float normal_threshold : hint_range(0.0, 1.5) = 0.5; +uniform float normal_smoothing : hint_range(0.0, 1.0) = 0.25; + +group_uniforms thickness; +uniform float max_thickness: hint_range(0.0, 5.0) = 1.3; +uniform float min_thickness = 0.5; +uniform float max_distance = 75.0; +uniform float min_distance = 2.0; + +group_uniforms grazing_prevention; +uniform float grazing_fresnel_power = 5.0; +uniform float grazing_angle_mask_power = 1.0; +uniform float grazing_angle_modulation_factor = 50.0; + +uniform sampler2D DEPTH_TEXTURE : hint_depth_texture, filter_linear, repeat_disable; + +#ifndef SUPPORT_MOBILE +uniform sampler2D NORMR_TEXTURE : hint_normal_roughness_texture, filter_linear, repeat_disable; +#else +varying flat mat4 model_view_matrix; +#endif// !SUPPORT_MOBILE + +struct UVNeighbors { + vec2 center; + vec2 left; vec2 right; vec2 up; vec2 down; + vec2 top_left; vec2 top_right; vec2 bottom_left; vec2 bottom_right; +}; + +struct NeighborDepthSamples { + float c_d; + float l_d; float r_d; float u_d; float d_d; + float tl_d; float tr_d; float bl_d; float br_d; +}; + +UVNeighbors getNeighbors(vec2 center, float width, float aspect) { + vec2 h_offset = vec2(width * aspect * 0.001, 0.0); + vec2 v_offset = vec2(0.0, width * 0.001); + UVNeighbors n; + n.center = center; + n.left = center - h_offset; + n.right = center + h_offset; + n.up = center - v_offset; + n.down = center + v_offset; + n.top_left = center - (h_offset - v_offset); + n.top_right = center + (h_offset - v_offset); + n.bottom_left = center - (h_offset + v_offset); + n.bottom_right = center + (h_offset + v_offset); + return n; +} + +float getMinimumDepth(NeighborDepthSamples ds){ + return min(ds.c_d, min(ds.l_d, min(ds.r_d, min(ds.u_d, min(ds.d_d, min(ds.tl_d, min(ds.tr_d, min(ds.bl_d, ds.br_d)))))))); +} + +float getLinearDepth(float depth, vec2 uv, mat4 inv_proj) { + vec3 ndc = vec3(uv * 2.0 - 1.0, depth); + vec4 view = inv_proj * vec4(ndc, 1.0); + view.xyz /= view.w; + return -view.z; +} + +NeighborDepthSamples getLinearDepthSamples(UVNeighbors uvs, sampler2D depth_tex, mat4 invProjMat) { + NeighborDepthSamples result; + result.c_d = getLinearDepth(texture(depth_tex, uvs.center).r, uvs.center, invProjMat); + result.l_d = getLinearDepth(texture(depth_tex, uvs.left).r , uvs.left , invProjMat); + result.r_d = getLinearDepth(texture(depth_tex, uvs.right).r , uvs.right , invProjMat); + result.u_d = getLinearDepth(texture(depth_tex, uvs.up).r , uvs.up , invProjMat); + result.d_d = getLinearDepth(texture(depth_tex, uvs.down).r , uvs.down , invProjMat); + result.tl_d = getLinearDepth(texture(depth_tex, uvs.top_left).r, uvs.top_left, invProjMat); + result.tr_d = getLinearDepth(texture(depth_tex, uvs.top_right).r, uvs.top_right, invProjMat); + result.bl_d = getLinearDepth(texture(depth_tex, uvs.bottom_left).r, uvs.bottom_left, invProjMat); + result.br_d = getLinearDepth(texture(depth_tex, uvs.bottom_right).r, uvs.bottom_right, invProjMat); + return result; +} + +float remap(float v, float from1, float to1, float from2, float to2) { + return (v - from1) / (to1 - from1) * (to2 - from2) + from2; +} + +float fresnel(float amount, vec3 normal, vec3 view) { + return pow((1.0 - clamp(dot(normalize(normal), normalize(view)), 0.0, 1.0 )), amount); +} + +float getGrazingAngleModulation(vec3 pixel_normal, vec3 view) { + float x = clamp(((fresnel(grazing_fresnel_power, pixel_normal, view) - 1.0) / grazing_angle_mask_power) + 1.0, 0.0, 1.0); + return (x + grazing_angle_modulation_factor) + 1.0; +} + +float detectEdgesDepth(NeighborDepthSamples depth_samples, vec3 pixel_normal, vec3 view) { + float n_total = + depth_samples.l_d + + depth_samples.r_d + + depth_samples.u_d + + depth_samples.d_d + + depth_samples.tl_d + + depth_samples.tr_d + + depth_samples.bl_d + + depth_samples.br_d; + + float t = depth_threshold * getGrazingAngleModulation(pixel_normal, view); + return step(t, n_total - (depth_samples.c_d * 8.0)); +} + +// Reconstruction helpers +// Source: https://www.reddit.com/r/godot/comments/v70p2k/improved_normal_from_depth/ +#ifdef SUPPORT_MOBILE +vec3 reconstructWorldPosition(float depth, mat4 model_view, mat4 inv_proj, vec2 screen_uv, mat4 world, mat4 inv_cam){ + vec4 pos = inverse(model_view) * inv_proj * vec4((screen_uv * 2.0 - 1.0), depth * 2.0 - 1.0, 1.0); + pos.xyz /= (pos.w + 0.0001 * (1.-abs(sign(pos.w)))); + return (pos * inv_cam).xyz + world[3].xyz; +} + +#ifndef NAIVE_NORMAL_RECONSTRUCTION +vec3 reconstructWorldNormal(sampler2D depth_tex, mat4 model_view, mat4 inv_proj, vec2 screen_uv, mat4 world, mat4 inv_cam, vec2 viewport_size) { + vec2 e = vec2(1.0 / viewport_size); + float c0 = texture(depth_tex, screen_uv ).r; + float l2 = texture(depth_tex, screen_uv - vec2(2,0) * e).r; + float l1 = texture(depth_tex, screen_uv - vec2(1,0) * e).r; + float r1 = texture(depth_tex, screen_uv + vec2(1,0) * e).r; + float r2 = texture(depth_tex, screen_uv + vec2(2,0) * e).r; + float b2 = texture(depth_tex, screen_uv - vec2(0,2) * e).r; + float b1 = texture(depth_tex, screen_uv - vec2(0,1) * e).r; + float t1 = texture(depth_tex, screen_uv + vec2(0,1) * e).r; + float t2 = texture(depth_tex, screen_uv + vec2(0,2) * e).r; + + float dl = abs(l1 * l2 / (2.0 * l2 - l1) - c0); + float dr = abs(r1 * r2 / (2.0 * r2 - r1) - c0); + float db = abs(b1 * b2 / (2.0 * b2 - b1) - c0); + float dt = abs(t1 * t2 / (2.0 * t2 - t1) - c0); + + vec3 ce = reconstructWorldPosition(c0, model_view, inv_proj, screen_uv, world, inv_cam); + + vec3 dpdx = (dl String: - var name_suffix = "" + var name_suffix = "" - if item is Seed: - name_suffix = tr("SEED") - if item is Package: - name_suffix = tr("PACKAGE") + if item is Seed: + name_suffix = tr("SEED") + if item is Package: + name_suffix = tr("PACKAGE") - return item.name + (" " + name_suffix if name_suffix else "") + return item.name + (" " + name_suffix if name_suffix else "") func interact_text(): - return tr("TAKE") + return tr("TAKE") func card_info() -> CardInfo: - return item.card_info() + return item.card_info() func interact(player : Player) -> bool: - player.pick_item(item) - - pickup_animation(player) - - return true + player.pick_item(item) + + pickup_animation(player) + + return true func pickup_animation(player : Player): - available = false - var tween : Tween = get_tree().create_tween() + available = false + var tween : Tween = get_tree().create_tween() - tween.tween_property(self, "position", player.position, 0.2) - tween.tween_callback( - func(): - Pointer.stop_inspect(self) - queue_free() - ) - if object_sprite: - object_sprite.pickup_animation() + tween.tween_property(self, "position", player.position, 0.2) + tween.tween_callback( + func(): + Pointer.stop_inspect(self) + queue_free() + ) + if object_sprite: + object_sprite.pickup_animation() func generate_sprite() -> ItemObjectSprite: - var sprite_node = SPRITE_SCENE.instantiate() as ItemObjectSprite - add_child(sprite_node) + var sprite_node = SPRITE_SCENE.instantiate() as ItemObjectSprite + add_child(sprite_node) - if item: - sprite_node.apply_texture_to_sprite( - item.icon, - ITEM_SPRITE_SIZE - ) + if item: + sprite_node.apply_texture_to_sprite( + item.icon, + ITEM_SPRITE_SIZE + ) - return sprite_node + return sprite_node func save() -> EntityData: - return ItemObjectData.new(self) \ No newline at end of file + return ItemObjectData.new(self) diff --git a/entities/interactables/item_object/script/item_object_data.gd b/entities/interactables/item_object/script/item_object_data.gd index e984d19..540f3eb 100644 --- a/entities/interactables/item_object/script/item_object_data.gd +++ b/entities/interactables/item_object/script/item_object_data.gd @@ -7,5 +7,5 @@ func _init(e : ItemObject): position = e.global_position item = e.item -func load() -> Entity: +func load_entity() -> Entity: return ItemObject.new(item) \ No newline at end of file diff --git a/entities/interactables/truck/assets/sprites/truck_ladder.png b/entities/interactables/ladder/assets/truck_ladder.png similarity index 100% rename from entities/interactables/truck/assets/sprites/truck_ladder.png rename to entities/interactables/ladder/assets/truck_ladder.png diff --git a/entities/interactables/truck/assets/sprites/truck_ladder.png.import b/entities/interactables/ladder/assets/truck_ladder.png.import similarity index 73% rename from entities/interactables/truck/assets/sprites/truck_ladder.png.import rename to entities/interactables/ladder/assets/truck_ladder.png.import index c6bb295..1ffaeba 100644 --- a/entities/interactables/truck/assets/sprites/truck_ladder.png.import +++ b/entities/interactables/ladder/assets/truck_ladder.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://dlrj7tyi5wfh8" -path="res://.godot/imported/truck_ladder.png-00d93dc49c0cc6457febb75d7b82dec4.ctex" +path="res://.godot/imported/truck_ladder.png-925870bf5fd0f6bfe7226189e1ff2e75.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entities/interactables/truck/assets/sprites/truck_ladder.png" -dest_files=["res://.godot/imported/truck_ladder.png-00d93dc49c0cc6457febb75d7b82dec4.ctex"] +source_file="res://entities/interactables/ladder/assets/truck_ladder.png" +dest_files=["res://.godot/imported/truck_ladder.png-925870bf5fd0f6bfe7226189e1ff2e75.ctex"] [params] diff --git a/entities/interactables/ladder/ladder.tscn b/entities/interactables/ladder/ladder.tscn new file mode 100644 index 0000000..c7b4e28 --- /dev/null +++ b/entities/interactables/ladder/ladder.tscn @@ -0,0 +1,170 @@ +[gd_scene load_steps=12 format=3 uid="uid://cg1visg52i21a"] + +[ext_resource type="Script" uid="uid://buimaomxu01wj" path="res://entities/interactables/ladder/scripts/ladder.gd" id="1_26qdk"] +[ext_resource type="Texture2D" uid="uid://dlrj7tyi5wfh8" path="res://entities/interactables/ladder/assets/truck_ladder.png" id="2_xila4"] +[ext_resource type="Texture2D" uid="uid://dex283rx00fjb" path="res://common/icons/logout.svg" id="3_214ms"] + +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_hslnw"] +radius = 26.0 +height = 112.0 + +[sub_resource type="AtlasTexture" id="AtlasTexture_gmirm"] +atlas = ExtResource("2_xila4") +region = Rect2(205, 157, 87, 208) + +[sub_resource type="Animation" id="Animation_4ixvu"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(1, 1)] +} + +[sub_resource type="Animation" id="Animation_214ms"] +resource_name = "Pulse" +length = 0.8 +loop_mode = 1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:scale") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.4, 0.8), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 0, +"values": [Vector2(1, 1), Vector2(1.4, 1.4), Vector2(1, 1)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_px7p1"] +_data = { +&"Pulse": SubResource("Animation_214ms"), +&"RESET": SubResource("Animation_4ixvu") +} + +[sub_resource type="Animation" id="Animation_bgoyn"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("TruckLadder:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(-1.25, -30)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Icon:self_modulate:a") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [0.0] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("TruckLadder:modulate:a") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [0.0] +} + +[sub_resource type="Animation" id="Animation_xvoyd"] +resource_name = "appear" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("TruckLadder:position") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.7), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector2(0, -108), Vector2(-1.25, -30)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Icon:self_modulate:a") +tracks/1/interp = 2 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0.6666667, 1), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [0.0, 1.0] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("TruckLadder:modulate:a") +tracks/2/interp = 2 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0, 1), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [0.0, 1.0] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_orxxj"] +_data = { +&"RESET": SubResource("Animation_bgoyn"), +&"appear": SubResource("Animation_xvoyd") +} + +[node name="Ladder" type="Area2D"] +script = ExtResource("1_26qdk") +default_interact_text = "ENTER_TRUCK" +default_info_title = "TRUCK_ENTRANCE" +default_info_desc = "LADDER_DESC_TEXT" +metadata/_custom_type_script = "uid://dyprcd68fjstf" + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(-0.25, -28) +shape = SubResource("CapsuleShape2D_hslnw") + +[node name="TruckLadder" type="Sprite2D" parent="."] +modulate = Color(1, 1, 1, 0) +position = Vector2(-1.25, -30) +scale = Vector2(0.5, 0.5) +texture = SubResource("AtlasTexture_gmirm") + +[node name="Icon" type="Sprite2D" parent="."] +self_modulate = Color(1, 1, 1, 0) +position = Vector2(0.75, -29.000004) +texture = ExtResource("3_214ms") + +[node name="IconAnimationPlayer" type="AnimationPlayer" parent="Icon"] +unique_name_in_owner = true +libraries = { +&"": SubResource("AnimationLibrary_px7p1") +} +autoplay = "RESET" + +[node name="LadderAnimationPlayer" type="AnimationPlayer" parent="."] +unique_name_in_owner = true +libraries = { +&"": SubResource("AnimationLibrary_orxxj") +} diff --git a/entities/interactables/ladder/scripts/ladder.gd b/entities/interactables/ladder/scripts/ladder.gd new file mode 100644 index 0000000..5bc0631 --- /dev/null +++ b/entities/interactables/ladder/scripts/ladder.gd @@ -0,0 +1,20 @@ +extends Interactable +class_name Ladder + +func _ready(): + appear() + # hide() + GameInfo.game_data.current_region_data.updated.connect( + func (region_data : RegionData): + if region_data.get_state() == RegionData.State.SUCCEEDED or region_data.get_state() == RegionData.State.FAILED: + %IconAnimationPlayer.play("Pulse") + ) + +func appear(): + show() + %LadderAnimationPlayer.play("appear") + +func interact(p : Player): + p.region.save() + SceneManager.change_scene("COCKPIT") + return true diff --git a/entities/interactables/truck/ladder/scripts/truck_ladder.gd.uid b/entities/interactables/ladder/scripts/ladder.gd.uid similarity index 100% rename from entities/interactables/truck/ladder/scripts/truck_ladder.gd.uid rename to entities/interactables/ladder/scripts/ladder.gd.uid diff --git a/entities/interactables/machines/scripts/machine.gd b/entities/interactables/machines/scripts/machine.gd deleted file mode 100644 index 4fd8a1f..0000000 --- a/entities/interactables/machines/scripts/machine.gd +++ /dev/null @@ -1,27 +0,0 @@ -extends Interactable -class_name Machine - -const MAX_MACHINE_LEVEL = 3 - -var level : int = 1 -var type : MachineType - -func pointer_text() -> String: - return type.name - -static func get_level_color(l : int) -> Color: - match l: - 1: return Color("4ed38a") - 2: return Color("4ec6ee") - 3: return Color("bd70e2") - _: return Color("bd70e2") - -static func instantiate_machine(machine_type : MachineType, machine_level = 1) -> Machine: - var new_machine : Machine = machine_type.scene.instantiate() as Machine - new_machine.level = machine_level - new_machine.type = machine_type - - return new_machine - -func save() -> EntityData: - return MachineData.new(self) \ No newline at end of file diff --git a/entities/interactables/machines/scripts/machine.gd.uid b/entities/interactables/machines/scripts/machine.gd.uid deleted file mode 100644 index 69bfa9f..0000000 --- a/entities/interactables/machines/scripts/machine.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://du7qppxobx5nd diff --git a/entities/interactables/machines/scripts/machine_data.gd b/entities/interactables/machines/scripts/machine_data.gd deleted file mode 100644 index ea6b83b..0000000 --- a/entities/interactables/machines/scripts/machine_data.gd +++ /dev/null @@ -1,13 +0,0 @@ -extends EntityData -class_name MachineData - -@export var level : int -@export var type : MachineType - -func _init(m : Machine): - position = m.global_position - level = m.level - type = m.type - -func load() -> Entity: - return Machine.instantiate_machine(type, level) \ No newline at end of file diff --git a/entities/interactables/machines/scripts/machine_data.gd.uid b/entities/interactables/machines/scripts/machine_data.gd.uid deleted file mode 100644 index ddf3f58..0000000 --- a/entities/interactables/machines/scripts/machine_data.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://b24o2jgqvfact diff --git a/entities/interactables/machines/scripts/machine_type.gd b/entities/interactables/machines/scripts/machine_type.gd deleted file mode 100644 index f3d047f..0000000 --- a/entities/interactables/machines/scripts/machine_type.gd +++ /dev/null @@ -1,6 +0,0 @@ -extends Resource -class_name MachineType - -@export var name : String -@export var scene : PackedScene -@export_multiline var description : String \ No newline at end of file diff --git a/entities/interactables/machines/scripts/machine_type.gd.uid b/entities/interactables/machines/scripts/machine_type.gd.uid deleted file mode 100644 index 72d53e2..0000000 --- a/entities/interactables/machines/scripts/machine_type.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bepx311a3f0o diff --git a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png b/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png deleted file mode 100644 index ff1c94c..0000000 Binary files a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png and /dev/null differ diff --git a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png b/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png deleted file mode 100644 index d2fffe4..0000000 Binary files a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png and /dev/null differ diff --git a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png b/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png deleted file mode 100644 index 169f6e1..0000000 Binary files a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png and /dev/null differ diff --git a/entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd b/entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd deleted file mode 100644 index c85f3b6..0000000 --- a/entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd +++ /dev/null @@ -1,90 +0,0 @@ -extends Machine -class_name SolarPanel - -const ENERGY_ICON = preload("res://common/icons/bolt.svg") - -var charged : bool = false -var recharge_days : int = 0 - -func get_days_to_recharge(l : int = level) -> int: - match l: - 1: return 2 - 2: return 2 - 3: return 2 - _: return 1 - -func get_energy_production(l : int = level) -> int: - match l: - 1: return 1 - 2: return 2 - 3: return 3 - _: return 1 - -# Méthode déclenchée par la classe planet -func _pass_day(): - if not charged: - recharge_days += 1 - if recharge_days >= get_days_to_recharge(): - set_charged(true) - -func set_charged(_charged = true, with_anim : bool = true): - charged = _charged - recharge_days = 0 - if with_anim: - if charged: - %AnimationPlayer.play("charged") - else : - %AnimationPlayer.play_backwards("charged") - await %AnimationPlayer.animation_finished - %Flair.modulate = Color.WHITE if charged else Color.TRANSPARENT - %Pannels.modulate = Color.WHITE if charged else Color("6c6c6c") - -func card_info() -> CardInfo: - var info = CardInfo.new( - pointer_text() - ) - - if default_info_desc != "": - var desc_section = CardSectionInfo.new( - tr("DESCRIPTION"), - default_info_desc - ) - desc_section.title_icon = DESC_ICON - info.sections.append( - desc_section - ) - - var charged_text = tr("CHARGED") - - if not charged and (get_days_to_recharge() - recharge_days) == 1: - charged_text = tr("1_DAY_BEFORE_CHARGE") - elif not charged and (get_days_to_recharge() - recharge_days) > 1: - charged_text = tr("%d_DAYS_BEFORE_CHARGE") % (get_days_to_recharge() - recharge_days) - - info.stats.append( - CardStatInfo.new( - charged_text, - ENERGY_ICON - ) - ) - - return info - - -func setup_machine_sprite(): - # %Base.self_modulate = Machine.get_level_color(level) - pass - -func interact_text(): - return tr("RECHARGE_%d_ENERGY") % get_energy_production() - -func can_interact(_p : Player) -> bool: - return charged - -func interact(p : Player) -> bool: - p.recharge(get_energy_production()) - set_charged(false) - return true - -func save() -> EntityData: - return SolarPanelData.new(self) diff --git a/entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd.uid b/entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd.uid deleted file mode 100644 index bf728bb..0000000 --- a/entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bjy8gc0eyl2ss diff --git a/entities/interactables/machines/solar_pannel/scripts/solar_pannel_data.gd b/entities/interactables/machines/solar_pannel/scripts/solar_pannel_data.gd deleted file mode 100644 index e6001da..0000000 --- a/entities/interactables/machines/solar_pannel/scripts/solar_pannel_data.gd +++ /dev/null @@ -1,19 +0,0 @@ -extends MachineData -class_name SolarPanelData - -@export var charged : bool = false -@export var recharge_days : int = 0 - -func _init(m : SolarPanel): - position = m.global_position - level = m.level - type = m.type - charged = m.charged - recharge_days = m.recharge_days - -func load() -> Entity: - var sp = Machine.instantiate_machine(type, level) as SolarPanel - sp.set_charged(charged, false) - sp.recharge_days = recharge_days - - return sp diff --git a/entities/interactables/machines/solar_pannel/scripts/solar_pannel_data.gd.uid b/entities/interactables/machines/solar_pannel/scripts/solar_pannel_data.gd.uid deleted file mode 100644 index 4eaab05..0000000 --- a/entities/interactables/machines/solar_pannel/scripts/solar_pannel_data.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dv1tok0civrpp diff --git a/entities/interactables/machines/solar_pannel/solar_pannel.tres b/entities/interactables/machines/solar_pannel/solar_pannel.tres deleted file mode 100644 index 3803c89..0000000 --- a/entities/interactables/machines/solar_pannel/solar_pannel.tres +++ /dev/null @@ -1,11 +0,0 @@ -[gd_resource type="Resource" script_class="MachineType" load_steps=3 format=3 uid="uid://dew3p4fffjryo"] - -[ext_resource type="Script" uid="uid://bepx311a3f0o" path="res://entities/interactables/machines/scripts/machine_type.gd" id="1_ctita"] -[ext_resource type="PackedScene" uid="uid://gwq2oos6ljyp" path="res://entities/interactables/machines/solar_pannel/solar_pannel.tscn" id="1_naexs"] - -[resource] -script = ExtResource("1_ctita") -name = "SOLAR_PANNEL" -scene = ExtResource("1_naexs") -description = "SOLAR_PANNEL_DESCRIPTION_TEXT" -metadata/_custom_type_script = "uid://bepx311a3f0o" diff --git a/entities/interactables/machines/solar_pannel/solar_pannel.tscn b/entities/interactables/machines/solar_pannel/solar_pannel.tscn deleted file mode 100644 index 959e6e1..0000000 --- a/entities/interactables/machines/solar_pannel/solar_pannel.tscn +++ /dev/null @@ -1,104 +0,0 @@ -[gd_scene load_steps=9 format=3 uid="uid://gwq2oos6ljyp"] - -[ext_resource type="Script" uid="uid://bjy8gc0eyl2ss" path="res://entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd" id="1_t4vnu"] -[ext_resource type="Texture2D" uid="uid://b1n8nad43usw4" path="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png" id="2_ny3sb"] -[ext_resource type="Texture2D" uid="uid://cqqlkm14lawpa" path="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png" id="3_bml32"] -[ext_resource type="Texture2D" uid="uid://c22re5wfsm1ax" path="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png" id="4_ob8kj"] - -[sub_resource type="CircleShape2D" id="CircleShape2D_6utw7"] -radius = 48.0 - -[sub_resource type="Animation" id="Animation_77hon"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Sprites/Pannels:modulate") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [Color(0.42352942, 0.42352942, 0.42352942, 1)] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Sprites/Flair:modulate") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [Color(1, 1, 1, 0)] -} - -[sub_resource type="Animation" id="Animation_gal8b"] -resource_name = "charged" -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Sprites/Pannels:modulate") -tracks/0/interp = 2 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0.033333335, 1), -"transitions": PackedFloat32Array(1, 1), -"update": 0, -"values": [Color(0.42365062, 0.42365065, 0.42365062, 1), Color(1, 1, 1, 1)] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Sprites/Flair:modulate") -tracks/1/interp = 2 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0, 1), -"transitions": PackedFloat32Array(1, 1), -"update": 0, -"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)] -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_5vw1f"] -_data = { -&"RESET": SubResource("Animation_77hon"), -&"charged": SubResource("Animation_gal8b") -} - -[node name="SolarPannel" type="Area2D"] -script = ExtResource("1_t4vnu") -default_interact_text = "USE" -default_info_title = "SOLAR_PANNEL" -default_info_desc = "SOLAR_PANNEL_DESCRIPTION_TEXT" -metadata/_custom_type_script = "uid://du7qppxobx5nd" - -[node name="Sprites" type="Node2D" parent="."] -position = Vector2(15.999999, -16.999998) -scale = Vector2(0.09, 0.09) - -[node name="Pannels" type="Sprite2D" parent="Sprites"] -unique_name_in_owner = true -modulate = Color(0.42352942, 0.42352942, 0.42352942, 1) -texture = ExtResource("2_ny3sb") - -[node name="Base" type="Sprite2D" parent="Sprites"] -unique_name_in_owner = true -texture = ExtResource("3_bml32") - -[node name="Flair" type="Sprite2D" parent="Sprites"] -unique_name_in_owner = true -modulate = Color(1, 1, 1, 0) -texture = ExtResource("4_ob8kj") - -[node name="CollisionShape2D" type="CollisionShape2D" parent="."] -position = Vector2(6, -23) -shape = SubResource("CircleShape2D_6utw7") - -[node name="AnimationPlayer" type="AnimationPlayer" parent="."] -unique_name_in_owner = true -libraries = { -&"": SubResource("AnimationLibrary_5vw1f") -} diff --git a/entities/interactables/truck/ladder/scripts/truck_ladder.gd b/entities/interactables/truck/ladder/scripts/truck_ladder.gd deleted file mode 100644 index 26f4915..0000000 --- a/entities/interactables/truck/ladder/scripts/truck_ladder.gd +++ /dev/null @@ -1,7 +0,0 @@ -extends Interactable -class_name TruckLadder - -func interact(p : Player): - p.planet.save() - SceneManager.change_scene(SceneManager.COCKPIT_SCENE) - return true diff --git a/entities/interactables/truck/ladder/truck_ladder.tscn b/entities/interactables/truck/ladder/truck_ladder.tscn deleted file mode 100644 index 97cd165..0000000 --- a/entities/interactables/truck/ladder/truck_ladder.tscn +++ /dev/null @@ -1,33 +0,0 @@ -[gd_scene load_steps=6 format=3 uid="uid://cg1visg52i21a"] - -[ext_resource type="Script" uid="uid://buimaomxu01wj" path="res://entities/interactables/truck/ladder/scripts/truck_ladder.gd" id="1_26qdk"] -[ext_resource type="Texture2D" uid="uid://dlrj7tyi5wfh8" path="res://entities/interactables/truck/assets/sprites/truck_ladder.png" id="2_xila4"] -[ext_resource type="Texture2D" uid="uid://dex283rx00fjb" path="res://common/icons/logout.svg" id="3_214ms"] - -[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_hslnw"] -radius = 26.0 -height = 112.0 - -[sub_resource type="AtlasTexture" id="AtlasTexture_gmirm"] -atlas = ExtResource("2_xila4") -region = Rect2(205, 157, 87, 208) - -[node name="TruckLadder" type="Area2D"] -script = ExtResource("1_26qdk") -default_interact_text = "ENTER_TRUCK" -default_info_title = "TRUCK_ENTRANCE" -default_info_desc = "LADDER_DESC_TEXT" -metadata/_custom_type_script = "uid://dyprcd68fjstf" - -[node name="CollisionShape2D" type="CollisionShape2D" parent="."] -position = Vector2(-0.25, -28) -shape = SubResource("CapsuleShape2D_hslnw") - -[node name="TruckLadder" type="Sprite2D" parent="."] -position = Vector2(-1.25, -30) -scale = Vector2(0.5, 0.5) -texture = SubResource("AtlasTexture_gmirm") - -[node name="Bolt" type="Sprite2D" parent="."] -position = Vector2(0.75, -29.000004) -texture = ExtResource("3_214ms") diff --git a/entities/interactables/truck/recharge/scripts/truck_recharge.gd b/entities/interactables/truck/recharge/scripts/truck_recharge.gd index dfe3e21..a69a8db 100644 --- a/entities/interactables/truck/recharge/scripts/truck_recharge.gd +++ b/entities/interactables/truck/recharge/scripts/truck_recharge.gd @@ -1,20 +1,24 @@ extends Interactable class_name TruckRecharge +func _ready(): + if region: + %Bolt.modulate = Color.WHITE if region.data.charges > 0 else Color.RED + func can_interact(_p : Player) -> bool: return ( - planet != null - and planet.data - and planet.data.charges > 0 + region != null + and region.data + and region.data.charges > 0 ) func interact(_p: Player) -> bool: if can_interact(_p): - planet.data.charges -= 1 - planet.pass_day() + region.data.charges -= 1 + region.pass_day() - %Bolt.modulate = Color.WHITE if planet.data.charges > 0 else Color.RED + %Bolt.modulate = Color.WHITE if region.data.charges > 0 else Color.RED return true return false diff --git a/entities/interactables/truck/recharge/truck_recharge.tscn b/entities/interactables/truck/recharge/truck_recharge.tscn index cb02ec9..3aed9f5 100644 --- a/entities/interactables/truck/recharge/truck_recharge.tscn +++ b/entities/interactables/truck/recharge/truck_recharge.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=6 format=3 uid="uid://d324mlmgls4fs"] [ext_resource type="Script" uid="uid://bsrn3gd2a532q" path="res://entities/interactables/truck/recharge/scripts/truck_recharge.gd" id="1_ipgcv"] -[ext_resource type="Texture2D" uid="uid://dlrj7tyi5wfh8" path="res://entities/interactables/truck/assets/sprites/truck_ladder.png" id="2_87dtp"] +[ext_resource type="Texture2D" uid="uid://dlrj7tyi5wfh8" path="res://entities/interactables/ladder/assets/truck_ladder.png" id="2_87dtp"] [ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="3_jcfmm"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_bjhct"] diff --git a/entities/plants/assets/sprites/default/dead.png b/entities/plants/assets/sprites/default/dead.png new file mode 100644 index 0000000..eb0b224 Binary files /dev/null and b/entities/plants/assets/sprites/default/dead.png differ diff --git a/stages/terrain/truck/assets/sprite/truck_interior.png.import b/entities/plants/assets/sprites/default/dead.png.import similarity index 71% rename from stages/terrain/truck/assets/sprite/truck_interior.png.import rename to entities/plants/assets/sprites/default/dead.png.import index 684421e..0c90db4 100644 --- a/stages/terrain/truck/assets/sprite/truck_interior.png.import +++ b/entities/plants/assets/sprites/default/dead.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://d2p7h0aga85tn" -path="res://.godot/imported/truck_interior.png-ff9bd2d0107d83f7c4209d959ee69f15.ctex" +uid="uid://b0kllgnpxuh54" +path="res://.godot/imported/dead.png-ef8b87be14a560f3ce6b4050f956f227.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/truck/assets/sprite/truck_interior.png" -dest_files=["res://.godot/imported/truck_interior.png-ff9bd2d0107d83f7c4209d959ee69f15.ctex"] +source_file="res://entities/plants/assets/sprites/default/dead.png" +dest_files=["res://.godot/imported/dead.png-ef8b87be14a560f3ce6b4050f956f227.ctex"] [params] diff --git a/entities/plants/assets/sprites/solita/growing.png b/entities/plants/assets/sprites/default/growing.png similarity index 100% rename from entities/plants/assets/sprites/solita/growing.png rename to entities/plants/assets/sprites/default/growing.png diff --git a/entities/plants/assets/sprites/solita/growing.png.import b/entities/plants/assets/sprites/default/growing.png.import similarity index 75% rename from entities/plants/assets/sprites/solita/growing.png.import rename to entities/plants/assets/sprites/default/growing.png.import index d8cd11e..b6017ed 100644 --- a/entities/plants/assets/sprites/solita/growing.png.import +++ b/entities/plants/assets/sprites/default/growing.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://c00jac2jlgdfu" -path="res://.godot/imported/growing.png-47abe743f83ddd7bdc16b98f9d66692f.ctex" +path="res://.godot/imported/growing.png-3f6fb3171589f3a22ebfeda1a4575199.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entities/plants/assets/sprites/solita/growing.png" -dest_files=["res://.godot/imported/growing.png-47abe743f83ddd7bdc16b98f9d66692f.ctex"] +source_file="res://entities/plants/assets/sprites/default/growing.png" +dest_files=["res://.godot/imported/growing.png-3f6fb3171589f3a22ebfeda1a4575199.ctex"] [params] diff --git a/entities/plants/assets/sprites/solita/mature.png b/entities/plants/assets/sprites/default/mature.png similarity index 100% rename from entities/plants/assets/sprites/solita/mature.png rename to entities/plants/assets/sprites/default/mature.png diff --git a/entities/plants/assets/sprites/solita/mature.png.import b/entities/plants/assets/sprites/default/mature.png.import similarity index 75% rename from entities/plants/assets/sprites/solita/mature.png.import rename to entities/plants/assets/sprites/default/mature.png.import index cac8dfa..362c774 100644 --- a/entities/plants/assets/sprites/solita/mature.png.import +++ b/entities/plants/assets/sprites/default/mature.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://b3wom2xu26g43" -path="res://.godot/imported/mature.png-834a1cd5820fc22805f96d5019fd7c30.ctex" +path="res://.godot/imported/mature.png-f8b2b72a84e90cfc6bf925d1d48f7f7e.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entities/plants/assets/sprites/solita/mature.png" -dest_files=["res://.godot/imported/mature.png-834a1cd5820fc22805f96d5019fd7c30.ctex"] +source_file="res://entities/plants/assets/sprites/default/mature.png" +dest_files=["res://.godot/imported/mature.png-f8b2b72a84e90cfc6bf925d1d48f7f7e.ctex"] [params] diff --git a/entities/plants/assets/sprites/default/seed.png b/entities/plants/assets/sprites/default/seed.png new file mode 100644 index 0000000..84348e4 Binary files /dev/null and b/entities/plants/assets/sprites/default/seed.png differ diff --git a/entities/plants/assets/sprites/default/seed.png.import b/entities/plants/assets/sprites/default/seed.png.import new file mode 100644 index 0000000..73e5d58 --- /dev/null +++ b/entities/plants/assets/sprites/default/seed.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bruce7ds0u8i1" +path="res://.godot/imported/seed.png-634c35552c5b52a8d7f2a15b4c2c65e4.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://entities/plants/assets/sprites/default/seed.png" +dest_files=["res://.godot/imported/seed.png-634c35552c5b52a8d7f2a15b4c2c65e4.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 diff --git a/entities/plants/assets/sprites/seeds/seeds.tres b/entities/plants/assets/sprites/seeds/seeds.tres new file mode 100644 index 0000000..c18943a --- /dev/null +++ b/entities/plants/assets/sprites/seeds/seeds.tres @@ -0,0 +1,6 @@ +[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://m48oo6cqbq37"] + +[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="1_v3qq7"] + +[resource] +atlas = ExtResource("1_v3qq7") diff --git a/entities/plants/resources/plant_types/champ.tres b/entities/plants/resources/plant_types/champ.tres deleted file mode 100644 index 3a6c463..0000000 --- a/entities/plants/resources/plant_types/champ.tres +++ /dev/null @@ -1,28 +0,0 @@ -[gd_resource type="Resource" script_class="PlantType" load_steps=9 format=3 uid="uid://cxrc5wchpqm18"] - -[ext_resource type="Script" uid="uid://ceqx5va1ormau" path="res://entities/plants/scripts/plant_effects/produce_seeds.gd" id="1_cf34j"] -[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="1_ipcpv"] -[ext_resource type="Script" uid="uid://bpycohqas4hff" path="res://entities/plants/scripts/plant_effect.gd" id="1_l2hi3"] -[ext_resource type="Texture2D" uid="uid://dmsls8siudy1u" path="res://entities/plants/assets/sprites/champ/growing.png" id="2_l2hi3"] -[ext_resource type="Texture2D" uid="uid://crc4aop6ajiau" path="res://entities/plants/assets/sprites/champ/mature.png" id="3_y8qve"] -[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="6_liopn"] - -[sub_resource type="Resource" id="Resource_cf34j"] -script = ExtResource("1_cf34j") -level = 2 -metadata/_custom_type_script = "uid://ceqx5va1ormau" - -[sub_resource type="AtlasTexture" id="AtlasTexture_my6by"] -atlas = ExtResource("6_liopn") -region = Rect2(610, 315, 124, 180) - -[resource] -script = ExtResource("1_ipcpv") -name = "Champ" -description = "A cool fluorescent mushroom that reproduce very fast." -default_growing_time = 3 -seed_texture = SubResource("AtlasTexture_my6by") -growing_texture = ExtResource("2_l2hi3") -mature_texture = ExtResource("3_y8qve") -mature_effects = Array[ExtResource("1_l2hi3")]([SubResource("Resource_cf34j")]) -metadata/_custom_type_script = "uid://jnye5pe1bgqw" diff --git a/entities/plants/resources/plant_types/chardi.tres b/entities/plants/resources/plant_types/chardi.tres deleted file mode 100644 index 0ae97d4..0000000 --- a/entities/plants/resources/plant_types/chardi.tres +++ /dev/null @@ -1,34 +0,0 @@ -[gd_resource type="Resource" script_class="PlantType" load_steps=11 format=3 uid="uid://b04vho33bl52b"] - -[ext_resource type="Script" uid="uid://bpycohqas4hff" path="res://entities/plants/scripts/plant_effect.gd" id="1_40c3e"] -[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="1_moyj3"] -[ext_resource type="Texture2D" uid="uid://c7mp7tkkkk6o5" path="res://entities/plants/assets/sprites/chardi/growing.png" id="1_prk5s"] -[ext_resource type="Script" uid="uid://ceqx5va1ormau" path="res://entities/plants/scripts/plant_effects/produce_seeds.gd" id="2_prk5s"] -[ext_resource type="Texture2D" uid="uid://bupl1y0cfj21q" path="res://entities/plants/assets/sprites/chardi/mature.png" id="3_40c3e"] -[ext_resource type="Script" uid="uid://cgscbuxe4dawb" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="3_ajihu"] -[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="6_cky1j"] - -[sub_resource type="Resource" id="Resource_40c3e"] -script = ExtResource("2_prk5s") -level = 2 -metadata/_custom_type_script = "uid://ceqx5va1ormau" - -[sub_resource type="Resource" id="Resource_ajihu"] -script = ExtResource("3_ajihu") -level = 1 -metadata/_custom_type_script = "uid://cgscbuxe4dawb" - -[sub_resource type="AtlasTexture" id="AtlasTexture_qt76e"] -atlas = ExtResource("6_cky1j") -region = Rect2(1140, 345, 141, 128) - -[resource] -script = ExtResource("1_moyj3") -name = "Chardi" -description = "This fern use the bas component of the ground to grow." -seed_texture = SubResource("AtlasTexture_qt76e") -growing_texture = ExtResource("1_prk5s") -mature_texture = ExtResource("3_40c3e") -harvest_effects = Array[ExtResource("1_40c3e")]([SubResource("Resource_40c3e")]) -mature_effects = Array[ExtResource("1_40c3e")]([SubResource("Resource_ajihu")]) -metadata/_custom_type_script = "uid://jnye5pe1bgqw" diff --git a/entities/plants/resources/plant_types/ferno.tres b/entities/plants/resources/plant_types/ferno.tres deleted file mode 100644 index c161b8c..0000000 --- a/entities/plants/resources/plant_types/ferno.tres +++ /dev/null @@ -1,33 +0,0 @@ -[gd_resource type="Resource" script_class="PlantType" load_steps=11 format=3 uid="uid://djap3rggcdf3r"] - -[ext_resource type="Script" uid="uid://bpycohqas4hff" path="res://entities/plants/scripts/plant_effect.gd" id="1_srjq6"] -[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="2_72r72"] -[ext_resource type="Script" uid="uid://ceqx5va1ormau" path="res://entities/plants/scripts/plant_effects/produce_seeds.gd" id="2_rb4mq"] -[ext_resource type="Script" uid="uid://cgscbuxe4dawb" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="3_s6g12"] -[ext_resource type="Texture2D" uid="uid://ds1nf2876m6bh" path="res://entities/plants/assets/sprites/ferno/growing.png" id="4_5qaoo"] -[ext_resource type="Texture2D" uid="uid://bfj6wji21amgk" path="res://entities/plants/assets/sprites/ferno/mature.png" id="5_er4cp"] -[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="7_0y7r8"] - -[sub_resource type="Resource" id="Resource_rb4mq"] -script = ExtResource("2_rb4mq") -level = 2 -metadata/_custom_type_script = "uid://ceqx5va1ormau" - -[sub_resource type="Resource" id="Resource_s6g12"] -script = ExtResource("3_s6g12") -level = 1 -metadata/_custom_type_script = "uid://cgscbuxe4dawb" - -[sub_resource type="AtlasTexture" id="AtlasTexture_g1td4"] -atlas = ExtResource("7_0y7r8") -region = Rect2(57, 620, 159, 99) - -[resource] -script = ExtResource("2_72r72") -name = "Ferno" -description = "This mysterious flower emmit a strong signal in the ground when harvested." -seed_texture = SubResource("AtlasTexture_g1td4") -growing_texture = ExtResource("4_5qaoo") -mature_texture = ExtResource("5_er4cp") -harvest_effects = Array[ExtResource("1_srjq6")]([SubResource("Resource_rb4mq"), SubResource("Resource_s6g12")]) -metadata/_custom_type_script = "uid://jnye5pe1bgqw" diff --git a/entities/plants/resources/plant_types/maias.tres b/entities/plants/resources/plant_types/maias.tres deleted file mode 100644 index 588f59e..0000000 --- a/entities/plants/resources/plant_types/maias.tres +++ /dev/null @@ -1,27 +0,0 @@ -[gd_resource type="Resource" script_class="PlantType" load_steps=9 format=3 uid="uid://dsctivn1vrem2"] - -[ext_resource type="Script" uid="uid://bpycohqas4hff" path="res://entities/plants/scripts/plant_effect.gd" id="1_740j2"] -[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="1_eqtut"] -[ext_resource type="Texture2D" uid="uid://dwr3c6r6piwaa" path="res://entities/plants/assets/sprites/maias/growing.png" id="1_vyplc"] -[ext_resource type="Script" uid="uid://ceqx5va1ormau" path="res://entities/plants/scripts/plant_effects/produce_seeds.gd" id="2_740j2"] -[ext_resource type="Texture2D" uid="uid://d3apfwbqsg5ha" path="res://entities/plants/assets/sprites/maias/mature.png" id="3_pi4ie"] -[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="6_mwrj8"] - -[sub_resource type="Resource" id="Resource_740j2"] -script = ExtResource("2_740j2") -level = 3 -metadata/_custom_type_script = "uid://ceqx5va1ormau" - -[sub_resource type="AtlasTexture" id="AtlasTexture_sri3b"] -atlas = ExtResource("6_mwrj8") -region = Rect2(1697, 331, 125, 158) - -[resource] -script = ExtResource("1_eqtut") -name = "Maias" -description = "This gorgeous flower produce a lot of seeds when harvested." -seed_texture = SubResource("AtlasTexture_sri3b") -growing_texture = ExtResource("1_vyplc") -mature_texture = ExtResource("3_pi4ie") -harvest_effects = Array[ExtResource("1_740j2")]([SubResource("Resource_740j2")]) -metadata/_custom_type_script = "uid://jnye5pe1bgqw" diff --git a/entities/plants/resources/plant_types/philea.tres b/entities/plants/resources/plant_types/philea.tres deleted file mode 100644 index f644156..0000000 --- a/entities/plants/resources/plant_types/philea.tres +++ /dev/null @@ -1,29 +0,0 @@ -[gd_resource type="Resource" script_class="PlantType" load_steps=9 format=3 uid="uid://dr4omh4gf85hl"] - -[ext_resource type="Script" uid="uid://bpycohqas4hff" path="res://entities/plants/scripts/plant_effect.gd" id="1_mi4ef"] -[ext_resource type="Script" uid="uid://ceqx5va1ormau" path="res://entities/plants/scripts/plant_effects/produce_seeds.gd" id="2_jyjjp"] -[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="2_lqh06"] -[ext_resource type="Texture2D" uid="uid://dna7x371cs0tu" path="res://entities/plants/assets/sprites/philea/growing.png" id="3_n0hvm"] -[ext_resource type="Texture2D" uid="uid://bj801geprrhfu" path="res://entities/plants/assets/sprites/philea/mature.png" id="4_cafy4"] -[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="6_oaspo"] - -[sub_resource type="Resource" id="Resource_jyjjp"] -script = ExtResource("2_jyjjp") -level = 1 -metadata/_custom_type_script = "uid://ceqx5va1ormau" - -[sub_resource type="AtlasTexture" id="AtlasTexture_ogrgq"] -atlas = ExtResource("6_oaspo") -region = Rect2(322, 598, 159, 136) - -[resource] -script = ExtResource("2_lqh06") -name = "Philea" -description = "A very cool shurb that glow in the night." -default_growing_time = 5 -default_plant_score = 3 -seed_texture = SubResource("AtlasTexture_ogrgq") -growing_texture = ExtResource("3_n0hvm") -mature_texture = ExtResource("4_cafy4") -mature_effects = Array[ExtResource("1_mi4ef")]([SubResource("Resource_jyjjp")]) -metadata/_custom_type_script = "uid://jnye5pe1bgqw" diff --git a/entities/plants/resources/plant_types/pili.tres b/entities/plants/resources/plant_types/pili.tres deleted file mode 100644 index db4a62b..0000000 --- a/entities/plants/resources/plant_types/pili.tres +++ /dev/null @@ -1,35 +0,0 @@ -[gd_resource type="Resource" script_class="PlantType" load_steps=11 format=3 uid="uid://c5oxxif3h5yxo"] - -[ext_resource type="Script" uid="uid://bpycohqas4hff" path="res://entities/plants/scripts/plant_effect.gd" id="1_8fstu"] -[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="1_vn146"] -[ext_resource type="Script" uid="uid://cgscbuxe4dawb" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="2_8fstu"] -[ext_resource type="Texture2D" uid="uid://xw47qw12d3dv" path="res://entities/plants/assets/sprites/pili/growing.png" id="2_k4b1k"] -[ext_resource type="Texture2D" uid="uid://4mh1w1f4q2sa" path="res://entities/plants/assets/sprites/pili/mature.png" id="3_8fstu"] -[ext_resource type="Script" uid="uid://ceqx5va1ormau" path="res://entities/plants/scripts/plant_effects/produce_seeds.gd" id="3_26e4l"] -[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="5_26e4l"] - -[sub_resource type="Resource" id="Resource_8fstu"] -script = ExtResource("3_26e4l") -level = 2 -metadata/_custom_type_script = "uid://ceqx5va1ormau" - -[sub_resource type="Resource" id="Resource_26e4l"] -script = ExtResource("2_8fstu") -level = 2 -metadata/_custom_type_script = "uid://cgscbuxe4dawb" - -[sub_resource type="AtlasTexture" id="AtlasTexture_kidty"] -atlas = ExtResource("5_26e4l") -region = Rect2(1415, 91, 149, 102) - -[resource] -script = ExtResource("1_vn146") -name = "Pili" -description = "This cool plant produce softs and warms blue flames." -default_growing_time = 3 -seed_texture = SubResource("AtlasTexture_kidty") -growing_texture = ExtResource("2_k4b1k") -mature_texture = ExtResource("3_8fstu") -harvest_effects = Array[ExtResource("1_8fstu")]([SubResource("Resource_8fstu")]) -mature_effects = Array[ExtResource("1_8fstu")]([SubResource("Resource_26e4l")]) -metadata/_custom_type_script = "uid://jnye5pe1bgqw" diff --git a/entities/plants/resources/plant_types/solita.tres b/entities/plants/resources/plant_types/solita.tres deleted file mode 100644 index 72e9c3b..0000000 --- a/entities/plants/resources/plant_types/solita.tres +++ /dev/null @@ -1,29 +0,0 @@ -[gd_resource type="Resource" script_class="PlantType" load_steps=9 format=3 uid="uid://cuk3hl5tkjhmg"] - -[ext_resource type="Script" uid="uid://bpycohqas4hff" path="res://entities/plants/scripts/plant_effect.gd" id="1_mksys"] -[ext_resource type="Script" uid="uid://ceqx5va1ormau" path="res://entities/plants/scripts/plant_effects/produce_seeds.gd" id="2_1q5bp"] -[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="2_x4nie"] -[ext_resource type="Texture2D" uid="uid://c00jac2jlgdfu" path="res://entities/plants/assets/sprites/solita/growing.png" id="3_j4n5p"] -[ext_resource type="Texture2D" uid="uid://b3wom2xu26g43" path="res://entities/plants/assets/sprites/solita/mature.png" id="4_njidq"] -[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="6_yn0yu"] - -[sub_resource type="Resource" id="Resource_j4n5p"] -script = ExtResource("2_1q5bp") -level = 2 -metadata/_custom_type_script = "uid://ceqx5va1ormau" - -[sub_resource type="AtlasTexture" id="AtlasTexture_auuc2"] -atlas = ExtResource("6_yn0yu") -region = Rect2(335, 74, 134, 142) - -[resource] -script = ExtResource("2_x4nie") -name = "Solita" -description = "A magnificient flower that reflect the light of nearest star." -default_growing_time = 3 -default_plant_score = 2 -seed_texture = SubResource("AtlasTexture_auuc2") -growing_texture = ExtResource("3_j4n5p") -mature_texture = ExtResource("4_njidq") -harvest_effects = Array[ExtResource("1_mksys")]([SubResource("Resource_j4n5p")]) -metadata/_custom_type_script = "uid://jnye5pe1bgqw" diff --git a/entities/plants/scripts/plant.gd b/entities/plants/scripts/plant.gd index 9e88b5a..27b3072 100644 --- a/entities/plants/scripts/plant.gd +++ b/entities/plants/scripts/plant.gd @@ -1,205 +1,184 @@ extends InspectableEntity class_name Plant -signal harvested(p: Plant) -signal state_changed(p: Plant) - const PLANT_AREA_RADIUS = 20 const PLANT_INFLUENCE_RADIUS = 100 const HARVESTED_SEED_DISPLACEMENT_FACTOR = 100 -const RANDOM_MAX_GROW_INTERVAL = Planet.MIN_PASS_DAY_ANIMATION_TIME/2. - 0.1 +const RANDOM_MAX_GROW_INTERVAL = Region.MIN_PASS_DAY_ANIMATION_TIME/2. - 0.1 const PLANT_TYPE_ICON = preload("res://common/icons/seedling.svg") const PLANT_POINT_ICON = preload("res://common/icons/growth.svg") const LIFETIME_ICON = preload("res://common/icons/calendar-week.svg") const SHOVEL_ICON = preload("res://common/icons/shovel.svg") const GROWING_ICON = preload("res://common/icons/chevrons-up.svg") +const DEATH_ICON = preload("res://common/icons/skull.svg") const SPRITE_SCENE : PackedScene = preload("res://entities/plants/plant_sprite.tscn") -enum State {PLANTED, GROWING, MATURE} - -@export var plant_type: PlantType - -var state: State = State.PLANTED -@export var day: int +@export var data : PlantData @onready var plant_sprite: PlantSprite @onready var collision_shape: CollisionShape2D @onready var influence_zone : PlantInfluenceZone -var plant_score = 0 -var plant_mutations : Array[PlantMutation] = [] - func _init( - _plant_type : PlantType, - _plant_mutations : Array[PlantMutation] = [], - _day = 0, + _data : PlantData ): - plant_type = _plant_type - - day = _day - - plant_mutations = _plant_mutations + data = _data func _ready(): - plant_sprite = generate_sprite() - collision_shape = generate_collision_shape() - influence_zone = generate_influence_zone() + plant_sprite = generate_sprite() + collision_shape = generate_collision_shape() + influence_zone = generate_influence_zone() - update_plant(false) - plant_sprite.update_plant_sprite(self, false) + plant_sprite.update_plant_sprite(data, false) func pointer_text() -> String: - return plant_type.name + return data.plant_name func inspect(is_inspected : bool = true): - plant_sprite.modulate = MODULATE_INSPECTED_COLOR if is_inspected else default_modulate - influence_zone.show_influence = is_inspected + plant_sprite.modulate = MODULATE_INSPECTED_COLOR if is_inspected else default_modulate + influence_zone.show_influence = is_inspected func affect_preview(is_affected : bool = true): - plant_sprite.modulate = MODULATE_AFFECTED_COLOR if is_affected else default_modulate + plant_sprite.modulate = MODULATE_AFFECTED_COLOR if is_affected else default_modulate func generate_sprite() -> PlantSprite: - var sprite_object : PlantSprite = SPRITE_SCENE.instantiate() + var sprite_object : PlantSprite = SPRITE_SCENE.instantiate() - add_child(sprite_object) - sprite_object.generate_mutation_effects(self) + add_child(sprite_object) + sprite_object.generate_mutation_effects(self) - return sprite_object + return sprite_object func generate_collision_shape() -> CollisionShape2D: - var collision = CollisionShape2D.new() - var shape = CircleShape2D.new() - shape.radius = PLANT_AREA_RADIUS + var collision = CollisionShape2D.new() + var shape = CircleShape2D.new() + shape.radius = PLANT_AREA_RADIUS - collision.shape = shape - add_child(collision) + collision.shape = shape + add_child(collision) - return collision + return collision func generate_influence_zone() -> PlantInfluenceZone: - var zone = PlantInfluenceZone.new(PLANT_INFLUENCE_RADIUS) + var zone = PlantInfluenceZone.new(PLANT_INFLUENCE_RADIUS) - add_child(zone) + add_child(zone) - return zone + return zone -# Méthode déclenchée par la classe planet +# Méthode déclenchée par la classe region func _pass_day(): - await get_tree().create_timer(randf_range(0., RANDOM_MAX_GROW_INTERVAL)).timeout - - if state == State.MATURE and len(plant_type.cyclic_effects): - for effect in plant_type.cyclic_effects: - effect.effect(self) - - var old_state = state + await get_tree().create_timer(randf_range(0., RANDOM_MAX_GROW_INTERVAL)).timeout + + var last_state = data.get_state() - day += 1 - update_plant() + data.day += 1 + + for m in data.mutations: + m._start_day_effect(self) - if old_state != state and state == State.MATURE: - for effect in plant_type.mature_effects: - if effect : effect.effect(self) - for effect in plant_type.cyclic_effects: - if effect : effect.effect(self) + match data.get_state(): + PlantData.State.MATURE: + if last_state != PlantData.State.MATURE: + mature() + PlantData.State.DEAD: + die() + + + plant_sprite.update_plant_sprite(data, last_state != data.get_state()) -func update_plant(with_animation : bool = true): - if day + 1 > calculate_grow_time(): - if state != State.MATURE: - change_state(State.MATURE, with_animation) - elif day == 0: - change_state(State.PLANTED, with_animation) - else: - if state != State.GROWING: - change_state(State.GROWING, with_animation) func calculate_plant_score( - overwite_state : State = state + with_state : PlantData.State = data.get_state() ) -> int: - var mutated_plant_score = plant_type.default_plant_score if overwite_state == State.MATURE else 0 - - for m in plant_mutations: - mutated_plant_score = m.mutate_score(overwite_state, self, mutated_plant_score) - - return mutated_plant_score - -func calculate_grow_time() -> int: - var mutated_grow_time = plant_type.default_growing_time - - for m in plant_mutations: - mutated_grow_time = m.mutate_grow_time(self, mutated_grow_time) - - return max(1, mutated_grow_time) - -func change_state(_state: State, with_animation : bool = true): - if state != _state: - state = _state - - plant_sprite.update_plant_sprite(self, with_animation) - state_changed.emit(self) + return data.get_score(with_state) func harvest(): - if state == State.MATURE: - for effect in plant_type.harvest_effects: - if effect : effect.effect(self) + for i in range(data.get_random_seed_income()): + produce_seed() - plant_sprite.start_harvest_animation() - await plant_sprite.harvest_animation_finished - harvested.emit(self) - queue_free() + if data.get_state() == PlantData.State.MATURE: + for m in data.mutations: + m._start_harvested_effect(self) + + plant_sprite.start_harvest_animation() + await plant_sprite.harvest_animation_finished + disappear() + +func produce_seed(): + region.drop_item( + Seed.generate_from_parent(data), + global_position, + HARVESTED_SEED_DISPLACEMENT_FACTOR, + ) + +func mature(): + for m in data.mutations: + m._start_maturation_effect(self) + +func die(): + for m in data.mutations: + m._start_dead_effect(self) + disappear() + +func disappear(): + data.disappear() + queue_free() func save() -> EntityData: - return PlantData.new(self) + return data func card_info() -> CardInfo: - var info = CardInfo.new( - pointer_text() - ) + var info = CardInfo.new( + pointer_text() + ) - info.important_stat_icon = PLANT_POINT_ICON - info.important_stat_text = "%d" % calculate_plant_score() - info.texture = plant_type.mature_texture - info.type_icon = PLANT_TYPE_ICON + var state = data.get_state() - var state_text = tr("MATURE") - if state != State.MATURE: - state_text = tr("GROWING") + info.important_stat_icon = PLANT_POINT_ICON + info.important_stat_text = "%d" % calculate_plant_score() + info.texture = null #TODO + info.type_icon = PLANT_TYPE_ICON - info.stats.append(CardStatInfo.new( - tr("DAY_%d") % day, - LIFETIME_ICON - )) + var state_text = tr("MATURE") + if state != PlantData.State.MATURE: + state_text = tr("GROWING") - info.stats.append(CardStatInfo.new( - state_text, - PLANT_TYPE_ICON - )) + info.stats.append(CardStatInfo.new( + tr("DAY_%d") % data.day, + LIFETIME_ICON + )) - if state != State.MATURE: - info.stats.append(CardStatInfo.new( - tr("MATURE_ON_DAY_%d") % calculate_grow_time(), - GROWING_ICON - )) + info.stats.append(CardStatInfo.new( + state_text, + PLANT_TYPE_ICON + )) - info.stats.append(CardStatInfo.new( - tr("%d_SCORE_WHEN_MATURE") % calculate_plant_score(State.MATURE), - PLANT_POINT_ICON - )) + if state != PlantData.State.MATURE: + info.stats.append(CardStatInfo.new( + tr("MATURE_ON_DAY_%d") % data.get_growing_time(), + GROWING_ICON + )) + + info.stats.append(CardStatInfo.new( + tr("%d_SCORE_WHEN_MATURE") % data.get_score(PlantData.State.MATURE), + PLANT_POINT_ICON + )) + + info.stats.append(CardStatInfo.new( + tr("DIE_ON_DAY_%d") % (data.get_lifetime()), + DEATH_ICON + )) - if len(plant_mutations) != 0: - var rarest : int = plant_mutations.map( - func(m : PlantMutation) : return m.get_rarity() - ).max() - info.bg_color = PlantMutation.get_rarity_color(rarest) - for m in plant_mutations: - info.sections.append(m.card_section()) + if len(data.mutations) != 0: + var rarest : int = data.mutations.map( + func(m : PlantMutation) : return m.get_rarity() + ).max() + info.bg_color = PlantMutation.get_rarity_color(rarest) + for m in data.mutations: + info.sections.append(m.card_section()) - info.sections.append_array(PlantEffect.card_effect_sections( - plant_type.mature_effects, - plant_type.harvest_effects, - plant_type.cyclic_effects, - )) - - return info \ No newline at end of file + return info diff --git a/entities/plants/scripts/plant_archetype.gd b/entities/plants/scripts/plant_archetype.gd new file mode 100644 index 0000000..5bd0d8a --- /dev/null +++ b/entities/plants/scripts/plant_archetype.gd @@ -0,0 +1,19 @@ +@tool +extends Resource +class_name PlantArchetype + +@export var archetype_name = Random.generate_random_name() +@export var texture_builder = TextureBuilder.new() +@export var plant_area_radius = 20 +@export var plant_influence_radius = 100 +@export var growing_time= 2 +@export var lifetime = 5 +@export var base_score = 1 +@export var seed_number = 2 +@export var seed_random_loose = 1 +@export var available_mutations : Array[PlantMutation] = [ + AncientMutation.new(), + PrecociousMutation.new(), + QualityMutation.new(), + QuickMutation.new() +] \ No newline at end of file diff --git a/entities/plants/scripts/plant_archetype.gd.uid b/entities/plants/scripts/plant_archetype.gd.uid new file mode 100644 index 0000000..40ee452 --- /dev/null +++ b/entities/plants/scripts/plant_archetype.gd.uid @@ -0,0 +1 @@ +uid://chdj832c0rrky diff --git a/entities/plants/scripts/plant_data.gd b/entities/plants/scripts/plant_data.gd index d82c8b2..f573579 100644 --- a/entities/plants/scripts/plant_data.gd +++ b/entities/plants/scripts/plant_data.gd @@ -1,20 +1,114 @@ extends EntityData class_name PlantData -var plant_type : PlantType -var plant_mutations : Array[PlantMutation] -var day : int +signal updated(p : PlantData) +signal disappeared(p : PlantData) -func _init(plant : Plant): - position = plant.global_position - plant_type = plant.plant_type - plant_mutations = plant.plant_mutations - day = plant.day +enum State {PLANTED, GROWING, MATURE, DEAD} -func load() -> Entity: - var plant = Plant.new( - plant_type, - plant_mutations, - day +@export var archetype: PlantArchetype +@export var plant_name : String +@export var mutations : Array[PlantMutation] +@export var day : int : + set(v): + day = v + updated.emit(self) +@export var random_seed : int + +@export var leafs = 0 # +1 score +@export var roots = 0 # +1 lifetime + +func _init( + _position : Vector2, + _archetype : PlantArchetype, + _plant_name : String = Random.generate_random_name(), + _mutations : Array[PlantMutation] = [], + _day : int = 0, + _random_seed = randi() +): + position = _position + archetype = _archetype + plant_name = _plant_name + mutations = _mutations + day = _day + random_seed = _random_seed + + for m in mutations: + m.mutate_plant_data(self) + +static func generate_from_seed(plant_seed : Seed, plant_position : Vector2) -> PlantData: + return PlantData.new( + plant_position, + plant_seed.plant_archetype, + plant_seed.plant_name, + plant_seed.plant_mutations ) - return plant \ No newline at end of file + +func load_entity() -> Entity: + var plant = Plant.new( + self + ) + return plant + +func get_lifetime() -> int: + var lifetime = archetype.lifetime + roots + + for m in mutations: + lifetime = m.mutate_lifetime(self, lifetime) + + return lifetime + +func get_growing_time() -> int: + var growing_time = archetype.growing_time + + for m in mutations: + growing_time = m.mutate_growing_time(self, growing_time) + + return growing_time + +func get_score(state : State = get_state()) -> int: + var score = archetype.base_score + leafs if state == State.MATURE else 0 + + for m in mutations: + score = m.mutate_score(self, score) + + return score + +func get_state() -> State: + if day >= get_lifetime(): + return State.DEAD + elif day == 0: + return State.PLANTED + elif day < archetype.growing_time: + return State.GROWING + return State.MATURE + +func get_plant_texture() -> Texture: + return archetype.texture_builder.build_plant_texture(self) + +func get_seed_texture(): + return archetype.texture_builder.build_seed_texture(random_seed) + +func get_seed_number(state = get_state()): + var seed_number = archetype.seed_number if state == State.MATURE else 0 + + for m in mutations: + seed_number = m.mutate_seed_number(self, seed_number) + + return seed_number + +func get_seed_random_loose(): + var seed_random_loose = archetype.seed_random_loose + for m in mutations: + seed_random_loose = m.mutate_seed_random_loose(self, seed_random_loose) + + return seed_random_loose + +func get_random_seed_income(): + return max( + get_seed_number() - randi_range(0, get_seed_random_loose()), + 0 + ) + +func disappear(): + disappeared.emit(self) \ No newline at end of file diff --git a/entities/plants/scripts/plant_effect.gd b/entities/plants/scripts/plant_effect.gd deleted file mode 100644 index 505f189..0000000 --- a/entities/plants/scripts/plant_effect.gd +++ /dev/null @@ -1,76 +0,0 @@ -# Classe abstraite permettant de développer divers effets de plantes -extends Resource -class_name PlantEffect - -const HARVEST_EFFECT_ICON = preload("res://common/icons/shovel.svg") -const MATURE_EFFECT_ICON = preload("res://common/icons/chevrons-up.svg") -const CYCLIC_EFFECT_ICON = preload("res://common/icons/rotate-rectangle.svg") - -@export var level : int - -func _init(_level : int = 1): - level = _level - -func get_effect_name() -> String: - printerr("Classe abstraite PlantEffect appelée") - return "" - -func get_effect_description() -> String: - printerr("Classe abstraite PlantEffect appelée") - return "" - -func effect(_plant): - printerr("Classe abstraite PlantEffect appelée") - -func get_styled_effect_name(): - var levels_bbcode = [ - "[color=#2364AA]%s[/color]", - "[color=#25C147]%s %d[/color]", - "[color=#8B2DFF]%s %d[/color]", - "[color=#FF006E]%s %d[/color]", - "[color=#FFA617]%s %d[/color]", - "[rainbow]%s %d[/rainbow]" - ] - - if level == 1: - return levels_bbcode[0] % get_effect_name() - else : - return levels_bbcode[min(level - 1, len(levels_bbcode) - 1)] % [get_effect_name(), level] - -static func card_effect_sections( - mature_effects : Array[PlantEffect], - harvest_effects : Array[PlantEffect], - cyclic_effects : Array[PlantEffect] -) -> Array[CardSectionInfo]: - var sections : Array[CardSectionInfo] = [] - var effects_category = [ - mature_effects, - harvest_effects, - cyclic_effects - ] - var effects_category_labels : Array[String] = [ - "ON_MATURE", - "WHEN_HARVESTED", - "EACH_DAY_WHEN_MATURE", - ] - var effects_category_icon : Array[Texture] = [ - MATURE_EFFECT_ICON, - HARVEST_EFFECT_ICON, - CYCLIC_EFFECT_ICON, - ] - - for i in range(len(effects_category)): - var effects = effects_category[i] - - if len(effects) > 0: - var section = CardSectionInfo.new( - effects_category_labels[i] - ) - section.title_icon = effects_category_icon[i] - var effects_text : Array = effects.map( - func (e : PlantEffect): return "[b]%s[/b] %s" % [e.get_styled_effect_name() , e.get_effect_description()] - ) - section.text = "\n".join(effects_text) - sections.append(section) - - return sections \ No newline at end of file diff --git a/entities/plants/scripts/plant_effect.gd.uid b/entities/plants/scripts/plant_effect.gd.uid deleted file mode 100644 index 05ef0a6..0000000 --- a/entities/plants/scripts/plant_effect.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bpycohqas4hff diff --git a/entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd b/entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd deleted file mode 100644 index 9773dc0..0000000 --- a/entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd +++ /dev/null @@ -1,20 +0,0 @@ -extends PlantEffect -class_name DecontaminateTerrainEffect - -func get_decontamination_radius(): - return (1 + level) - -func get_effect_name() -> String: - return tr("DECONTAMINATE") - -func get_effect_description() -> String: - var ret = tr("DECONTAMINATE_%d_UNIT_AROUND_IT") % [get_decontamination_radius()] - return ret - -func effect(plant): - var tiles := Math.get_tiles_in_circle( - plant.global_position, - get_decontamination_radius() * Planet.TILE_SIZE + Planet.TILE_SIZE/2. - ) - - plant.planet.decontamination_layer.place_decontaminations(tiles, true) diff --git a/entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd.uid b/entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd.uid deleted file mode 100644 index 0399a8c..0000000 --- a/entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://cgscbuxe4dawb diff --git a/entities/plants/scripts/plant_effects/produce_seeds.gd b/entities/plants/scripts/plant_effects/produce_seeds.gd deleted file mode 100644 index 89d1a40..0000000 --- a/entities/plants/scripts/plant_effects/produce_seeds.gd +++ /dev/null @@ -1,29 +0,0 @@ -extends PlantEffect -class_name ProduceSeedsEffect - -func get_produce_number(): - return [level - 1, level] - -func get_effect_name() -> String: - return tr("SEED_PRODUCTION") - -func get_effect_description() -> String: - var number_str = "" - - for i in range(len(get_produce_number())): - if i != 0: - if i == len(get_produce_number()) - 1: - number_str += tr("OR") - else : - number_str += tr("COMMA") - number_str += str(get_produce_number()[i]) - - return tr("PRODUCE_%s_SEEDS") % [number_str] - -func effect(plant): - for _i in range(get_produce_number().pick_random()): - plant.planet.drop_item( - Seed.new(plant.plant_type, plant.plant_mutations), - plant.global_position, - plant.HARVESTED_SEED_DISPLACEMENT_FACTOR, - ) diff --git a/entities/plants/scripts/plant_effects/produce_seeds.gd.uid b/entities/plants/scripts/plant_effects/produce_seeds.gd.uid deleted file mode 100644 index a38a621..0000000 --- a/entities/plants/scripts/plant_effects/produce_seeds.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://ceqx5va1ormau diff --git a/entities/plants/scripts/plant_mutation.gd b/entities/plants/scripts/plant_mutation.gd index e5f5dd0..a481341 100644 --- a/entities/plants/scripts/plant_mutation.gd +++ b/entities/plants/scripts/plant_mutation.gd @@ -20,13 +20,37 @@ func get_mutation_description() -> String: printerr("Classe abstraite PlantMutation appelée") return "" -func mutate_score(_plant_state : Plant.State, _plant : Plant, score,) -> int: +func mutate_plant_data(_plant_data : PlantData): + pass + +func mutate_score(_plant_data : PlantData, score : int) -> int: return score -func mutate_grow_time(_plant : Plant, grow_time : int) -> int: - return grow_time +func mutate_lifetime(_plant_data : PlantData, lifetime : int) -> int: + return lifetime -func mutate_plant(_plant : Plant): +func mutate_growing_time(_plant_data : PlantData, growing_time : int) -> int: + return growing_time + +func mutate_seed_number(_plant_data, seed_number): + return seed_number + +func mutate_seed_random_loose(_plant_data, seed_random_loose): + return seed_random_loose + +func _start_planted_effect(_plant : Plant): + pass + +func _start_day_effect(_plant : Plant): + pass + +func _start_maturation_effect(_plant : Plant): + pass + +func _start_dead_effect(_plant : Plant): + pass + +func _start_harvested_effect(_plant : Plant): pass func get_level_for_rarity(rarity : int) -> int : @@ -70,16 +94,3 @@ static func get_rarity_color(rarity : int) -> Color: ] return rarity_colors[min(rarity, len(rarity_colors) - 1)] - -static func random_mutation(except_mutations : Array[PlantMutation] = []) -> PlantMutation: - var all_mutations = GameInfo.game_data.unlocked_plant_mutations.duplicate_deep() - all_mutations = all_mutations.filter( - func (f1 : PlantMutation): - return except_mutations.find_custom( - func (f2 : PlantMutation): return f2.get_mutation_name() == f1.get_mutation_name() - ) == -1 - ) - if len(all_mutations): - return all_mutations.pick_random() - else : - return null diff --git a/entities/plants/scripts/plant_mutation/ancient_mutation.gd b/entities/plants/scripts/plant_mutation/ancient_mutation.gd index 61d865a..d9fb866 100644 --- a/entities/plants/scripts/plant_mutation/ancient_mutation.gd +++ b/entities/plants/scripts/plant_mutation/ancient_mutation.gd @@ -18,7 +18,7 @@ func get_mutation_description() -> String: func get_day_factor(): return max(1, DEFAULT_DAY_FACTOR - level + 1) -func mutate_score(plant_state : Plant.State, plant : Plant, score) -> int: - if plant_state != Plant.State.MATURE: +func mutate_score(data : PlantData, score) -> int: + if data.get_state() != PlantData.State.MATURE: return score - return score + floori(plant.day / get_day_factor()) \ No newline at end of file + return score + floori(data.day / get_day_factor()) \ No newline at end of file diff --git a/entities/plants/scripts/plant_mutation/elitist_mutation.gd b/entities/plants/scripts/plant_mutation/elitist_mutation.gd deleted file mode 100644 index dc10395..0000000 --- a/entities/plants/scripts/plant_mutation/elitist_mutation.gd +++ /dev/null @@ -1,29 +0,0 @@ -extends PlantMutation -class_name ElitistMutation - -func get_icon() -> Texture: - return preload("res://common/icons/copy.svg") - -func get_base_rarity() -> int: - return 0 - -func get_mutation_name() -> String: - return tr("ELITIST") - -func get_mutation_description() -> String: - return tr("ELITIST_EFFECT_TEXT_LEVEL_%d") % level - -func mutate_score(plant_state : Plant.State, plant : Plant, score) -> int: - if plant.influence_zone == null: - return score - if plant_state != Plant.State.MATURE: - return score - var plant_count = 0 - for area in plant.influence_zone.get_overlapping_areas(): - if area is Plant and area != plant and area.plant_type.name == plant.plant_type.name: - plant_count += 1 - - if plant_count == 0: - return 0 - else : - return score + level * plant_count \ No newline at end of file diff --git a/entities/plants/scripts/plant_mutation/elitist_mutation.gd.uid b/entities/plants/scripts/plant_mutation/elitist_mutation.gd.uid deleted file mode 100644 index 89d8a8d..0000000 --- a/entities/plants/scripts/plant_mutation/elitist_mutation.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bt1xh7ss13e5e diff --git a/entities/plants/scripts/plant_mutation/ermit_mutation.gd b/entities/plants/scripts/plant_mutation/ermit_mutation.gd deleted file mode 100644 index f47e7b6..0000000 --- a/entities/plants/scripts/plant_mutation/ermit_mutation.gd +++ /dev/null @@ -1,26 +0,0 @@ -extends PlantMutation -class_name ErmitMutation - -func get_icon() -> Texture: - return preload("res://common/icons/seedling-off.svg") - -func get_base_rarity() -> int: - return 0 - -func get_mutation_name() -> String: - return tr("ERMIT") - -func get_mutation_description() -> String: - return tr("ERMIT_EFFECT_TEXT_LEVEL_%d") % get_score_multiplier() - -func get_score_multiplier(): - return level + 1 - -func mutate_score(_plant_state : Plant.State, plant : Plant, score) -> int: - if plant.influence_zone == null: - return score - for area in plant.influence_zone.get_overlapping_areas(): - if area is Plant and area != plant: - return 0 - - return score * get_score_multiplier() diff --git a/entities/plants/scripts/plant_mutation/ermit_mutation.gd.uid b/entities/plants/scripts/plant_mutation/ermit_mutation.gd.uid deleted file mode 100644 index 7b03513..0000000 --- a/entities/plants/scripts/plant_mutation/ermit_mutation.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://domy822vgxfxs diff --git a/entities/plants/scripts/plant_mutation/precocious_mutation.gd b/entities/plants/scripts/plant_mutation/precocious_mutation.gd index 6563c28..f3e92b5 100644 --- a/entities/plants/scripts/plant_mutation/precocious_mutation.gd +++ b/entities/plants/scripts/plant_mutation/precocious_mutation.gd @@ -13,5 +13,5 @@ func get_mutation_name() -> String: func get_mutation_description() -> String: return tr("PRECOCIOUS_EFFECT_TEXT_LEVEL_%d") % level -func mutate_score(plant_state : Plant.State, _plant : Plant, score) -> int: - return score + (0 if plant_state == Plant.State.MATURE else level) \ No newline at end of file +func mutate_score(data : PlantData, score : int) -> int: + return score + (0 if data.get_state() == PlantData.State.MATURE else level) \ No newline at end of file diff --git a/entities/plants/scripts/plant_mutation/quality_mutation.gd b/entities/plants/scripts/plant_mutation/quality_mutation.gd index 11b8e80..dcdfc44 100644 --- a/entities/plants/scripts/plant_mutation/quality_mutation.gd +++ b/entities/plants/scripts/plant_mutation/quality_mutation.gd @@ -13,5 +13,5 @@ func get_mutation_name() -> String: func get_mutation_description() -> String: return tr("QUALITY_EFFECT_TEXT_LEVEL_%d") % level -func mutate_score(plant_state : Plant.State, _plant : Plant, score : int) -> int: - return score + (level if plant_state == Plant.State.MATURE else 0) \ No newline at end of file +func mutate_score(data : PlantData, score : int) -> int: + return score + (level if data.get_state() == PlantData.State.MATURE else 0) \ No newline at end of file diff --git a/entities/plants/scripts/plant_mutation/quick_mutation.gd b/entities/plants/scripts/plant_mutation/quick_mutation.gd index 6f0eeba..6a272a0 100644 --- a/entities/plants/scripts/plant_mutation/quick_mutation.gd +++ b/entities/plants/scripts/plant_mutation/quick_mutation.gd @@ -13,5 +13,5 @@ func get_mutation_name() -> String: func get_mutation_description() -> String: return tr("QUICK_EFFECT_TEXT_LEVEL_%d") % level -func mutate_grow_time(_plant : Plant, grow_time : int) -> int: +func mutate_grow_time(_data : PlantData, grow_time : int) -> int: return max(grow_time - level, 0) \ No newline at end of file diff --git a/entities/plants/scripts/plant_mutation/sociable_mutation.gd b/entities/plants/scripts/plant_mutation/sociable_mutation.gd deleted file mode 100644 index 36d774c..0000000 --- a/entities/plants/scripts/plant_mutation/sociable_mutation.gd +++ /dev/null @@ -1,32 +0,0 @@ -extends PlantMutation -class_name SociableMutation - -const NEAR_PLANT_NEEDED = 2 - -func get_icon() -> Texture: - return preload("res://common/icons/seedling.svg") - -func get_base_rarity() -> int: - return 0 - -func get_mutation_name() -> String: - return tr("SOCIABLE") - -func get_mutation_description() -> String: - return tr("SOCIABLE_EFFECT_TEXT_LEVEL_%d") % [get_score_bonus(), NEAR_PLANT_NEEDED] - -func get_score_bonus(): - return (level + 2) - -func mutate_score(plant_state : Plant.State, plant : Plant, score) -> int: - if plant.influence_zone == null: - return score - if plant_state != Plant.State.MATURE: - return score - var plant_count = 0 - - for area in plant.influence_zone.get_overlapping_areas(): - if area is Plant and area != plant : - plant_count += 1 - - return score + (get_score_bonus() if plant_count >= NEAR_PLANT_NEEDED else 0) \ No newline at end of file diff --git a/entities/plants/scripts/plant_mutation/sociable_mutation.gd.uid b/entities/plants/scripts/plant_mutation/sociable_mutation.gd.uid deleted file mode 100644 index 82adcfc..0000000 --- a/entities/plants/scripts/plant_mutation/sociable_mutation.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://b8q5xgvy85qeb diff --git a/entities/plants/scripts/plant_mutation/strong_mutation.gd b/entities/plants/scripts/plant_mutation/strong_mutation.gd deleted file mode 100644 index d289e6b..0000000 --- a/entities/plants/scripts/plant_mutation/strong_mutation.gd +++ /dev/null @@ -1,20 +0,0 @@ -extends PlantMutation -class_name StrongMutation - -func get_icon() -> Texture: - return preload("res://common/icons/dna.svg") - -func get_base_rarity() -> int: - return 0 - -func get_mutation_name() -> String: - return tr("STRONG") - -func get_mutation_description() -> String: - return tr("STRONG_EFFECT_TEXT_LEVEL_%d") % [roundi(get_score_multiplier() * 100)] - -func get_score_multiplier(): - return float(level)/2 - -func mutate_score(_plant_state : Plant.State, _plant : Plant, score: int) -> int: - return score + roundi(score * get_score_multiplier()) \ No newline at end of file diff --git a/entities/plants/scripts/plant_mutation/strong_mutation.gd.uid b/entities/plants/scripts/plant_mutation/strong_mutation.gd.uid deleted file mode 100644 index 2dc562b..0000000 --- a/entities/plants/scripts/plant_mutation/strong_mutation.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://cwj3k4p6ci5t4 diff --git a/entities/plants/scripts/plant_sprite.gd b/entities/plants/scripts/plant_sprite.gd index bf65852..e04c45e 100644 --- a/entities/plants/scripts/plant_sprite.gd +++ b/entities/plants/scripts/plant_sprite.gd @@ -8,47 +8,38 @@ const PARTICLES_SCENE : PackedScene = preload("res://common/vfx/particles/partic signal harvest_animation_finished -func update_plant_sprite(plant : Plant, with_animation = false): - if with_animation: - %AnimationPlayer.play("bump") - await %AnimationPlayer.animation_finished - - %Sprite.flip_h = true if randi()%2 == 0 else false +var last_updated_on_state : PlantData.State = PlantData.State.MATURE - %Sprite.texture = get_state_texture(plant.state, plant.plant_type) +func update_plant_sprite(plant_data : PlantData, with_animation = false): + if with_animation: + %AnimationPlayer.play("bump") + await %AnimationPlayer.animation_finished + + %Sprite.flip_h = true if plant_data.random_seed%2 == 0 else false + %Sprite.texture = plant_data.get_plant_texture() - %PlantedSeed.visible = plant.state == Plant.State.PLANTED - %PlantedSeed.texture = plant.plant_type.seed_texture + %PlantedSeed.texture = plant_data.get_seed_texture() + %PlantedSeed.visible = plant_data.get_state() == PlantData.State.PLANTED - %PlantedSeed.region_rect = Rect2( - 0, - PLANTED_SEED_POS_Y, - plant.plant_type.seed_texture.get_width(), - plant.plant_type.seed_texture.get_height() - PLANTED_SEED_CROP_WIDTH + -1 * PLANTED_SEED_POS_Y, - ) - -func get_state_texture(s: Plant.State, plant_type : PlantType) -> Texture2D: - match s: - Plant.State.PLANTED: - return null - Plant.State.GROWING: - return plant_type.growing_texture - Plant.State.MATURE: - return plant_type.mature_texture - return null + # %PlantedSeed.region_rect = Rect2( + # 0, + # PLANTED_SEED_POS_Y, + # %PlantedSeed.texture.get_width(), + # %PlantedSeed.texture.texture.get_height() - PLANTED_SEED_CROP_WIDTH + -1 * PLANTED_SEED_POS_Y, + # ) func generate_mutation_effects(plant : Plant): - for m in plant.plant_mutations: - var particles_emitter : Particles = PARTICLES_SCENE.instantiate() as CPUParticles2D - particles_emitter.setup_particles( - Particles.Parameters.new( - m.get_icon(), - PlantMutation.get_rarity_color(m.get_rarity()) - ) - ) - add_child(particles_emitter) + for m in plant.data.mutations: + var particles_emitter : Particles = PARTICLES_SCENE.instantiate() as CPUParticles2D + particles_emitter.setup_particles( + Particles.Parameters.new( + m.get_icon(), + PlantMutation.get_rarity_color(m.get_rarity()) + ) + ) + add_child(particles_emitter) func start_harvest_animation(): - $AnimationPlayer.play("harvest") - await $AnimationPlayer.animation_finished - harvest_animation_finished.emit() + $AnimationPlayer.play("harvest") + await $AnimationPlayer.animation_finished + harvest_animation_finished.emit() diff --git a/entities/plants/scripts/plant_type.gd b/entities/plants/scripts/plant_type.gd deleted file mode 100644 index 56a618b..0000000 --- a/entities/plants/scripts/plant_type.gd +++ /dev/null @@ -1,128 +0,0 @@ -extends Resource -class_name PlantType - -@export var name : String -@export_multiline var description : String - -@export var default_growing_time : int = 2 -@export var default_plant_score : int = 1 - -@export var seed_texture : Texture -@export var growing_texture : Texture -@export var mature_texture : Texture - -@export var harvest_effects : Array[PlantEffect] = [] -@export var mature_effects : Array[PlantEffect] = [] -@export var cyclic_effects : Array[PlantEffect] = [] - -func card_info() -> CardInfo: - var info = CardInfo.new( - name - ) - - info.important_stat_icon = Plant.PLANT_POINT_ICON - info.important_stat_text = "%d" % default_plant_score - info.texture = mature_texture - info.type_icon = Plant.PLANT_TYPE_ICON - - info.stats.append(CardStatInfo.new( - tr("GROW_IN_%d") % default_growing_time, - Plant.GROWING_ICON - )) - - info.stats.append(CardStatInfo.new( - tr("%s_SCORE_WHEN_MATURE") % default_plant_score, - Plant.PLANT_POINT_ICON - )) - - info.sections.append_array(PlantEffect.card_effect_sections( - mature_effects, - harvest_effects, - cyclic_effects, - )) - - return info - -func get_available_evolution() -> Array[Evolution]: - var evolutions : Array[Evolution] = [ - ScoreEvolution.new(self) - ] - - if len(mature_effects) > 0: - evolutions.append(MatureEffectEvolution.new(self)) - if len(harvest_effects) > 0: - evolutions.append(HarvestEffectEvolution.new(self)) - if len(cyclic_effects) > 0: - evolutions.append(CyclicEffectEvolution.new(self)) - - return evolutions - -class Evolution: - - var level : int - var plant_type : PlantType - - func _init(_type : PlantType, _l : int = 1): - plant_type = _type - level = _l - - func get_title(): - return "" - - func get_description(): - return "" - - func evolve(_pt : PlantType = plant_type): - pass - -class ScoreEvolution extends Evolution: - - func get_title(): - return tr("%s_SCORE_EVOLUTION") % plant_type.name - - func get_description(): - return tr("ADD_%s_TO_THE_DEFAULT_SCORE_OF_THE_PLANT") % level - - func evolve(pt : PlantType = plant_type): - pt.default_plant_score += level - -class MatureEffectEvolution extends Evolution: - - var effect_index : int - - func _init(_type : PlantType, _l : int = 1): - plant_type = _type - level = _l - - pick_effect() - - func pick_effect(): - effect_index = randi() % len(plant_type.mature_effects) - - func get_effect(pt : PlantType = plant_type) -> PlantEffect: - return pt.mature_effects[effect_index] - - func get_title(): - return tr("%s_EVOLUTION") % plant_type.name - - func get_description(): - return tr("UPGRADE_THE_LEVEL_OF_%s_EFFECT_OF_%d_LEVEL") % [get_effect().get_effect_name(), level] - - func evolve(pt : PlantType = plant_type): - get_effect(pt).level += level - -class HarvestEffectEvolution extends MatureEffectEvolution: - - func pick_effect(): - effect_index = randi() % len(plant_type.harvest_effects) - - func get_effect(pt : PlantType = plant_type) -> PlantEffect: - return pt.harvest_effects[effect_index] - -class CyclicEffectEvolution extends MatureEffectEvolution: - - func pick_effect(): - effect_index = randi() % len(plant_type.harvest_effects) - - func get_effect(pt : PlantType = plant_type) -> PlantEffect: - return pt.harvest_effects[effect_index] \ No newline at end of file diff --git a/entities/plants/scripts/plant_type.gd.uid b/entities/plants/scripts/plant_type.gd.uid deleted file mode 100644 index 05a9693..0000000 --- a/entities/plants/scripts/plant_type.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://jnye5pe1bgqw diff --git a/entities/plants/scripts/texture_builder/texture_builder.gd b/entities/plants/scripts/texture_builder/texture_builder.gd new file mode 100644 index 0000000..128c1f4 --- /dev/null +++ b/entities/plants/scripts/texture_builder/texture_builder.gd @@ -0,0 +1,19 @@ +extends Resource +class_name TextureBuilder + +const PLACEHOLDER_SEED_TEXTURE : Texture = preload("res://entities/plants/assets/sprites/default/seed.png") +const PLACEHOLDER_MATURE_TEXTURE : Texture = preload("res://entities/plants/assets/sprites/default/mature.png") +const PLACEHOLDER_GROWING_TEXTURE : Texture = preload("res://entities/plants/assets/sprites/default/growing.png") + + +func build_seed_texture(_random_seed : int) -> Texture: + return PLACEHOLDER_SEED_TEXTURE + +func build_plant_texture(plant_data : PlantData) -> Texture: + match plant_data.get_state(): + PlantData.State.MATURE: + return PLACEHOLDER_MATURE_TEXTURE + PlantData.State.GROWING: + return PLACEHOLDER_GROWING_TEXTURE + _: + return null \ No newline at end of file diff --git a/entities/plants/scripts/texture_builder/texture_builder.gd.uid b/entities/plants/scripts/texture_builder/texture_builder.gd.uid new file mode 100644 index 0000000..af86754 --- /dev/null +++ b/entities/plants/scripts/texture_builder/texture_builder.gd.uid @@ -0,0 +1 @@ +uid://dt2ip3pw2cboy diff --git a/entities/player/inventory/scripts/inventory.gd b/entities/player/inventory/scripts/inventory.gd index e2866e8..aa87341 100644 --- a/entities/player/inventory/scripts/inventory.gd +++ b/entities/player/inventory/scripts/inventory.gd @@ -6,93 +6,97 @@ signal updated(inventory: Inventory) @export var items: Array[Item] = [] @export var current_item_ind: int = 0 @export var size = 0 : - set(s): - size = s - items.resize(size) - updated.emit(self) + set(s): + size = s + items.resize(size) + updated.emit(self) func _init(inventory_size: int = 1): - size = inventory_size - - + size = inventory_size + func get_best_available_slot_ind(): - if items[current_item_ind] == null: - return current_item_ind - for i in items.size(): - if items[i] == null: - return i - return current_item_ind + if items[current_item_ind] == null: + return current_item_ind + for i in items.size(): + if items[i] == null: + return i + return current_item_ind func set_current_item(new_ind: int): - if new_ind >= items.size(): - return + if new_ind >= items.size(): + return - if new_ind != current_item_ind: - current_item_ind = new_ind - updated.emit(self) + if new_ind != current_item_ind: + current_item_ind = new_ind + updated.emit(self) func change_current_item(ind_mod: int): - if items.size() == 0: - current_item_ind = 0 - return - var new_ind: int = current_item_ind + ind_mod - new_ind = new_ind % items.size() - if new_ind < 0: - new_ind += items.size() - set_current_item(new_ind) + if items.size() == 0: + current_item_ind = 0 + return + var new_ind: int = current_item_ind + ind_mod + new_ind = new_ind % items.size() + if new_ind < 0: + new_ind += items.size() + set_current_item(new_ind) func add_item(item: Item): - var best_ind = get_best_available_slot_ind() - if best_ind != current_item_ind: - set_item(item, best_ind) - updated.emit(self) - return true - else: - return false + var best_ind = get_best_available_slot_ind() + if best_ind != current_item_ind: + set_item(item, best_ind) + updated.emit(self) + return true + else: + return false func set_item(item: Item, ind: int = 0) -> bool: - if ind < 0 || ind >= items.size(): - return false - while len(items) <= ind: - items.append(null) - items[ind] = item - updated.emit(self) - return true + if ind < 0 || ind >= items.size(): + return false + while len(items) <= ind: + items.append(null) + items[ind] = item + updated.emit(self) + return true func get_item(ind: int = current_item_ind) -> Item: - if ind < 0 || items.size() <= ind: - return null - return items[ind] + if ind < 0 || items.size() <= ind: + return null + return items[ind] func has_item(item: Item) -> bool: - return item in items + return item in items func remove_item(item: Item): - var ind = items.find(item) - if ind >= 0: - items[ind] = null - updated.emit(self) + var ind = items.find(item) + if ind >= 0: + items[ind] = null + updated.emit(self) func remove_item_at(ind: int = current_item_ind): - if items.size() <= ind: - return + if items.size() <= ind: + return - items[ind] = null - updated.emit(self) + items[ind] = null + updated.emit(self) func remove_current_item(): - remove_item_at() + remove_item_at() func pop_item(ind: int = current_item_ind) -> Item: - if items.size() == 0: - return + if items.size() == 0: + return - var item_removed: Item = items[ind] - items[ind] = null - updated.emit(self) - return item_removed + var item_removed: Item = items[ind] + items[ind] = null + updated.emit(self) + return item_removed func is_full(): - for i in items: - if i == null : return false - return true \ No newline at end of file + for i in items: + if i == null : return false + return true + +func clear(): + for i in range(len(items)): + items[i] = null + updated.emit(self) diff --git a/entities/player/inventory/scripts/items/blueprint.gd b/entities/player/inventory/scripts/items/blueprint.gd index d3d997a..c34ece3 100644 --- a/entities/player/inventory/scripts/items/blueprint.gd +++ b/entities/player/inventory/scripts/items/blueprint.gd @@ -33,11 +33,11 @@ func is_one_time_use(): return true func can_use(player : Player, _zone : Player.ActionZone) -> bool: - return player.terrain is Planet + return player.terrain is Region func use(player : Player, zone : Player.ActionZone) -> bool: - if machine_type and machine_level and player.planet: - player.planet.add_entity( + if machine_type and machine_level and player.region: + player.region.add_entity( Machine.instantiate_machine(machine_type, machine_level), zone.get_global_position() ) diff --git a/entities/player/inventory/scripts/items/package.gd b/entities/player/inventory/scripts/items/package.gd index 87854ce..e3a3423 100644 --- a/entities/player/inventory/scripts/items/package.gd +++ b/entities/player/inventory/scripts/items/package.gd @@ -25,8 +25,8 @@ func is_one_time_use(): return true func can_use(player : Player, _zone : Player.ActionZone) -> bool: - return player.planet != null + return player.region != null func use(player : Player, zone : Player.ActionZone) -> bool: - player.planet.instantiate_entity(scene, zone.get_global_position()) + player.region.instantiate_entity(scene, zone.get_global_position()) return true diff --git a/entities/player/inventory/scripts/items/seed.gd b/entities/player/inventory/scripts/items/seed.gd index b557c28..cda7e0e 100644 --- a/entities/player/inventory/scripts/items/seed.gd +++ b/entities/player/inventory/scripts/items/seed.gd @@ -7,17 +7,51 @@ const SHOVEL_ICON = preload("res://common/icons/shovel.svg") const GROWING_ICON = preload("res://common/icons/chevrons-up.svg") const SCORE_ICON = preload("res://common/icons/growth.svg") -@export var plant_type: PlantType +@export var plant_name : String +@export var plant_archetype: PlantArchetype @export var plant_mutations: Array[PlantMutation] +@export var random_seed : int + +func _init( + _plant_name : String, + _plant_archetype : PlantArchetype, + _plant_mutations : Array[PlantMutation] = [], +): + plant_name = _plant_name + plant_archetype = _plant_archetype + plant_mutations = _plant_mutations + random_seed = randi() + +static func generate_from_parent(plant_data : PlantData) -> Seed: + if randf() > MUTATION_PROBABILITY: + return Seed.new( + plant_data.plant_name, + plant_data.archetype, + mutate(plant_data.mutations) + ) + else : + # TODO + return Seed.new( + plant_data.plant_name, + plant_data.archetype, + mutate(plant_data.mutations) + ) + +static func generate_random() -> Seed: + return Seed.new( + Random.generate_random_name(), + PlantArchetype.new(), + [] + ) func get_item_name() -> String: - return tr("%s_SEED") % plant_type.name + return tr("%s_SEED") % plant_name func get_description() -> String: - return tr("PLANT_%s_MUST_BE_USED_IN_DECONTAMINATED_ZONE") % plant_type.name + return tr("PLANT_%s_MUST_BE_USED_IN_DECONTAMINATED_ZONE") % plant_name func get_icon() -> Texture2D: - return plant_type.seed_texture + return plant_archetype.texture_builder.build_seed_texture(random_seed) func get_energy_used() -> int: return 1 @@ -28,22 +62,15 @@ func get_usage_zone_radius() -> int: func get_usage_object_affected(i : InspectableEntity) -> bool: return i is Plant -func _init( - _plant_type : PlantType = null, - _parent_mutation : Array[PlantMutation] = [] -): - plant_type = _plant_type - plant_mutations = Seed.mutate(_parent_mutation) - func use_text() -> String: - return tr("PLANT_%s") % plant_type.name + return tr("PLANT_%s") % plant_name func is_one_time_use(): return true func can_use(player : Player, zone : Player.ActionZone) -> bool: if ( - player.planet == null + player.region == null ): return false @@ -54,21 +81,17 @@ func can_use(player : Player, zone : Player.ActionZone) -> bool: var is_there_contamination_in_zone = false for tile in zone.get_tiles(): - if not player.planet.decontamination_layer.is_decontamined(tile): + if not player.region.decontamination_layer.is_decontamined(tile): is_there_contamination_in_zone = true return not is_there_a_plant_here and not is_there_contamination_in_zone func use(player : Player, zone : Player.ActionZone) -> bool: - if player.planet == null: + if player.region == null: return false AudioManager.play_sfx("Dig") - return player.planet.plant( - plant_type, - zone.get_global_position(), - plant_mutations - ) + return player.region.plant(self,zone.get_global_position()) func card_info() -> CardInfo: var info = CardInfo.new( @@ -113,7 +136,6 @@ func card_info() -> CardInfo: return info - func get_particles() -> Array[Particles.Parameters]: var param : Array[Particles.Parameters] = [] @@ -129,73 +151,67 @@ func get_particles() -> Array[Particles.Parameters]: static func mutate(parent_mutation : Array[PlantMutation] = []) -> Array[PlantMutation]: - if randf() > MUTATION_PROBABILITY: - return parent_mutation + # TODO + # var possible_mutations_change : Array[MutationPossibility] = [ + # AddMutation.new() + # ] - var possible_mutations : Array[MutationPossibility] = [ - AddMutation.new() - ] - - if ( - len(parent_mutation) >= 2 - ): - possible_mutations = [ - UpgradeMutation.new(), - RemoveMutation.new(), - ] - elif len(parent_mutation) > 0: - possible_mutations = [ - AddMutation.new(), - UpgradeMutation.new(), - RemoveMutation.new(), - ] + # if ( + # len(parent_mutation) >= 2 + # ): + # possible_mutations_change = [ + # UpgradeMutation.new(), + # RemoveMutation.new(), + # ] + # elif len(parent_mutation) > 0: + # possible_mutations_change = [ + # AddMutation.new(), + # UpgradeMutation.new(), + # RemoveMutation.new(), + # ] - var chosen_mutation = possible_mutations.pick_random() + # var chosen_mutation = possible_mutations_change.pick_random() - return chosen_mutation.mutate(parent_mutation) + return parent_mutation -class MutationPossibility: - func mutate(_parent_mutation : Array[PlantMutation] = [])-> Array[PlantMutation]: - return [] +# class MutationPossibility: +# func mutate(_parent_mutation : Array[PlantMutation] = [])-> Array[PlantMutation]: +# return [] -class DontMutate extends MutationPossibility: - func mutate(parent_mutation : Array[PlantMutation] = [])-> Array[PlantMutation]: - return parent_mutation +# class AddMutation extends MutationPossibility: +# func mutate(parent_mutation : Array[PlantMutation] = [])-> Array[PlantMutation]: +# var new_mutations = parent_mutation.duplicate_deep() +# var mut = PlantMutation.random_mutation(parent_mutation) -class AddMutation extends MutationPossibility: - func mutate(parent_mutation : Array[PlantMutation] = [])-> Array[PlantMutation]: - var new_mutations = parent_mutation.duplicate_deep() - var mut = PlantMutation.random_mutation(parent_mutation) - - if mut: - var existing_mut_id = new_mutations.find_custom(func(m:PlantMutation): return m.get_mutation_name() == mut.get_mutation_name()) +# if mut: +# var existing_mut_id = new_mutations.find_custom(func(m:PlantMutation): return m.get_mutation_name() == mut.get_mutation_name()) - if existing_mut_id >= 0: - new_mutations[existing_mut_id].level += 1 - else : - new_mutations.append(mut) +# if existing_mut_id >= 0: +# new_mutations[existing_mut_id].level += 1 +# else : +# new_mutations.append(mut) - return new_mutations +# return new_mutations -class UpgradeMutation extends MutationPossibility: - func mutate( - parent_mutation : Array[PlantMutation] = [] - ) -> Array[PlantMutation]: - var new_mutations = parent_mutation.duplicate_deep() +# class UpgradeMutation extends MutationPossibility: +# func mutate( +# parent_mutation : Array[PlantMutation] = [] +# ) -> Array[PlantMutation]: +# var new_mutations = parent_mutation.duplicate_deep() - new_mutations.pick_random().level += 1 +# new_mutations.pick_random().level += 1 - return new_mutations +# return new_mutations -class RemoveMutation extends MutationPossibility: - func mutate(parent_mutation : Array[PlantMutation] = [])-> Array[PlantMutation]: - var new_mutations :Array[PlantMutation] = parent_mutation.duplicate_deep() +# class RemoveMutation extends MutationPossibility: +# func mutate(parent_mutation : Array[PlantMutation] = [])-> Array[PlantMutation]: +# var new_mutations :Array[PlantMutation] = parent_mutation.duplicate_deep() - var mut_to_remove = new_mutations.pick_random() - if mut_to_remove.level > 1: - mut_to_remove.level -= 1 - else: - new_mutations.remove_at(new_mutations.find(mut_to_remove)) +# var mut_to_remove = new_mutations.pick_random() +# if mut_to_remove.level > 1: +# mut_to_remove.level -= 1 +# else: +# new_mutations.remove_at(new_mutations.find(mut_to_remove)) - return new_mutations +# return new_mutations diff --git a/entities/player/scripts/player.gd b/entities/player/scripts/player.gd index bddd09a..f866b2c 100644 --- a/entities/player/scripts/player.gd +++ b/entities/player/scripts/player.gd @@ -9,8 +9,8 @@ signal player_updated(player: Player) signal upgraded var terrain : Terrain -var planet : Planet : - get(): return terrain if terrain is Planet else null +var region : Region : + get(): return terrain if terrain is Region else null @export var speed = 350 var data : PlayerData @@ -42,16 +42,16 @@ func _input(_event) -> void: if Input.is_action_pressed("item_" + str(i)): data.inventory.set_current_item(i - 1) -# Méthode déclenchée par la classe planet +# Méthode déclenchée par la classe region func _start_pass_day(): controlling_player = false instruction = null -# Méthode déclenchée par la classe planet +# Méthode déclenchée par la classe region func _pass_day(): full_recharge() -# Méthode déclenchée par la classe planet +# Méthode déclenchée par la classe region func _end_pass_day(): controlling_player = true diff --git a/entities/scripts/entity.gd b/entities/scripts/entity.gd index bc5f08b..8cdd0cb 100644 --- a/entities/scripts/entity.gd +++ b/entities/scripts/entity.gd @@ -2,8 +2,8 @@ extends Area2D class_name Entity var terrain : Terrain -var planet : Planet : - get(): return terrain if terrain is Planet else null +var region : Region : + get(): return terrain if terrain is Region else null func save() -> EntityData: return null diff --git a/entities/scripts/entity_data.gd b/entities/scripts/entity_data.gd index 383c42d..53f0205 100644 --- a/entities/scripts/entity_data.gd +++ b/entities/scripts/entity_data.gd @@ -1,3 +1,4 @@ +@abstract extends Resource class_name EntityData @@ -9,5 +10,4 @@ func _init(e : Entity): func get_position() -> Vector2: return position -func load() -> Entity: - return null +@abstract func load_entity() -> Entity diff --git a/gui/game/energy_info/scripts/energy_info.gd b/gui/game/energy_info/scripts/energy_info.gd index 5861162..15efca8 100644 --- a/gui/game/energy_info/scripts/energy_info.gd +++ b/gui/game/energy_info/scripts/energy_info.gd @@ -21,13 +21,7 @@ func update( max_energy = _max_energy var energy_count_text = "[b]%d[/b] / %d" % [energy, max_energy] - if with_animation: - %EnergyAnimationPlayer.bounce() + # if with_animation: + # %EnergyAnimationPlayer.bounce() %EnergyCount.text = energy_count_text - modulate = Color.WHITE if energy > 0 else Color.RED - -func appear(): - await %EnergyAnimationPlayer.appear() - -func disappear(): - await %EnergyAnimationPlayer.disappear() \ No newline at end of file + modulate = Color.WHITE if energy > 0 else Color.RED \ No newline at end of file diff --git a/gui/game/game_gui.tscn b/gui/game/game_gui.tscn index c654750..b580f9a 100644 --- a/gui/game/game_gui.tscn +++ b/gui/game/game_gui.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=16 format=3 uid="uid://12nak7amd1uq"] +[gd_scene load_steps=8 format=3 uid="uid://12nak7amd1uq"] [ext_resource type="Script" uid="uid://cqao7n800qy40" path="res://gui/game/scripts/game_gui.gd" id="1_udau0"] [ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/hud.tres" id="2_nq5i2"] @@ -8,64 +8,6 @@ [ext_resource type="Texture2D" uid="uid://bt3g5bmar0icf" path="res://common/icons/growth.svg" id="7_id0t5"] [ext_resource type="PackedScene" uid="uid://clicjf8ts51h8" path="res://gui/game/inventory_gui/inventory_gui.tscn" id="9_id0t5"] -[sub_resource type="Gradient" id="Gradient_2wykm"] -offsets = PackedFloat32Array(0, 0.279476, 1) -colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1) - -[sub_resource type="GradientTexture2D" id="GradientTexture2D_id0t5"] -gradient = SubResource("Gradient_2wykm") -fill = 1 -fill_from = Vector2(0.5, 0.5) - -[sub_resource type="Animation" id="Animation_l3q4a"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath(".:modulate") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [Color(1, 1, 1, 0)] -} - -[sub_resource type="Animation" id="Animation_2wykm"] -resource_name = "upgrade" -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath(".:modulate") -tracks/0/interp = 2 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.2, 0.9), -"transitions": PackedFloat32Array(1, 1, 1), -"update": 0, -"values": [Color(0.6, 0.580392, 0, 0), Color(0.600196, 0.581106, 0, 0.392157), Color(0.6, 0.580392, 0, 0)] -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_nhqnj"] -_data = { -&"RESET": SubResource("Animation_l3q4a"), -&"upgrade": SubResource("Animation_2wykm") -} - -[sub_resource type="Animation" id="Animation_mbdxg"] -length = 0.001 - -[sub_resource type="Animation" id="Animation_w16yr"] -resource_name = "no_energy_left_appear" -length = 0.5 - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_p0xoq"] -_data = { -&"RESET": SubResource("Animation_mbdxg"), -&"no_energy_left_appear": SubResource("Animation_w16yr") -} - [node name="GameGui" type="CanvasLayer"] script = ExtResource("1_udau0") @@ -147,24 +89,3 @@ unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 4 size_flags_vertical = 8 - -[node name="Effect" type="TextureRect" parent="."] -modulate = Color(1, 1, 1, 0) -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -mouse_filter = 2 -texture = SubResource("GradientTexture2D_id0t5") - -[node name="EffectAnimation" type="AnimationPlayer" parent="."] -root_node = NodePath("../Effect") -libraries = { -&"": SubResource("AnimationLibrary_nhqnj") -} - -[node name="NoEnergyLeftAnimation" type="AnimationPlayer" parent="."] -libraries = { -&"": SubResource("AnimationLibrary_p0xoq") -} diff --git a/gui/game/inventory_gui/scripts/inventory_gui.gd b/gui/game/inventory_gui/scripts/inventory_gui.gd index b23d51c..150d62f 100644 --- a/gui/game/inventory_gui/scripts/inventory_gui.gd +++ b/gui/game/inventory_gui/scripts/inventory_gui.gd @@ -5,6 +5,10 @@ class_name InventoryGui var inventory_item_objects: Array[InventoryGuiItem] +func _ready(): + GameInfo.game_data.player_data.inventory.updated.connect(update) + update(GameInfo.game_data.player_data.inventory) + func update(inventory: Inventory): if len(inventory_item_objects) == 0 or len(inventory_item_objects) != inventory.items.size(): for o in inventory_item_objects: diff --git a/gui/game/pass_day/pass_day.tscn b/gui/game/pass_day/pass_day.tscn index 978e54a..e5675dc 100644 --- a/gui/game/pass_day/pass_day.tscn +++ b/gui/game/pass_day/pass_day.tscn @@ -1,17 +1,19 @@ -[gd_scene load_steps=6 format=3 uid="uid://yk78ubpu5ghq"] +[gd_scene load_steps=9 format=3 uid="uid://yk78ubpu5ghq"] [ext_resource type="Script" uid="uid://2qomrdxbvxqa" path="res://gui/game/pass_day/scripts/pass_day.gd" id="1_0pm4g"] [ext_resource type="Shader" uid="uid://cuni3ggtw2uuy" path="res://common/vfx/materials/shaders/blur.gdshader" id="1_v570a"] [ext_resource type="Script" uid="uid://i7glvbe8pdr8" path="res://gui/game/pass_day/scripts/pass_day_background.gd" id="2_bhfpo"] [ext_resource type="PackedScene" uid="uid://brfsapvj2quxm" path="res://gui/game/energy_info/energy_info.tscn" id="2_feyaf"] +[ext_resource type="Theme" uid="uid://5au2k3vf2po3" path="res://gui/ressources/menu.tres" id="4_0pm4g"] +[ext_resource type="Script" uid="uid://0dhj8sdpil7q" path="res://gui/tools/control_animation_player.gd" id="5_dqmg8"] +[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="6_dqmg8"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_27lg1"] shader = ExtResource("1_v570a") -shader_parameter/strength = 0.1 -shader_parameter/mix_percentage = 0.0 +shader_parameter/strength = 10.0 +shader_parameter/mix_percentage = 0.8 [node name="PassDay" type="Control"] -visible = false z_index = 100 layout_mode = 3 anchors_preset = 15 @@ -33,18 +35,36 @@ grow_horizontal = 2 grow_vertical = 2 mouse_filter = 2 script = ExtResource("2_bhfpo") -blur_strength = 0.1 +blur_strength = 10.0 +blur_mix_percentage = 0.8 -[node name="EnergyPassDayInfo" parent="." instance=ExtResource("2_feyaf")] +[node name="PassDayInfo" type="VBoxContainer" parent="."] unique_name_in_owner = true -modulate = Color(1, 1, 1, 0) layout_mode = 1 -anchors_preset = 14 -anchor_top = 0.5 +anchors_preset = 15 anchor_right = 1.0 -anchor_bottom = 0.5 -offset_top = -37.5 -offset_right = 0.0 -offset_bottom = 37.5 +anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +theme = ExtResource("4_0pm4g") +alignment = 1 + +[node name="PassDayInfoAnimationPlayer" type="Node" parent="PassDayInfo"] +unique_name_in_owner = true +script = ExtResource("5_dqmg8") +metadata/_custom_type_script = "uid://0dhj8sdpil7q" + +[node name="EnergyPassDayInfo" parent="PassDayInfo" instance=ExtResource("2_feyaf")] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="ChargeCount" type="Label" parent="PassDayInfo"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 0 +text = "%d_CHARGE_LEFT" +label_settings = ExtResource("6_dqmg8") +horizontal_alignment = 1 +vertical_alignment = 1 diff --git a/gui/game/pass_day/scripts/pass_day.gd b/gui/game/pass_day/scripts/pass_day.gd index a91df85..dd837ca 100644 --- a/gui/game/pass_day/scripts/pass_day.gd +++ b/gui/game/pass_day/scripts/pass_day.gd @@ -4,8 +4,8 @@ class_name PassDay const BLUR_STRENGTH = 10 const BLUR_MIX_PERCENTAGE = 0.8 -const TIME_BY_ENERGY = 0.7 -const TIME_MARGIN = 0.5 +const TIME_BY_ENERGY = 0.3 +const TIME_MARGIN = 0.2 signal max_energy_reached() signal animation_appeared @@ -26,7 +26,7 @@ var is_animation_disappeared := false func _ready(): hide() setup_energy_values() - %EnergyPassDayInfo.hide() + %PassDayInfo.hide() func _process(delta): if recharging: @@ -48,6 +48,8 @@ func pass_day_animation(): setup_energy_values() + %ChargeCount.text = tr('%d_CHARGE_LEFT') % GameInfo.game_data.current_region_data.charges + is_animation_appeared=false is_animation_disappeared=false @@ -80,10 +82,10 @@ func appear(): BLUR_STRENGTH, 0.5 ).finished - await %EnergyPassDayInfo.appear() + await %PassDayInfoAnimationPlayer.appear() func disappear(): - await %EnergyPassDayInfo.disappear() + await %PassDayInfoAnimationPlayer.disappear() add_tween( "blur_mix_percentage", %Blur, diff --git a/gui/game/pause/pause.tscn b/gui/game/pause/pause.tscn index c8980bf..ea2bcbe 100644 --- a/gui/game/pause/pause.tscn +++ b/gui/game/pause/pause.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=17 format=3 uid="uid://csiacsndm62ll"] +[gd_scene load_steps=16 format=3 uid="uid://csiacsndm62ll"] [ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/hud.tres" id="1_51ks3"] [ext_resource type="Script" uid="uid://crt2d4m5ba25i" path="res://gui/game/pause/scripts/pause.gd" id="1_he4ox"] @@ -6,7 +6,6 @@ [ext_resource type="PackedScene" uid="uid://g6lbgg1fhc25" path="res://gui/menu/settings/settings.tscn" id="4_58dya"] [ext_resource type="FontFile" uid="uid://qt80w6o01q5s" path="res://gui/ressources/fonts/TitanOne-Regular.ttf" id="4_apjlw"] [ext_resource type="Texture2D" uid="uid://vmsn54d1ptih" path="res://common/icons/player-play.svg" id="5_apjlw"] -[ext_resource type="Texture2D" uid="uid://bewr0t1wi8pff" path="res://common/icons/rotate.svg" id="6_58dya"] [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"] @@ -148,11 +147,6 @@ layout_mode = 2 text = "CONTROLS" icon = ExtResource("7_7c7ks") -[node name="Restart" type="Button" parent="Container/MarginContainer/Pause/HBoxContainer"] -layout_mode = 2 -text = "RESTART" -icon = ExtResource("6_58dya") - [node name="Quit" type="Button" parent="Container/MarginContainer/Pause/HBoxContainer"] layout_mode = 2 text = "QUIT" @@ -160,14 +154,10 @@ icon = ExtResource("7_yj6f1") [node name="Settings" parent="." instance=ExtResource("4_58dya")] unique_name_in_owner = true -visible = false -size_flags_horizontal = 3 -size_flags_vertical = 3 mouse_filter = 2 [node name="Controls" parent="." instance=ExtResource("11_urlqn")] unique_name_in_owner = true -visible = false mouse_filter = 2 [node name="AnimationPlayer" type="AnimationPlayer" parent="."] @@ -179,5 +169,4 @@ libraries = { [connection signal="pressed" from="Container/MarginContainer/Pause/HBoxContainer/Resume" to="." method="_on_resume_pressed"] [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/Restart" to="." method="_on_restart_pressed"] [connection signal="pressed" from="Container/MarginContainer/Pause/HBoxContainer/Quit" to="." method="_on_quit_pressed"] diff --git a/gui/game/pause/scripts/pause.gd b/gui/game/pause/scripts/pause.gd index 5d4f834..816c0db 100644 --- a/gui/game/pause/scripts/pause.gd +++ b/gui/game/pause/scripts/pause.gd @@ -12,6 +12,10 @@ func set_pause(p): get_tree().paused = pause %Settings.close_settings() %Controls.close_controls() + if p : + Input.mouse_mode = Input.MOUSE_MODE_VISIBLE + elif SceneManager.actual_scene.mouse_captured: + Input.mouse_mode = Input.MOUSE_MODE_CAPTURED func _input(_event): if Input.is_action_just_pressed("pause"): @@ -20,11 +24,6 @@ func _input(_event): func _on_resume_pressed(): pause = false -func _on_restart_pressed(): - GameInfo.game_data.reset_all() - pause = false - SceneManager.change_scene(SceneManager.REGION_SELECTION_SCREEN) - func _on_quit_pressed(): get_tree().quit() diff --git a/gui/game/quota_reward/quota_reward.tscn b/gui/game/quota_reward/quota_reward.tscn deleted file mode 100644 index fb4dc4c..0000000 --- a/gui/game/quota_reward/quota_reward.tscn +++ /dev/null @@ -1,140 +0,0 @@ -[gd_scene load_steps=10 format=3 uid="uid://doxm7uab8i3tq"] - -[ext_resource type="Script" uid="uid://12kjdou2kp5y" path="res://gui/game/quota_reward/scripts/quota_reward.gd" id="1_gye62"] -[ext_resource type="Shader" uid="uid://cuni3ggtw2uuy" path="res://common/vfx/materials/shaders/blur.gdshader" id="2_6ibex"] -[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/hud.tres" id="3_x2kx4"] -[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="4_trw0e"] - -[sub_resource type="ShaderMaterial" id="ShaderMaterial_gy0la"] -shader = ExtResource("2_6ibex") -shader_parameter/strength = 3.3 -shader_parameter/mix_percentage = 0.3 - -[sub_resource type="Theme" id="Theme_7fpy7"] - -[sub_resource type="Animation" id="Animation_8323k"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("RewardChoiceContainer:modulate") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [Color(1, 1, 1, 0)] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("RewardChoiceContainer:visible") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [true] -} - -[sub_resource type="Animation" id="Animation_4f1tl"] -resource_name = "show" -length = 0.3 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("RewardChoiceContainer:modulate") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0.033333335, 0.3), -"transitions": PackedFloat32Array(1, 1), -"update": 0, -"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("RewardChoiceContainer:visible") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0, 0.033333335), -"transitions": PackedFloat32Array(1, 1), -"update": 1, -"values": [false, true] -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_7fpy7"] -_data = { -&"RESET": SubResource("Animation_8323k"), -&"show": SubResource("Animation_4f1tl") -} - -[node name="RewardChoice" type="CanvasLayer"] -process_mode = 3 -script = ExtResource("1_gye62") - -[node name="RewardChoiceContainer" type="Control" parent="."] -unique_name_in_owner = true -modulate = Color(1, 1, 1, 0) -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 - -[node name="ColorRect" type="ColorRect" parent="RewardChoiceContainer"] -material = SubResource("ShaderMaterial_gy0la") -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -color = Color(0.0352941, 0.0196078, 0.12549, 0.705882) - -[node name="Choice" type="MarginContainer" parent="RewardChoiceContainer"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -theme = ExtResource("3_x2kx4") -theme_override_constants/margin_left = 30 -theme_override_constants/margin_top = 30 -theme_override_constants/margin_right = 30 -theme_override_constants/margin_bottom = 30 - -[node name="VSplitContainer" type="VBoxContainer" parent="RewardChoiceContainer/Choice"] -layout_mode = 2 -theme = ExtResource("3_x2kx4") -alignment = 1 - -[node name="Label" type="Label" parent="RewardChoiceContainer/Choice/VSplitContainer"] -layout_mode = 2 -theme = SubResource("Theme_7fpy7") -text = "CHOOSE_A_REWARD" -label_settings = ExtResource("4_trw0e") -horizontal_alignment = 1 - -[node name="Label2" type="Label" parent="RewardChoiceContainer/Choice/VSplitContainer"] -layout_mode = 2 -theme = ExtResource("3_x2kx4") -text = "REWARD_SCREEN_TEXT" -horizontal_alignment = 1 - -[node name="ChoicesContainer" type="HBoxContainer" parent="RewardChoiceContainer/Choice/VSplitContainer"] -unique_name_in_owner = true -layout_mode = 2 -theme = ExtResource("3_x2kx4") - -[node name="AnimationPlayer" type="AnimationPlayer" parent="."] -unique_name_in_owner = true -libraries = { -&"": SubResource("AnimationLibrary_7fpy7") -} diff --git a/gui/game/quota_reward/quota_reward_choice/quota_reward_choice.tscn b/gui/game/quota_reward/quota_reward_choice/quota_reward_choice.tscn deleted file mode 100644 index 2fd145b..0000000 --- a/gui/game/quota_reward/quota_reward_choice/quota_reward_choice.tscn +++ /dev/null @@ -1,96 +0,0 @@ -[gd_scene load_steps=20 format=3 uid="uid://caupeuds0holj"] - -[ext_resource type="Script" uid="uid://bhhhw2ywxmmba" path="res://gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice.gd" id="1_5arw8"] -[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="1_pjvy1"] -[ext_resource type="Script" uid="uid://dj2pv1hiwjfv0" path="res://gui/game/card/scripts/card_info.gd" id="2_0lvi7"] -[ext_resource type="PackedScene" uid="uid://3ss8pvhsackj" path="res://gui/game/card/card_visualiser.tscn" id="2_5arw8"] -[ext_resource type="Script" uid="uid://bist0wp4nrswp" path="res://gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice_info.gd" id="2_hirys"] -[ext_resource type="Shader" uid="uid://bqjwmomh851lc" path="res://common/vfx/materials/shaders/skew.gdshader" id="3_07hub"] -[ext_resource type="Script" uid="uid://dgbh38j13g5kn" path="res://gui/game/card/scripts/card_section_info.gd" id="3_llc24"] -[ext_resource type="Texture2D" uid="uid://0hbdgalf04e" path="res://common/icons/wood.svg" id="4_llc24"] -[ext_resource type="Script" uid="uid://b4tkium34c831" path="res://gui/game/card/scripts/card_stat_info.gd" id="4_tsfju"] -[ext_resource type="Texture2D" uid="uid://bsvxhafoxwmw0" path="res://common/icons/cube-3d-sphere.svg" id="5_nnvhv"] - -[sub_resource type="Resource" id="Resource_tsfju"] -script = ExtResource("3_llc24") -title_colored = true -title_text = "Hello" -title_icon = ExtResource("4_llc24") -text = "This is text" -metadata/_custom_type_script = "uid://dgbh38j13g5kn" - -[sub_resource type="Resource" id="Resource_llc24"] -script = ExtResource("3_llc24") -metadata/_custom_type_script = "uid://dgbh38j13g5kn" - -[sub_resource type="Resource" id="Resource_nnvhv"] -script = ExtResource("3_llc24") -metadata/_custom_type_script = "uid://dgbh38j13g5kn" - -[sub_resource type="Resource" id="Resource_rnvv6"] -script = ExtResource("3_llc24") -metadata/_custom_type_script = "uid://dgbh38j13g5kn" - -[sub_resource type="Resource" id="Resource_0or1o"] -script = ExtResource("3_llc24") -metadata/_custom_type_script = "uid://dgbh38j13g5kn" - -[sub_resource type="Resource" id="Resource_46ofu"] -script = ExtResource("3_llc24") -metadata/_custom_type_script = "uid://dgbh38j13g5kn" - -[sub_resource type="Resource" id="Resource_3bvi2"] -script = ExtResource("2_0lvi7") -title = "Reward" -sections = Array[ExtResource("3_llc24")]([SubResource("Resource_tsfju"), SubResource("Resource_llc24"), SubResource("Resource_nnvhv"), SubResource("Resource_rnvv6"), SubResource("Resource_0or1o"), SubResource("Resource_46ofu")]) -metadata/_custom_type_script = "uid://dj2pv1hiwjfv0" - -[sub_resource type="Resource" id="Resource_apks8"] -script = ExtResource("2_hirys") -title = "One Reward" -text = "Je m" -card_info = SubResource("Resource_3bvi2") -metadata/_custom_type_script = "uid://bist0wp4nrswp" - -[sub_resource type="ShaderMaterial" id="ShaderMaterial_llc24"] -shader = ExtResource("3_07hub") -shader_parameter/fov = 90.0 -shader_parameter/cull_back = true -shader_parameter/y_rot = -6e-45 -shader_parameter/x_rot = -6e-45 -shader_parameter/inset = 0.0 - -[node name="QuotaRewardChoice" type="VBoxContainer"] -size_flags_horizontal = 3 -size_flags_vertical = 3 -mouse_filter = 0 -alignment = 1 -script = ExtResource("1_5arw8") -info = SubResource("Resource_apks8") - -[node name="QuotaRewardTitle" type="Label" parent="."] -unique_name_in_owner = true -layout_mode = 2 -text = "One Reward" -label_settings = ExtResource("1_pjvy1") -horizontal_alignment = 1 - -[node name="QuotaRewardText" type="RichTextLabel" parent="."] -unique_name_in_owner = true -layout_mode = 2 -bbcode_enabled = true -text = "Je m" -fit_content = true -horizontal_alignment = 1 - -[node name="QuotaRewardCenterContainer" type="CenterContainer" parent="."] -layout_mode = 2 - -[node name="QuotaRewardCard" parent="QuotaRewardCenterContainer" instance=ExtResource("2_5arw8")] -unique_name_in_owner = true -material = SubResource("ShaderMaterial_llc24") -layout_mode = 2 -small_mode = false -interactive_small_mode = false -down_arrow = false -card_info = SubResource("Resource_3bvi2") diff --git a/gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice.gd b/gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice.gd deleted file mode 100644 index 76a20d6..0000000 --- a/gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice.gd +++ /dev/null @@ -1,30 +0,0 @@ -@tool -extends VBoxContainer -class_name QuotaRewardChoice - -signal card_clicked(c : VBoxContainer) - -var is_ready = false - -@export var info : QuotaRewardChoiceInfo = null : - set(v): - info = v - if is_ready : update() - -@export_tool_button("Update", "Callable") var update_action = update - -func _ready(): - update() - %QuotaRewardCard.clicked.connect( - func (_c : CardVisualiser): - card_clicked.emit(self) - ) - is_ready = true - -func update(): - if info: - %QuotaRewardTitle.text = info.title - %QuotaRewardText.text = info.text - %QuotaRewardCard.card_info = info.card_info - %QuotaRewardCard.update() - diff --git a/gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice.gd.uid b/gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice.gd.uid deleted file mode 100644 index 52892c4..0000000 --- a/gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bhhhw2ywxmmba diff --git a/gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice_info.gd b/gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice_info.gd deleted file mode 100644 index ffc66cf..0000000 --- a/gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice_info.gd +++ /dev/null @@ -1,8 +0,0 @@ -extends Resource -class_name QuotaRewardChoiceInfo - -@export var title : String = "" - -@export var text : String = "" - -@export var card_info : CardInfo = null diff --git a/gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice_info.gd.uid b/gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice_info.gd.uid deleted file mode 100644 index 5f3284f..0000000 --- a/gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice_info.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bist0wp4nrswp diff --git a/gui/game/quota_reward/scripts/quota_reward.gd b/gui/game/quota_reward/scripts/quota_reward.gd deleted file mode 100644 index aee0f04..0000000 --- a/gui/game/quota_reward/scripts/quota_reward.gd +++ /dev/null @@ -1,124 +0,0 @@ -@tool -extends CanvasLayer -class_name QuotaReward - -const REWARD_CHOICE_SCENE : PackedScene = preload("res://gui/game/quota_reward/quota_reward_choice/quota_reward_choice.tscn") - -signal reward_chosen - -var showing_rewards: bool = false - -var rewards : Array[QuotaReward.RewardData] = [] - -func _ready(): - %RewardChoiceContainer.visible = false - -func show_rewards(): - showing_rewards = true - get_tree().paused = true - %AnimationPlayer.play("show") - -func hide_rewards(): - showing_rewards = false - get_tree().paused = false - %AnimationPlayer.play_backwards("show") - -func generate_rewards(nb : int = 3): - var new_rewards : Array[QuotaReward.RewardData] = [] - - var max_retry = 20 - - while len(new_rewards) < nb or max_retry < 0: - max_retry -= 1 - - var new_reward = ( - generate_discover_plant_reward() - if len(GameInfo.game_data.unlocked_plant_types) == 0 or randi() % 2 == 0 - else generate_evolution_plant_reward() - ) - - if new_rewards.find_custom(func(r): return r.reward_info().title == new_reward.reward_info().title) == -1: - new_rewards.append(new_reward) - else : - max_retry -= 1 - - rewards = new_rewards - -func generate_rewards_choices(): - for c in %ChoicesContainer.get_children(): - c.queue_free() - - for r in rewards: - var reward_choice : QuotaRewardChoice = REWARD_CHOICE_SCENE.instantiate() as QuotaRewardChoice - reward_choice.info = r.reward_info() - reward_choice.card_clicked.connect( - func (_c): - if showing_rewards: choose_reward(r) - ) - %ChoicesContainer.add_child(reward_choice) - -func generate_discover_plant_reward() -> RewardData: - return DiscoverPlantReward.new( - GameInfo.game_data.get_locked_plant_types().pick_random() - ) - -func generate_evolution_plant_reward() -> RewardData: - return EvolvePlantReward.new( - GameInfo.game_data.unlocked_plant_types.pick_random().get_available_evolution().pick_random() - ) - -func choose_reward(r : RewardData): - r.reward() - reward_chosen.emit() - hide_rewards() - -func trigger_reward(): - generate_rewards() - generate_rewards_choices() - show_rewards() - -class RewardData: - - func reward_info() -> QuotaRewardChoiceInfo: - return null - - func reward(): - pass - -class DiscoverPlantReward extends RewardData: - - var new_plant_type : PlantType - - func _init(_new_plant_type): - new_plant_type = _new_plant_type - - func reward_info() -> QuotaRewardChoiceInfo: - var info = QuotaRewardChoiceInfo.new() - info.title = tr("DISCOVER_%s") % new_plant_type.name - info.text = tr("%s_SEEDS_CAN_NOW_BE_FOUND") % new_plant_type.name - info.card_info = new_plant_type.card_info() - - return info - - func reward(): - GameInfo.game_data.unlock_plant_type(new_plant_type) - -class EvolvePlantReward extends RewardData: - - var plant_evolution : PlantType.Evolution - - func _init(_plant_evolution): - plant_evolution = _plant_evolution - - func reward_info() -> QuotaRewardChoiceInfo: - var info = QuotaRewardChoiceInfo.new() - info.title = tr("EVOLVE_%s") % plant_evolution.plant_type.name - info.text = plant_evolution.get_description() - var preview_evolved_plant = plant_evolution.plant_type.duplicate_deep() - plant_evolution.evolve(preview_evolved_plant) - info.card_info = preview_evolved_plant.card_info() - - return info - - func reward(): - plant_evolution.evolve() diff --git a/gui/game/quota_reward/scripts/quota_reward.gd.uid b/gui/game/quota_reward/scripts/quota_reward.gd.uid deleted file mode 100644 index be04b36..0000000 --- a/gui/game/quota_reward/scripts/quota_reward.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://12kjdou2kp5y diff --git a/gui/game/scripts/game_gui.gd b/gui/game/scripts/game_gui.gd index e61df29..ab13167 100644 --- a/gui/game/scripts/game_gui.gd +++ b/gui/game/scripts/game_gui.gd @@ -3,15 +3,21 @@ class_name GameGui const SCORE_ICON : Texture = preload("res://common/icons/growth.svg") -func _ready(): - GameInfo.game_data.current_planet_data.updated.connect(_on_planet_updated) - GameInfo.game_data.current_planet_data.plant_gaining_score.connect(_on_plant_gaining_score) - GameInfo.game_data.player_data.updated.connect(_on_player_updated) - GameInfo.game_data.player_data.inventory.updated.connect(_on_inventory_updated) +var score_mirror : + set(v): + score_mirror = v + score_update(true) - planet_update(GameInfo.game_data.current_planet_data, false) +func _ready(): + GameInfo.game_data.current_region_data.updated.connect(_on_region_updated) + GameInfo.game_data.current_region_data.plant_changing_score.connect(_on_plant_changing_score) + GameInfo.game_data.player_data.updated.connect(_on_player_updated) + GameInfo.game_data.current_region_data.pass_day_ended.connect(_on_region_pass_day_ended) + + score_mirror = GameInfo.game_data.current_region_data.get_score() + + charge_update(GameInfo.game_data.current_region_data) player_update(GameInfo.game_data.player_data, false) - inventory_update(GameInfo.game_data.player_data.inventory) %EnergyInfo.reset_size() func _on_player_updated(player_data : PlayerData): @@ -24,49 +30,49 @@ func player_update(player_data : PlayerData, with_animation = true): with_animation ) -func _on_inventory_updated(inventory : Inventory): - inventory_update(inventory) +func _on_region_updated(region_data : RegionData): + charge_update(region_data) -func inventory_update(inventory : Inventory): - %Inventory.update(inventory) +func charge_update(region_data : RegionData): + %ChargeCount.text = tr("%d_CHARGE_LEFT") % (region_data.charges) -func _on_planet_updated(planet_data : PlanetData): - planet_update(planet_data) +func score_update(with_animation = true): + var objective = GameInfo.game_data.current_region_data.objective + var objective_progression_percent : float = (float(score_mirror) / float(objective)) * 100 + %ObjectiveProgressText.text = "%d/%d" % [score_mirror, objective] -func planet_update(planet_data : PlanetData, with_animation = true): - if planet_data: - %ChargeCount.text = tr("%d_CHARGE_LEFT") % (planet_data.charges) - - var objective_progression_percent : float = (float(planet_data.garden_score) / float(planet_data.objective)) * 100 - %ObjectiveProgressText.text = "%d/%d" % [planet_data.garden_score, planet_data.objective] - - if with_animation: - get_tree().create_tween().tween_property( - %QuotaProgressBar, - "value", - objective_progression_percent, - 0.5, - ) - else: %QuotaProgressBar.value = objective_progression_percent - -func _on_plant_gaining_score(plant: Plant, amount : int): - for i in range(amount): - var camera = get_viewport().get_camera_2d() - var screen_size = get_viewport().get_visible_rect().size - - spawn_score_particle( - plant.global_position - camera.global_position + screen_size / 2, - %QuotaProgressBar.global_position + %QuotaProgressBar.size / 2, - 0.8 + if with_animation: + get_tree().create_tween().tween_property( + %QuotaProgressBar, + "value", + objective_progression_percent, + 0.5, ) + else: %QuotaProgressBar.value = objective_progression_percent - await get_tree().create_timer(0.3 / max(1,i)).timeout +func _on_plant_changing_score(plant_data: PlantData, amount : int): + if amount <= 0: + score_mirror += amount + else : + for i in range(amount): + var camera = get_viewport().get_camera_2d() + var screen_size = get_viewport().get_visible_rect().size + + spawn_score_particle( + plant_data.position - camera.global_position + screen_size / 2, + %QuotaProgressBar.global_position + %QuotaProgressBar.size / 2, + 0.8 + ) + + await get_tree().create_timer(0.3 / max(1,i)).timeout func spawn_score_particle( from_position, to_position, duration ): + if GameInfo.game_data.current_region_data.in_passing_day_animation: + await GameInfo.game_data.current_region_data.pass_day_ended var sprite_particle = Sprite2D.new() sprite_particle.texture = SCORE_ICON %ScoreParticles.add_child(sprite_particle) @@ -85,6 +91,8 @@ func spawn_score_particle( await tween.finished + score_mirror += 1 + sprite_particle.queue_free() @@ -94,13 +102,10 @@ func _on_player_action_tried_without_energy(): func _on_player_upgraded(): $EffectAnimation.play("upgrade") -func _on_planet_pass_day_started(_planet): - %PassDay.pass_day_animation() - -func _on_planet_pass_day_ended(planet:Planet): - if planet.data.charges == 1: +func _on_region_pass_day_ended(region:Region): + if region.data.charges == 1: %Announce.announce( tr("LAST_RECHARGE"), - tr("%d_GARDEN_SCORE_LEFT") % [planet.data.objective - planet.garden.get_score()], + tr("%d_GARDEN_SCORE_LEFT") % [region.data.objective - region.garden.get_score()], Announce.RED_COLOR ) diff --git a/gui/game/tutorial/in_game_indicator/scripts/in_game_base_indicator.gd b/gui/game/tutorial/in_game_indicator/scripts/in_game_base_indicator.gd index af49e78..082e012 100644 --- a/gui/game/tutorial/in_game_indicator/scripts/in_game_base_indicator.gd +++ b/gui/game/tutorial/in_game_indicator/scripts/in_game_base_indicator.gd @@ -6,13 +6,13 @@ class_name InGameBaseIndicator # Called when the node enters the scene tree for the first time. func _ready(): setup(tr("GARDEN")) - follow_game_position(Planet.CHUNK_SIZE / 2. * Vector2.ONE) + follow_game_position(Region.CHUNK_SIZE / 2. * Vector2.ONE) func _process(_delta): visible = player and ( player.global_position.x < 0 - or player.global_position.x > Planet.CHUNK_SIZE + or player.global_position.x > Region.CHUNK_SIZE or player.global_position.y < 0 - or player.global_position.y > Planet.CHUNK_SIZE + or player.global_position.y > Region.CHUNK_SIZE ) update() diff --git a/gui/game/tutorial/scripts/tutorial.gd b/gui/game/tutorial/scripts/tutorial.gd index 2758f7d..3e7790e 100644 --- a/gui/game/tutorial/scripts/tutorial.gd +++ b/gui/game/tutorial/scripts/tutorial.gd @@ -5,7 +5,7 @@ const INDICATOR_SCENE = preload("res://gui/game/tutorial/in_game_indicator/in_ga var indicators : Array[InGameIndicator] @export var player : Player -@export var planet : Planet +@export var region : Region @onready var steps : Array[Step] = [ TakeShovelStep.new(), @@ -19,18 +19,18 @@ var indicators : Array[InGameIndicator] var actual_step : Step = null : set = pass_to_step func _process(_d): - if not GameInfo.game_data.tutorial_done: - if not actual_step and planet.data.tutorial_step < len(steps): + if region.data.tutorial: + if not actual_step and region.data.tutorial_step < len(steps): destroy_indicators() - pass_to_step(steps[planet.data.tutorial_step]) + pass_to_step(steps[region.data.tutorial_step]) - if player and actual_step and actual_step.is_step_over(player, planet): + if player and actual_step and actual_step.is_step_over(player, region): destroy_indicators() - planet.data.tutorial_step += 1 - if planet.data.tutorial_step < len(steps): - pass_to_step(steps[planet.data.tutorial_step]) - else : - GameInfo.game_data.tutorial_done = true + region.data.tutorial_step += 1 + if region.data.tutorial_step < len(steps): + pass_to_step(steps[region.data.tutorial_step]) + else: + destroy_indicators() func destroy_indicators(): for i in indicators: @@ -39,7 +39,7 @@ func destroy_indicators(): func pass_to_step(new_step : Step): actual_step = new_step - indicators = new_step.generate_indicators(player, planet) + indicators = new_step.generate_indicators(player, region) for i in indicators: add_child(i) @@ -51,15 +51,15 @@ class Step: ) return new_indicator - func generate_indicators(_player : Player, _planet : Planet) -> Array[InGameIndicator]: + func generate_indicators(_player : Player, _region : Region) -> Array[InGameIndicator]: return [] - func is_step_over(_p : Player, _planet : Planet) -> bool: + func is_step_over(_p : Player, _region : Region) -> bool: return true class TakeShovelStep extends Step: - func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]: - for entity in planet.entity_container.get_children(): + func generate_indicators(_p: Player, region : Region) -> Array[InGameIndicator]: + for entity in region.entity_container.get_children(): if entity is ItemObject and entity.item is Shovel: var indicator = generate_indicator(tr("TAKE_THE_SHOVEL")) indicator.follow_entity(entity) @@ -69,14 +69,14 @@ class TakeShovelStep extends Step: printerr("No Shovel found...") return [] - func is_step_over(p : Player, _planet : Planet) -> bool: + func is_step_over(p : Player, _region : Region) -> bool: for item in p.data.inventory.items: if item is Shovel: return true return false class DigSeedStep extends Step: - func generate_indicators(p: Player, planet : Planet) -> Array[InGameIndicator]: + func generate_indicators(p: Player, region : Region) -> Array[InGameIndicator]: var closest_seed = null var limit_distance = 1000 @@ -87,7 +87,7 @@ class DigSeedStep extends Step: for x in range(actual_distance): for y in range(actual_distance): var coord = Vector2i(x,y) - Vector2i.ONE * floori(actual_distance/2.) + player_tile - if planet.rock_layer.get_tile_type(coord) == RockLayer.TileType.CRISTAL: + if region.rock_layer.get_tile_type(coord) == RockLayer.TileType.CRISTAL: if closest_seed == null or player_tile.distance_to(coord) < player_tile.distance_to(closest_seed): closest_seed = coord @@ -95,20 +95,20 @@ class DigSeedStep extends Step: if closest_seed: var indicator = generate_indicator(tr("DIG_UNDERGROUND_LOOT")) - indicator.follow_game_position(closest_seed * Planet.TILE_SIZE + Vector2i.ONE * floori(Planet.TILE_SIZE/2.)) + indicator.follow_game_position(closest_seed * Region.TILE_SIZE + Vector2i.ONE * floori(Region.TILE_SIZE/2.)) return [indicator] return [] - func is_step_over(_p : Player, planet : Planet) -> bool: - for entity in planet.entity_container.get_children(): + func is_step_over(_p : Player, region : Region) -> bool: + for entity in region.entity_container.get_children(): if entity is ItemObject and entity.item is Seed: return true return false class TakeSeedStep extends Step: - func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]: + func generate_indicators(_p: Player, region : Region) -> Array[InGameIndicator]: var indicators : Array[InGameIndicator] = [] - for entity in planet.entity_container.get_children(): + for entity in region.entity_container.get_children(): if entity is ItemObject and entity.item is Seed: var indicator = generate_indicator(tr("TAKE_A_SEED")) indicator.follow_entity(entity) @@ -117,27 +117,27 @@ class TakeSeedStep extends Step: ) return indicators - func is_step_over(p : Player, _planet : Planet) -> bool: + func is_step_over(p : Player, _region : Region) -> bool: for item in p.data.inventory.items: if item is Seed: return true return false class PlantSeedStep extends Step: - func generate_indicators(p: Player, planet : Planet) -> Array[InGameIndicator]: + func generate_indicators(p: Player, region : Region) -> Array[InGameIndicator]: var indicator = generate_indicator(tr("PLANT_THE_SEED_IN_DECONTAMINED_ZONE")) - indicator.follow_game_position(Planet.CHUNK_TILE_SIZE/2. * Planet.TILE_SIZE * Vector2.ONE) + indicator.follow_game_position(Region.CHUNK_TILE_SIZE/2. * Region.TILE_SIZE * Vector2.ONE) return [indicator] - func is_step_over(_p : Player, planet : Planet) -> bool: - for entity in planet.entity_container.get_children(): + func is_step_over(_p : Player, region : Region) -> bool: + for entity in region.entity_container.get_children(): if entity is Plant: return true return false class RechargeStep extends Step: - func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]: - for entity in planet.entity_container.get_children(): + func generate_indicators(_p: Player, region : Region) -> Array[InGameIndicator]: + for entity in region.entity_container.get_children(): var indicator = generate_indicator(tr("RECHARGE_TO_PASS_DAYS")) indicator.follow_entity(entity) if entity is TruckRecharge: @@ -147,20 +147,20 @@ class RechargeStep extends Step: printerr("No Recharge Station found...") return [] - func is_step_over(_p : Player, planet : Planet) -> bool: - if planet == null : + func is_step_over(_p : Player, region : Region) -> bool: + if region == null : return false - return planet.data.day > 1 + return region.data.day > 1 class WaitMaturePlant extends Step: - func generate_indicators(_p: Player, _planet : Planet) -> Array[InGameIndicator]: + func generate_indicators(_p: Player, _region : Region) -> Array[InGameIndicator]: return [] - func is_step_over(_p : Player, planet : Planet) -> bool: - if planet == null : + func is_step_over(_p : Player, region : Region) -> bool: + if region == null : return false - for entity in planet.entity_container.get_children(): - if entity is Plant and entity.state == Plant.State.MATURE: + for entity in region.entity_container.get_children(): + if entity is Plant and entity.data.get_state() == PlantData.State.MATURE: return true return false @@ -168,10 +168,10 @@ class HarvestMaturePlant extends Step: var mature_plant_number : int = 0 - func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]: + func generate_indicators(_p: Player, region : Region) -> Array[InGameIndicator]: var indicators : Array[InGameIndicator] = [] - for entity in planet.entity_container.get_children(): - if entity is Plant and entity.state == Plant.State.MATURE: + for entity in region.entity_container.get_children(): + if entity is Plant and entity.data.get_state() == PlantData.State.MATURE: var indicator = generate_indicator(tr("HARVEST_MATURE_PLANTS_WITH_SHOVEL")) indicator.follow_entity(entity) indicators.append( @@ -180,11 +180,11 @@ class HarvestMaturePlant extends Step: mature_plant_number += 1 return indicators - func is_step_over(_p : Player, planet : Planet) -> bool: - if planet == null : + func is_step_over(_p : Player, region : Region) -> bool: + if region == null : return false var actual_mature_plant_number = 0 - for entity in planet.entity_container.get_children(): - if entity is Plant and entity.state == Plant.State.MATURE: + for entity in region.entity_container.get_children(): + if entity is Plant and entity.data.get_state() == PlantData.State.MATURE: actual_mature_plant_number += 1 return mature_plant_number != actual_mature_plant_number diff --git a/gui/game/win/scripts/win.gd b/gui/game/win/scripts/win.gd index e410082..9edd3cb 100644 --- a/gui/game/win/scripts/win.gd +++ b/gui/game/win/scripts/win.gd @@ -5,19 +5,19 @@ extends Control func _ready(): visible = false -func win(planet : Planet): +func win(region : Region): visible = true get_tree().paused = true - %WinTitle.text = tr("SCORE_%d") % roundi(planet.garden.get_score()) + %WinTitle.text = tr("SCORE_%d") % roundi(region.garden.get_score()) func _on_restart_pressed(): GameInfo.game_data.reset_all() get_tree().paused = false - SceneManager.change_scene(SceneManager.REGION_SELECTION_SCREEN) + SceneManager.change_scene("REGION_SELECTION") func _on_quit_pressed(): get_tree().quit() -func _on_planet_day_limit_exceed(planet : Planet): - win(planet) +func _on_region_day_limit_exceed(region : Region): + win(region) diff --git a/gui/menu/assets/texture/abre1glow.png b/gui/menu/assets/texture/abre1glow.png deleted file mode 100644 index 6580506..0000000 Binary files a/gui/menu/assets/texture/abre1glow.png and /dev/null differ diff --git a/gui/menu/assets/texture/abre1glow.png.import b/gui/menu/assets/texture/abre1glow.png.import deleted file mode 100644 index 72cb458..0000000 --- a/gui/menu/assets/texture/abre1glow.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://03ijmo6xlytu" -path="res://.godot/imported/abre1glow.png-5f3f846ff6582fe5f49aa264265fe9c7.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://gui/menu/assets/texture/abre1glow.png" -dest_files=["res://.godot/imported/abre1glow.png-5f3f846ff6582fe5f49aa264265fe9c7.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -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/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 diff --git a/gui/menu/scripts/menu.gd b/gui/menu/scripts/menu.gd deleted file mode 100644 index 5def6c4..0000000 --- a/gui/menu/scripts/menu.gd +++ /dev/null @@ -1,6 +0,0 @@ -extends Node - -@export_file var start_scene_path : String - -func _ready(): - SceneManager.change_scene(start_scene_path) diff --git a/gui/menu/scripts/menu.gd.uid b/gui/menu/scripts/menu.gd.uid deleted file mode 100644 index ef5b5cd..0000000 --- a/gui/menu/scripts/menu.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dls7t1m62lp5v diff --git a/gui/pointer/scripts/pointer.gd b/gui/pointer/scripts/pointer.gd index 35cb16e..f52255b 100644 --- a/gui/pointer/scripts/pointer.gd +++ b/gui/pointer/scripts/pointer.gd @@ -72,7 +72,7 @@ func _process(delta): can_use_item = could_use_item and have_energy_to_use_item - if current_selected_item: + if current_selected_item and SceneManager.actual_scene.scene_id == "REGION": %ActionZone.radius = current_selected_item.usage_zone_radius %ActionZone.color = ZONE_ACTIVATED_COLOR if can_use_item else ZONE_DEACTIVATED_COLOR else: diff --git a/gui/tools/control_animation_player.gd b/gui/tools/control_animation_player.gd index 90d2d48..03a31d3 100644 --- a/gui/tools/control_animation_player.gd +++ b/gui/tools/control_animation_player.gd @@ -173,6 +173,7 @@ func bounce( transition_type ).finished end_anim() + target.position = target_default_pos func shake( duration : float = 0.3, diff --git a/project.godot b/project.godot index 4f587ca..8c44d56 100644 --- a/project.godot +++ b/project.godot @@ -29,7 +29,7 @@ GameInfo="*res://common/game_info/game_info.gd" Pause="*res://gui/game/pause/pause.tscn" Dialogic="*res://addons/dialogic/Core/DialogicGameHandler.gd" LoadingScreen="*res://gui/loading_screen/loading_screen.tscn" -SceneManager="*res://common/scene_manager/scene_manager.gd" +SceneManager="*res://common/scene_manager/scene_manager.tscn" [dialogic] diff --git a/root.gd b/root.gd index dc9a741..eee41d8 100644 --- a/root.gd +++ b/root.gd @@ -1,4 +1,4 @@ extends Node func _ready(): - SceneManager.change_scene(SceneManager.TITLE_SCREEN) \ No newline at end of file + SceneManager.change_scene("TITLE", false) \ No newline at end of file diff --git a/stages/cockpit/assets/3d/cockpit.blend b/stages/cockpit/assets/3d/cockpit.blend index a638d12..637ab45 100644 Binary files a/stages/cockpit/assets/3d/cockpit.blend and b/stages/cockpit/assets/3d/cockpit.blend differ diff --git a/stages/cockpit/assets/3d/cockpit.blend1 b/stages/cockpit/assets/3d/cockpit.blend1 index 8370529..dad9b24 100644 Binary files a/stages/cockpit/assets/3d/cockpit.blend1 and b/stages/cockpit/assets/3d/cockpit.blend1 differ diff --git a/stages/cockpit/assets/textures/stickers/cockpit_sticker_1.png b/stages/cockpit/assets/textures/stickers/cockpit_sticker_1.png new file mode 100644 index 0000000..88ea397 Binary files /dev/null and b/stages/cockpit/assets/textures/stickers/cockpit_sticker_1.png differ diff --git a/stages/cockpit/assets/textures/stickers/cockpit_sticker_1.png.import b/stages/cockpit/assets/textures/stickers/cockpit_sticker_1.png.import new file mode 100644 index 0000000..af64769 --- /dev/null +++ b/stages/cockpit/assets/textures/stickers/cockpit_sticker_1.png.import @@ -0,0 +1,41 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bbf7yy5rbgyju" +path.s3tc="res://.godot/imported/cockpit_sticker_1.png-af9ab6421f133456466632a45bc924d2.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://stages/cockpit/assets/textures/stickers/cockpit_sticker_1.png" +dest_files=["res://.godot/imported/cockpit_sticker_1.png-af9ab6421f133456466632a45bc924d2.s3tc.ctex"] + +[params] + +compress/mode=2 +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=true +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=0 diff --git a/stages/cockpit/assets/textures/stickers/cockpit_sticker_2.png b/stages/cockpit/assets/textures/stickers/cockpit_sticker_2.png new file mode 100644 index 0000000..a2b6b67 Binary files /dev/null and b/stages/cockpit/assets/textures/stickers/cockpit_sticker_2.png differ diff --git a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png.import b/stages/cockpit/assets/textures/stickers/cockpit_sticker_2.png.import similarity index 59% rename from entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png.import rename to stages/cockpit/assets/textures/stickers/cockpit_sticker_2.png.import index 0c78bc8..485bf31 100644 --- a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png.import +++ b/stages/cockpit/assets/textures/stickers/cockpit_sticker_2.png.import @@ -2,20 +2,21 @@ importer="texture" type="CompressedTexture2D" -uid="uid://c22re5wfsm1ax" -path="res://.godot/imported/panneau_solaire_3.png-022ae039aa352e1519471d4f9c114a8b.ctex" +uid="uid://63drr6hunnr" +path.s3tc="res://.godot/imported/cockpit_sticker_2.png-d807c76b150ee8eb26f7b5038e21a383.s3tc.ctex" metadata={ -"vram_texture": false +"imported_formats": ["s3tc_bptc"], +"vram_texture": true } [deps] -source_file="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png" -dest_files=["res://.godot/imported/panneau_solaire_3.png-022ae039aa352e1519471d4f9c114a8b.ctex"] +source_file="res://stages/cockpit/assets/textures/stickers/cockpit_sticker_2.png" +dest_files=["res://.godot/imported/cockpit_sticker_2.png-d807c76b150ee8eb26f7b5038e21a383.s3tc.ctex"] [params] -compress/mode=0 +compress/mode=2 compress/high_quality=false compress/lossy_quality=0.7 compress/uastc_level=0 @@ -23,7 +24,7 @@ compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 -mipmaps/generate=false +mipmaps/generate=true mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" @@ -37,4 +38,4 @@ 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 +detect_3d/compress_to=0 diff --git a/stages/cockpit/assets/textures/stickers/cockpit_sticker_3.png b/stages/cockpit/assets/textures/stickers/cockpit_sticker_3.png new file mode 100644 index 0000000..e17199d Binary files /dev/null and b/stages/cockpit/assets/textures/stickers/cockpit_sticker_3.png differ diff --git a/stages/cockpit/assets/textures/stickers/cockpit_sticker_3.png.import b/stages/cockpit/assets/textures/stickers/cockpit_sticker_3.png.import new file mode 100644 index 0000000..e4bde6e --- /dev/null +++ b/stages/cockpit/assets/textures/stickers/cockpit_sticker_3.png.import @@ -0,0 +1,41 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b3iqtjjj5xyw0" +path.s3tc="res://.godot/imported/cockpit_sticker_3.png-18043bf04a8085e1def5c583bc308daa.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://stages/cockpit/assets/textures/stickers/cockpit_sticker_3.png" +dest_files=["res://.godot/imported/cockpit_sticker_3.png-18043bf04a8085e1def5c583bc308daa.s3tc.ctex"] + +[params] + +compress/mode=2 +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=true +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=0 diff --git a/stages/cockpit/assets/textures/stickers/cockpit_sticker_4.png b/stages/cockpit/assets/textures/stickers/cockpit_sticker_4.png new file mode 100644 index 0000000..c35c862 Binary files /dev/null and b/stages/cockpit/assets/textures/stickers/cockpit_sticker_4.png differ diff --git a/stages/cockpit/assets/textures/stickers/cockpit_sticker_4.png.import b/stages/cockpit/assets/textures/stickers/cockpit_sticker_4.png.import new file mode 100644 index 0000000..9d74f21 --- /dev/null +++ b/stages/cockpit/assets/textures/stickers/cockpit_sticker_4.png.import @@ -0,0 +1,41 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bfqig5y56fwfs" +path.s3tc="res://.godot/imported/cockpit_sticker_4.png-4e4fb39a62d1c769ec6529b2ef9759e0.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://stages/cockpit/assets/textures/stickers/cockpit_sticker_4.png" +dest_files=["res://.godot/imported/cockpit_sticker_4.png-4e4fb39a62d1c769ec6529b2ef9759e0.s3tc.ctex"] + +[params] + +compress/mode=2 +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=true +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=0 diff --git a/stages/cockpit/assets/textures/stickers/cockpit_sticker_5.png b/stages/cockpit/assets/textures/stickers/cockpit_sticker_5.png new file mode 100644 index 0000000..51c5a52 Binary files /dev/null and b/stages/cockpit/assets/textures/stickers/cockpit_sticker_5.png differ diff --git a/stages/cockpit/assets/textures/stickers/cockpit_sticker_5.png.import b/stages/cockpit/assets/textures/stickers/cockpit_sticker_5.png.import new file mode 100644 index 0000000..23d550a --- /dev/null +++ b/stages/cockpit/assets/textures/stickers/cockpit_sticker_5.png.import @@ -0,0 +1,41 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cq0xvydfqk0x4" +path.s3tc="res://.godot/imported/cockpit_sticker_5.png-56e6eb784061ef418c815c147c87ca74.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://stages/cockpit/assets/textures/stickers/cockpit_sticker_5.png" +dest_files=["res://.godot/imported/cockpit_sticker_5.png-56e6eb784061ef418c815c147c87ca74.s3tc.ctex"] + +[params] + +compress/mode=2 +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=true +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=0 diff --git a/stages/cockpit/cockpit.tscn b/stages/cockpit/cockpit.tscn index 3dbbe5f..8da1617 100644 --- a/stages/cockpit/cockpit.tscn +++ b/stages/cockpit/cockpit.tscn @@ -1,14 +1,23 @@ -[gd_scene load_steps=28 format=3 uid="uid://fhnrl3dregsm"] +[gd_scene load_steps=47 format=3 uid="uid://fhnrl3dregsm"] [ext_resource type="Script" uid="uid://b4tpigoloyxu0" path="res://stages/cockpit/scripts/cockpit.gd" id="1_koamw"] [ext_resource type="Shader" uid="uid://bv2rghn44mrrf" path="res://stages/title_screen/resources/shaders/stars.gdshader" id="1_sk3hm"] [ext_resource type="PackedScene" uid="uid://xsllr3c4yde1" path="res://stages/cockpit/assets/3d/cockpit.blend" id="2_3b5pk"] +[ext_resource type="Texture2D" uid="uid://63drr6hunnr" path="res://stages/cockpit/assets/textures/stickers/cockpit_sticker_2.png" id="2_x3r0l"] [ext_resource type="Texture2D" uid="uid://l2xplg72hs6j" path="res://common/icons/map-pin.svg" id="3_3b5pk"] +[ext_resource type="Texture2D" uid="uid://bbf7yy5rbgyju" path="res://stages/cockpit/assets/textures/stickers/cockpit_sticker_1.png" id="3_5t1te"] +[ext_resource type="Texture2D" uid="uid://b3iqtjjj5xyw0" path="res://stages/cockpit/assets/textures/stickers/cockpit_sticker_3.png" id="3_i3c17"] [ext_resource type="PackedScene" uid="uid://cm5b7w7j6527f" path="res://stages/title_screen/planet_3d.tscn" id="3_oq6nq"] [ext_resource type="Texture2D" uid="uid://dks6cugwif2em" path="res://common/icons/phone.svg" id="4_bse8l"] +[ext_resource type="Texture2D" uid="uid://cq0xvydfqk0x4" path="res://stages/cockpit/assets/textures/stickers/cockpit_sticker_5.png" id="4_omtjc"] [ext_resource type="Texture2D" uid="uid://dex283rx00fjb" path="res://common/icons/logout.svg" id="5_oq6nq"] [ext_resource type="Script" uid="uid://bj4d1x8n8ina" path="res://stages/cockpit/scripts/cockpit_action.gd" id="6_22o3l"] -[ext_resource type="Script" uid="uid://jsxatpqfid88" path="res://stages/cockpit/scripts/cockpit_camera.gd" id="8_koamw"] +[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="9_i3c17"] +[ext_resource type="Theme" uid="uid://5au2k3vf2po3" path="res://gui/ressources/menu.tres" id="10_i3c17"] +[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/hud.tres" id="10_j2e5k"] +[ext_resource type="Texture2D" uid="uid://ba8vh5h3r6pr2" path="res://common/icons/focus.svg" id="11_6o275"] +[ext_resource type="PackedScene" uid="uid://clicjf8ts51h8" path="res://gui/game/inventory_gui/inventory_gui.tscn" id="11_eodxe"] +[ext_resource type="PackedScene" uid="uid://da7a74dg30q1l" path="res://stages/cockpit/player_3d/player_3D.tscn" id="13_a2cx2"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_7a1qq"] shader = ExtResource("1_sk3hm") @@ -49,51 +58,55 @@ fog_sky_affect = 0.0 adjustment_enabled = true adjustment_saturation = 1.3 -[sub_resource type="FastNoiseLite" id="FastNoiseLite_22o3l"] -seed = -1177198901 -frequency = 1.0 +[sub_resource type="PlaneMesh" id="PlaneMesh_omtjc"] +size = Vector2(0.2, 0.2) -[sub_resource type="Animation" id="Animation_koamw"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_i3c17"] +transparency = 1 +albedo_texture = ExtResource("2_x3r0l") + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_x34yc"] +transparency = 1 +albedo_texture = ExtResource("3_i3c17") + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_omtjc"] +transparency = 1 +albedo_texture = ExtResource("3_5t1te") + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_b2myc"] +transparency = 1 +albedo_texture = ExtResource("4_omtjc") + +[sub_resource type="ViewportTexture" id="ViewportTexture_x34yc"] +viewport_path = NodePath("Screens/MissionStatusScreen/SubViewport") + +[sub_resource type="ViewportTexture" id="ViewportTexture_omtjc"] +viewport_path = NodePath("Screens/MissionInfoScreen/SubViewport") + +[sub_resource type="StyleBoxLine" id="StyleBoxLine_i3c17"] +color = Color(1, 1, 1, 1) +grow_begin = -20.0 +grow_end = -20.0 +thickness = 2 + +[sub_resource type="SphereShape3D" id="SphereShape3D_3b5pk"] +radius = 0.7953847 + +[sub_resource type="Animation" id="Animation_a2cx2"] length = 0.001 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("../Planet3d:rotation:z") +tracks/0/path = NodePath("Sprite3D:scale") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), -"update": 1, -"values": [0.0] -} - -[sub_resource type="Animation" id="Animation_22o3l"] -resource_name = "turn" -length = 50.0 -loop_mode = 1 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("../Planet3d:rotation:z") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 50), -"transitions": PackedFloat32Array(1, 1), "update": 0, -"values": [0.0, -6.283] +"values": [Vector3(1, 1, 1)] } -[sub_resource type="AnimationLibrary" id="AnimationLibrary_biiuk"] -_data = { -&"RESET": SubResource("Animation_koamw"), -&"turn": SubResource("Animation_22o3l") -} - -[sub_resource type="SphereShape3D" id="SphereShape3D_3b5pk"] -radius = 0.5618684 - [sub_resource type="Animation" id="Animation_eodxe"] resource_name = "hover" length = 0.6 @@ -111,28 +124,30 @@ tracks/0/keys = { "values": [Vector3(1, 1, 1), Vector3(1.4, 1.4, 1.4), Vector3(1, 1, 1)] } -[sub_resource type="Animation" id="Animation_a2cx2"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Sprite3D:scale") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [Vector3(1, 1, 1)] -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_6o275"] _data = { &"RESET": SubResource("Animation_a2cx2"), &"hover": SubResource("Animation_eodxe") } -[sub_resource type="SphereShape3D" id="SphereShape3D_oq6nq"] +[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_eodxe"] +radius = 0.50097656 +height = 1.5996094 + +[sub_resource type="Animation" id="Animation_j2e5k"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite3D2:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector3(0.9, 0.9, 0.9)] +} [sub_resource type="Animation" id="Animation_biiuk"] resource_name = "hover" @@ -141,53 +156,14 @@ loop_mode = 1 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("Sprite3D:scale") -tracks/0/interp = 2 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.3, 0.6), -"transitions": PackedFloat32Array(1, 1, 1), -"update": 0, -"values": [Vector3(0.4, 0.4, 0.4), Vector3(0.6, 0.6, 0.6), Vector3(0.4, 0.4, 0.4)] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Sprite3D2:scale") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0, 0.3, 0.6), -"transitions": PackedFloat32Array(1, 1, 1), -"update": 0, -"values": [Vector3(0.4, 0.4, 0.4), Vector3(0.6, 0.6, 0.6), Vector3(0.4, 0.4, 0.4)] -} - -[sub_resource type="Animation" id="Animation_j2e5k"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Sprite3D:scale") +tracks/0/path = NodePath("Sprite3D2:scale") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), +"times": PackedFloat32Array(0, 0.3, 0.6), +"transitions": PackedFloat32Array(1, 1, 1), "update": 0, -"values": [Vector3(0.4, 0.4, 0.4)] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Sprite3D2:scale") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [Vector3(0.4, 0.4, 0.4)] +"values": [Vector3(0.9, 0.9, 0.9), Vector3(1.2, 1.2, 1.2), Vector3(0.9, 0.9, 0.9)] } [sub_resource type="AnimationLibrary" id="AnimationLibrary_eodxe"] @@ -196,64 +172,357 @@ _data = { &"hover": SubResource("Animation_biiuk") } -[sub_resource type="Animation" id="Animation_oq6nq"] +[sub_resource type="FastNoiseLite" id="FastNoiseLite_i3c17"] +seed = 1456598324 +frequency = 1.0 + +[sub_resource type="Animation" id="Animation_koamw"] length = 0.001 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("Camera3D:position:x") +tracks/0/path = NodePath("Planet3d:rotation") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), -"update": 1, -"values": [0.35664433] +"update": 0, +"values": [Vector3(0, 0, 0)] +} + +[sub_resource type="Animation" id="Animation_22o3l"] +resource_name = "turn" +length = 50.0 +loop_mode = 1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Planet3d:rotation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 50), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector3(0, 0, 0), Vector3(0, 0, -6.2831855)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_biiuk"] +_data = { +&"RESET": SubResource("Animation_koamw"), +&"turn": SubResource("Animation_22o3l") +} + +[sub_resource type="Animation" id="Animation_gspic"] +resource_name = "Failed" +length = 0.1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Screens/MissionStatusScreen/SubViewport/MissionStatusScreenBackground:color") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(0.9849854, 0.19995773, 0.28067547, 0.74509805)] } tracks/1/type = "value" tracks/1/imported = false tracks/1/enabled = true -tracks/1/path = NodePath("Camera3D:position:y") +tracks/1/path = NodePath("Screens/MissionInfoScreen/SubViewport/MissionInfoScreenBackground:color") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(0.9843137, 0.2, 0.28235295, 0.74509805)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Screens/MissionStatusScreen/SubViewport/MarginContainer/MissionSuceededLabel:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), "update": 1, -"values": [0.0] +"values": [false] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Screens/MissionStatusScreen/SubViewport/MarginContainer/MissionFailedLabel:visible") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [true] +} +tracks/4/type = "value" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("OmniLight3D:light_color") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(0.97731525, 0.2915524, 0.2839255, 1)] +} +tracks/5/type = "value" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("Screens/MissionStatusScreen/SubViewport/MarginContainer/MissionInProgressLabel:visible") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { +"times": PackedFloat32Array(0.033333335), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] } -[sub_resource type="Animation" id="Animation_bse8l"] -resource_name = "arrive" +[sub_resource type="Animation" id="Animation_ad5tn"] +resource_name = "InProgress" +length = 0.1 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("Camera3D:position:x") -tracks/0/interp = 2 +tracks/0/path = NodePath("Screens/MissionStatusScreen/SubViewport/MissionStatusScreenBackground:color") +tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { -"times": PackedFloat32Array(0, 1), -"transitions": PackedFloat32Array(1, 1), +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), "update": 0, -"values": [1.5, 0.4649279] +"values": [Color(0.9019608, 0.36078432, 0, 0.74509805)] } tracks/1/type = "value" tracks/1/imported = false tracks/1/enabled = true -tracks/1/path = NodePath("Camera3D:position:y") -tracks/1/interp = 2 +tracks/1/path = NodePath("Screens/MissionInfoScreen/SubViewport/MissionInfoScreenBackground:color") +tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/keys = { -"times": PackedFloat32Array(0, 0.23333333, 0.5, 0.73333335, 1), -"transitions": PackedFloat32Array(1, 1, 1, 1, 1), +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), "update": 0, -"values": [0.0, -0.1, 0.0, -0.1, 0.0] +"values": [Color(0.9, 0.36, 0, 0.74509805)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Screens/MissionStatusScreen/SubViewport/MarginContainer/MissionSuceededLabel:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Screens/MissionStatusScreen/SubViewport/MarginContainer/MissionFailedLabel:visible") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} +tracks/4/type = "value" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("OmniLight3D:light_color") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 0.7176471, 0.011764706, 1)] +} +tracks/5/type = "value" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("Screens/MissionStatusScreen/SubViewport/MarginContainer/MissionInProgressLabel:visible") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [true] } -[sub_resource type="AnimationLibrary" id="AnimationLibrary_4qr0g"] +[sub_resource type="Animation" id="Animation_i3c17"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Screens/MissionStatusScreen/SubViewport/MissionStatusScreenBackground:color") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(0.9019608, 0.36078432, 0, 0.74509805)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Screens/MissionInfoScreen/SubViewport/MissionInfoScreenBackground:color") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(0.9, 0.36, 0, 0.74509805)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Screens/MissionStatusScreen/SubViewport/MarginContainer/MissionSuceededLabel:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Screens/MissionStatusScreen/SubViewport/MarginContainer/MissionFailedLabel:visible") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} +tracks/4/type = "value" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("OmniLight3D:light_color") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 0.7176471, 0.011764706, 1)] +} +tracks/5/type = "value" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("Screens/MissionStatusScreen/SubViewport/MarginContainer/MissionInProgressLabel:visible") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [true] +} + +[sub_resource type="Animation" id="Animation_x34yc"] +resource_name = "Succeeded" +length = 0.1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Screens/MissionStatusScreen/SubViewport/MissionStatusScreenBackground:color") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(0.37824857, 0.63324684, 0.22696605, 0.74509805)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Screens/MissionInfoScreen/SubViewport/MissionInfoScreenBackground:color") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(0.3764706, 0.6313726, 0.22745098, 0.74509805)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Screens/MissionStatusScreen/SubViewport/MarginContainer/MissionSuceededLabel:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [true] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Screens/MissionStatusScreen/SubViewport/MarginContainer/MissionFailedLabel:visible") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} +tracks/4/type = "value" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("OmniLight3D:light_color") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(0.5093917, 0.8912099, 0.21535316, 1)] +} +tracks/5/type = "value" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("Screens/MissionStatusScreen/SubViewport/MarginContainer/MissionInProgressLabel:visible") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_gspic"] _data = { -&"RESET": SubResource("Animation_oq6nq"), -&"arrive": SubResource("Animation_bse8l") +&"Failed": SubResource("Animation_gspic"), +&"InProgress": SubResource("Animation_ad5tn"), +&"RESET": SubResource("Animation_i3c17"), +&"Succeeded": SubResource("Animation_x34yc") } [node name="Cockpit" type="Node3D"] @@ -262,21 +531,182 @@ script = ExtResource("1_koamw") [node name="WorldEnvironment" type="WorldEnvironment" parent="."] environment = SubResource("Environment_ers7b") +[node name="Stickers" type="Node3D" parent="."] + +[node name="Sprite3D2" type="MeshInstance3D" parent="Stickers"] +transform = Transform3D(-1, -8.560637e-08, -1.7728233e-08, 0, 0.20278734, -0.9792228, 8.742278e-08, -0.9792228, -0.20278734, 2.1191812, 0.086021006, 1.3936621) +mesh = SubResource("PlaneMesh_omtjc") +surface_material_override/0 = SubResource("StandardMaterial3D_i3c17") + +[node name="Sprite3D4" type="MeshInstance3D" parent="Stickers"] +transform = Transform3D(-1, 8.742278e-08, -3.821371e-15, 0, -4.371139e-08, -1, -8.742278e-08, -1, 4.371139e-08, 4.7137933, 0.1327298, 0.21573234) +mesh = SubResource("PlaneMesh_omtjc") +surface_material_override/0 = SubResource("StandardMaterial3D_x34yc") + +[node name="Sprite3D5" type="MeshInstance3D" parent="Stickers"] +transform = Transform3D(-1, 8.742278e-08, -3.821371e-15, 0, -4.371139e-08, -1, -8.742278e-08, -1, 4.371139e-08, 4.512491, 0.377854, 0.21573234) +mesh = SubResource("PlaneMesh_omtjc") +surface_material_override/0 = SubResource("StandardMaterial3D_omtjc") + +[node name="Sprite3D3" type="MeshInstance3D" parent="Stickers"] +transform = Transform3D(-1, -8.560637e-08, -1.7728233e-08, 0, 0.20278734, -0.9792228, 8.742278e-08, -0.9792228, -0.20278734, 1.8158855, 0.27269027, 1.4397132) +mesh = SubResource("PlaneMesh_omtjc") +surface_material_override/0 = SubResource("StandardMaterial3D_b2myc") + [node name="Cockpit" parent="." instance=ExtResource("2_3b5pk")] -[node name="Planet3d" parent="." instance=ExtResource("3_oq6nq")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -33.448, -83.679, 0) -radius = 80.0 -details = 112 -noise = SubResource("FastNoiseLite_22o3l") -height = 11.26 +[node name="Screens" type="Node3D" parent="."] -[node name="AnimationPlayer" type="AnimationPlayer" parent="Planet3d"] -root_node = NodePath("../../ArriveAnimationPlayer") -libraries = { -&"": SubResource("AnimationLibrary_biiuk") -} -autoplay = "turn" +[node name="MissionStatusScreen" type="Sprite3D" parent="Screens"] +transform = Transform3D(-0.09661018, 0, 0.9953223, 0, 1, 0, -0.9953223, 0, -0.09661018, -0.9638628, 0.22434545, 0.9572436) +pixel_size = 0.003 +texture = SubResource("ViewportTexture_x34yc") + +[node name="SubViewport" type="SubViewport" parent="Screens/MissionStatusScreen"] +transparent_bg = true +size = Vector2i(300, 200) + +[node name="MissionStatusScreenBackground" type="ColorRect" parent="Screens/MissionStatusScreen/SubViewport"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0.9019608, 0.36078432, 0, 0.74509805) + +[node name="MarginContainer" type="MarginContainer" parent="Screens/MissionStatusScreen/SubViewport"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="MissionInProgressLabel" type="Label" parent="Screens/MissionStatusScreen/SubViewport/MarginContainer"] +layout_mode = 2 +size_flags_vertical = 1 +text = "MISSION_IN_PROGRESS" +label_settings = ExtResource("9_i3c17") +horizontal_alignment = 1 +vertical_alignment = 1 +autowrap_mode = 2 + +[node name="MissionSuceededLabel" type="Label" parent="Screens/MissionStatusScreen/SubViewport/MarginContainer"] +visible = false +layout_mode = 2 +size_flags_vertical = 1 +text = "MISSION_SUCCEEDED" +label_settings = ExtResource("9_i3c17") +horizontal_alignment = 1 +vertical_alignment = 1 +autowrap_mode = 2 + +[node name="MissionFailedLabel" type="Label" parent="Screens/MissionStatusScreen/SubViewport/MarginContainer"] +visible = false +layout_mode = 2 +size_flags_vertical = 1 +text = "MISSION_FAILED" +label_settings = ExtResource("9_i3c17") +horizontal_alignment = 1 +vertical_alignment = 1 +autowrap_mode = 2 + +[node name="MissionInfoScreen" type="Sprite3D" parent="Screens"] +transform = Transform3D(0.06808507, 0, 0.99767953, 0, 1, 0, -0.99767953, 0, 0.06808507, -0.94923043, 0.32125425, -0.8842205) +pixel_size = 0.003 +texture = SubResource("ViewportTexture_omtjc") + +[node name="SubViewport" type="SubViewport" parent="Screens/MissionInfoScreen"] +transparent_bg = true +size = Vector2i(200, 260) + +[node name="MissionInfoScreenBackground" type="ColorRect" parent="Screens/MissionInfoScreen/SubViewport"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0.9, 0.36, 0, 0.74509805) + +[node name="MarginContainer" type="MarginContainer" parent="Screens/MissionInfoScreen/SubViewport"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme = ExtResource("10_j2e5k") + +[node name="VBoxContainer" type="VBoxContainer" parent="Screens/MissionInfoScreen/SubViewport/MarginContainer"] +layout_mode = 2 +theme = ExtResource("10_j2e5k") + +[node name="RegionNameInfo" type="Label" parent="Screens/MissionInfoScreen/SubViewport/MarginContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "Blabloup" +label_settings = ExtResource("9_i3c17") +horizontal_alignment = 1 +autowrap_mode = 2 + +[node name="HSeparator" type="HSeparator" parent="Screens/MissionInfoScreen/SubViewport/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = 4 +theme_override_styles/separator = SubResource("StyleBoxLine_i3c17") + +[node name="DayNumberInfo" type="RichTextLabel" parent="Screens/MissionInfoScreen/SubViewport/MarginContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +theme = ExtResource("10_i3c17") +theme_override_font_sizes/normal_font_size = 25 +theme_override_font_sizes/bold_font_size = 25 +theme_override_font_sizes/bold_italics_font_size = 25 +theme_override_font_sizes/italics_font_size = 25 +theme_override_font_sizes/mono_font_size = 25 +bbcode_enabled = true +text = "Day [b]10[/b]" +fit_content = true +autowrap_mode = 2 +horizontal_alignment = 1 + +[node name="PlantNumberInfo" type="RichTextLabel" parent="Screens/MissionInfoScreen/SubViewport/MarginContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +theme = ExtResource("10_i3c17") +theme_override_font_sizes/normal_font_size = 25 +theme_override_font_sizes/bold_font_size = 25 +theme_override_font_sizes/bold_italics_font_size = 25 +theme_override_font_sizes/italics_font_size = 25 +theme_override_font_sizes/mono_font_size = 25 +bbcode_enabled = true +text = "5 plants" +fit_content = true +autowrap_mode = 2 +horizontal_alignment = 1 + +[node name="PlantPointInfo" type="RichTextLabel" parent="Screens/MissionInfoScreen/SubViewport/MarginContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +theme = ExtResource("10_i3c17") +theme_override_font_sizes/normal_font_size = 25 +theme_override_font_sizes/bold_font_size = 25 +theme_override_font_sizes/bold_italics_font_size = 25 +theme_override_font_sizes/italics_font_size = 25 +theme_override_font_sizes/mono_font_size = 25 +bbcode_enabled = true +text = "15 Garden Points" +fit_content = true +autowrap_mode = 2 +horizontal_alignment = 1 + +[node name="OmniLight3D" type="OmniLight3D" parent="."] +transform = Transform3D(0.88172376, -0.12210212, 0.45569107, -0.47176614, -0.22820693, 0.8516797, -4.3180254e-08, -0.9659258, -0.2588191, 2.9457722, 1.2488832, -0.00129807) +light_color = Color(1, 0.7176471, 0.011764706, 1) +light_energy = 0.05 +shadow_enabled = true +omni_attenuation = 0.048 + +[node name="Player3D" parent="." node_paths=PackedStringArray("pointer_texture_rect") instance=ExtResource("13_a2cx2")] +transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 2.390058, -0.2572075, -0.05658534) +pointer_texture_rect = NodePath("../CanvasLayer/Pointer") [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] transform = Transform3D(0.88172376, -0.122102074, 0.45569107, -0.47176614, -0.22820692, 0.8516797, 0, -0.9659259, -0.25881907, 0.03206873, 3.2286942, -1.7533616) @@ -287,16 +717,17 @@ directional_shadow_mode = 1 directional_shadow_split_1 = 0.039 [node name="MapAction" type="Area3D" parent="." node_paths=PackedStringArray("animation_player")] +unique_name_in_owner = true transform = Transform3D(-4.371139e-08, -0.9816273, 0.19080897, 0, 0.19080897, 0.9816273, -1, 4.290829e-08, -8.340525e-09, -0.652, -0.162, 0) script = ExtResource("6_22o3l") animation_player = NodePath("AnimationPlayer") [node name="Sprite3D" type="Sprite3D" parent="MapAction"] -transform = Transform3D(1, 0, 0, 0, 1, 3.5787761e-16, 0, -3.5787761e-16, 1, 0, 0, 0) +transform = Transform3D(1, 0, 0, 0, 1, 3.578776e-16, 0, -3.578776e-16, 1, 6.3611534e-09, 0.14808768, -0.0008355081) texture = ExtResource("3_3b5pk") [node name="CollisionShape3D" type="CollisionShape3D" parent="MapAction"] -transform = Transform3D(1, 2.1316282e-14, -5.3290705e-15, 0, 1, -3.5787743e-16, 0, -3.5787748e-16, 1, 4.1635495e-10, -0.011038661, -0.10670784) +transform = Transform3D(1, 2.4868996e-14, -6.217249e-15, 0, 1, -3.578774e-16, 0, -3.5787743e-16, 1, 6.077224e-09, 0.1160875, -0.13141868) shape = SubResource("SphereShape3D_3b5pk") [node name="AnimationPlayer" type="AnimationPlayer" parent="MapAction"] @@ -313,44 +744,75 @@ texture = ExtResource("4_bse8l") [node name="ExitAction" type="Area3D" parent="." node_paths=PackedStringArray("animation_player")] unique_name_in_owner = true -transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 0.35664433, 0, 0) +transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 1.9359307, -0.14775532, 1.3062965) script = ExtResource("6_22o3l") animation_player = NodePath("AnimationPlayer") -[node name="Sprite3D" type="Sprite3D" parent="ExitAction"] -transform = Transform3D(0.3899745, 0, -0.08899378, 0, 0.4, 0, 0.08899378, 0, 0.3899745, 1.22, -0.572, -1.003) -texture = ExtResource("5_oq6nq") - [node name="Sprite3D2" type="Sprite3D" parent="ExitAction"] -transform = Transform3D(0.38990447, 0, 0.089300044, 0, 0.4, 0, -0.089300044, 0, 0.38990447, -1.22, -0.572, -1.003) +transform = Transform3D(-3.934025e-08, 0, -0.9, 0, 0.9, 0, 0.9, 0, -3.934025e-08, 0, -0.09688908, 0) flip_h = true texture = ExtResource("5_oq6nq") -[node name="CollisionShape3D" type="CollisionShape3D" parent="ExitAction"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.1033944, -0.664206, -0.880886) -shape = SubResource("SphereShape3D_oq6nq") - [node name="CollisionShape3D2" type="CollisionShape3D" parent="ExitAction"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.103, -0.664, -0.881) -shape = SubResource("SphereShape3D_oq6nq") +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.25628877, 0, -5.9604645e-07) +shape = SubResource("CapsuleShape3D_eodxe") [node name="AnimationPlayer" type="AnimationPlayer" parent="ExitAction"] libraries = { &"": SubResource("AnimationLibrary_eodxe") } -[node name="Camera3D" type="Camera3D" parent="."] -transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 0.35664433, 0, 0) -fov = 92.8 -near = 0.003 -script = ExtResource("8_koamw") +[node name="CanvasLayer" type="CanvasLayer" parent="."] -[node name="ArriveAnimationPlayer" type="AnimationPlayer" parent="."] +[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme = ExtResource("10_j2e5k") + +[node name="Inventory" parent="CanvasLayer/MarginContainer" instance=ExtResource("11_eodxe")] +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 8 + +[node name="Pointer" type="TextureRect" parent="CanvasLayer"] +custom_minimum_size = Vector2(30, 30) +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -2.5 +offset_top = -2.5 +offset_right = 2.5 +offset_bottom = 2.5 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 +texture = ExtResource("11_6o275") +expand_mode = 1 + +[node name="Planet3d" parent="." instance=ExtResource("3_oq6nq")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -33.448, -83.679, 0) +radius = 80.0 +details = 112 +noise = SubResource("FastNoiseLite_i3c17") +height = 11.26 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="Planet3d"] +root_node = NodePath("../..") +libraries = { +&"": SubResource("AnimationLibrary_biiuk") +} + +[node name="StateAnimationPlayer" type="AnimationPlayer" parent="."] unique_name_in_owner = true libraries = { -&"": SubResource("AnimationLibrary_4qr0g") +&"": SubResource("AnimationLibrary_gspic") } -autoplay = "arrive" [connection signal="clicked" from="MapAction" to="." method="_on_map_action_clicked"] [connection signal="clicked" from="ExitAction" to="." method="_on_exit_action_clicked"] diff --git a/stages/cockpit/player_3d/player_3D.tscn b/stages/cockpit/player_3d/player_3D.tscn new file mode 100644 index 0000000..77bb5d7 --- /dev/null +++ b/stages/cockpit/player_3d/player_3D.tscn @@ -0,0 +1,20 @@ +[gd_scene load_steps=3 format=3 uid="uid://da7a74dg30q1l"] + +[ext_resource type="Script" uid="uid://3rrym6yv7xyp" path="res://stages/cockpit/player_3d/scripts/player_3d.gd" id="1_pvvbh"] + +[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_eodxe"] +radius = 0.46868896 +height = 1.7342377 + +[node name="Player3D" type="CharacterBody3D"] +transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 0, 0, 0) +script = ExtResource("1_pvvbh") + +[node name="Camera3D" type="Camera3D" parent="."] +unique_name_in_owner = true +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.19785136, 0) +near = 0.003 + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.253273, 0) +shape = SubResource("CapsuleShape3D_eodxe") diff --git a/stages/cockpit/player_3d/scripts/player_3d.gd b/stages/cockpit/player_3d/scripts/player_3d.gd new file mode 100644 index 0000000..35d2330 --- /dev/null +++ b/stages/cockpit/player_3d/scripts/player_3d.gd @@ -0,0 +1,71 @@ +extends CharacterBody3D + +const POINTER_TEXTURE = preload("res://common/icons/focus.svg") +const POINTER_ACTION_TEXTURE = preload("res://common/icons/hand-stop.svg") + +@export var pointer_texture_rect : TextureRect + +const SPEED = 2.0 +const MOUSE_SENSIVITY = 0.002 +const RAY_LENGTH = 10. + +var cockpit_action_hovered : CockpitAction = null +var query_mouse := false + +func _input(event): + if event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED: + rotate_y(-event.relative.x * MOUSE_SENSIVITY) + %Camera3D.rotate_x(-event.relative.y * MOUSE_SENSIVITY) + %Camera3D.rotation.x = clampf($Camera3D.rotation.x, -deg_to_rad(70), deg_to_rad(70)) + query_mouse = true + if event.is_action_pressed("action") and cockpit_action_hovered and cockpit_action_hovered: + cockpit_action_hovered.click() + + +func _physics_process(delta): + if query_mouse: + update_mouse_hovered_cockpit_actions() + if pointer_texture_rect : + pointer_texture_rect.texture = ( + POINTER_ACTION_TEXTURE if cockpit_action_hovered != null + else POINTER_TEXTURE + ) + query_mouse = false + + # Add the gravity. + if not is_on_floor(): + velocity += get_gravity() * delta + + # Get the input direction and handle the movement/deceleration. + # As good practice, you should replace UI actions with custom gameplay actions. + var input_dir = Input.get_vector("move_left", "move_right", "move_up", "move_down") + var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() + if direction: + velocity.x = direction.x * SPEED + velocity.z = direction.z * SPEED + else: + velocity.x = move_toward(velocity.x, 0, SPEED) + velocity.z = move_toward(velocity.z, 0, SPEED) + + move_and_slide() + +func update_mouse_hovered_cockpit_actions() -> void: + + var space_state = get_world_3d().direct_space_state + var middle_screen = get_viewport().get_visible_rect().size / 2 + var from = %Camera3D.project_ray_origin(middle_screen) + var to = from + %Camera3D.project_ray_normal(middle_screen) * RAY_LENGTH + + var query = PhysicsRayQueryParameters3D.create(from, to) + query.collide_with_areas = true + var result = space_state.intersect_ray(query) + + if result and result.collider and result.collider is CockpitAction and result.collider.pickable: + if cockpit_action_hovered and cockpit_action_hovered != result.collider: + cockpit_action_hovered._on_mouse_exited() + cockpit_action_hovered = result.collider + cockpit_action_hovered._on_mouse_entered() + else : + if cockpit_action_hovered: + cockpit_action_hovered._on_mouse_exited() + cockpit_action_hovered = null diff --git a/stages/cockpit/player_3d/scripts/player_3d.gd.uid b/stages/cockpit/player_3d/scripts/player_3d.gd.uid new file mode 100644 index 0000000..7f2378c --- /dev/null +++ b/stages/cockpit/player_3d/scripts/player_3d.gd.uid @@ -0,0 +1 @@ +uid://3rrym6yv7xyp diff --git a/stages/cockpit/resources/materials/metal.tres b/stages/cockpit/resources/materials/metal.tres index 6e03938..edd8cf9 100644 --- a/stages/cockpit/resources/materials/metal.tres +++ b/stages/cockpit/resources/materials/metal.tres @@ -3,3 +3,4 @@ [resource] transparency = 1 blend_mode = 1 +metallic_specular = 0.0 diff --git a/stages/cockpit/resources/materials/metal_dark.tres b/stages/cockpit/resources/materials/metal_dark.tres index a1349ab..25e0546 100644 --- a/stages/cockpit/resources/materials/metal_dark.tres +++ b/stages/cockpit/resources/materials/metal_dark.tres @@ -1,3 +1,4 @@ [gd_resource type="StandardMaterial3D" format=3 uid="uid://pwv7126nlcn2"] [resource] +metallic_specular = 0.0 diff --git a/stages/cockpit/resources/materials/screen.tres b/stages/cockpit/resources/materials/screen.tres index 23c2bb5..f0afa4e 100644 --- a/stages/cockpit/resources/materials/screen.tres +++ b/stages/cockpit/resources/materials/screen.tres @@ -4,4 +4,4 @@ albedo_color = Color(1, 0.7176471, 0.011764706, 1) emission_enabled = true emission = Color(1, 0.7176471, 0.011764706, 1) -emission_energy_multiplier = 0.8 +emission_energy_multiplier = 0.5 diff --git a/stages/cockpit/scripts/cockpit.gd b/stages/cockpit/scripts/cockpit.gd index 7bea34d..a4a476f 100644 --- a/stages/cockpit/scripts/cockpit.gd +++ b/stages/cockpit/scripts/cockpit.gd @@ -2,15 +2,35 @@ extends Node3D class_name Cockpit func _ready(): - if not GameInfo.game_data.get_current_planet_data(): + Input.mouse_mode = Input.MOUSE_MODE_CAPTURED + var region_data := GameInfo.game_data.current_region_data + + if not GameInfo.game_data.current_region_data: %ExitAction.hide() + %ExitAction.pickable = false + if region_data: + var state := region_data.get_state() + match state: + RegionData.State.IN_PROGRESS: + %StateAnimationPlayer.play("InProgress") + %MapAction.hide() + %MapAction.pickable = false + RegionData.State.FAILED: + %StateAnimationPlayer.play("Failed") + RegionData.State.SUCCEEDED: + %StateAnimationPlayer.play("Succeeded") + update_screen_info(region_data) func _on_map_action_clicked(): - SceneManager.change_scene(SceneManager.REGION_SELECTION_SCREEN) + SceneManager.change_scene("REGION_SELECTION") func _on_exit_action_clicked(): - if GameInfo.game_data.get_current_planet_data(): - %ArriveAnimationPlayer.play_backwards("arrive") - await %ArriveAnimationPlayer.animation_finished - SceneManager.change_scene(SceneManager.PLANET_SCENE) + if GameInfo.game_data.current_region_data: + SceneManager.change_scene("REGION") + +func update_screen_info(region_data : RegionData): + %RegionNameInfo.text = region_data.region_name + %DayNumberInfo.text = tr("DAY_%d") % region_data.day + %PlantNumberInfo.text = tr("%d_PLANTS") % len(region_data.score_by_plant) + %PlantPointInfo.text = tr("SCORE_%d") % region_data.get_score() diff --git a/stages/cockpit/scripts/cockpit_action.gd b/stages/cockpit/scripts/cockpit_action.gd index 89329de..67da01e 100644 --- a/stages/cockpit/scripts/cockpit_action.gd +++ b/stages/cockpit/scripts/cockpit_action.gd @@ -1,6 +1,8 @@ extends Area3D class_name CockpitAction +var pickable = true + signal clicked @export var animation_player : AnimationPlayer diff --git a/stages/cockpit/scripts/cockpit_camera.gd b/stages/cockpit/scripts/cockpit_camera.gd deleted file mode 100644 index 1bc5d86..0000000 --- a/stages/cockpit/scripts/cockpit_camera.gd +++ /dev/null @@ -1,39 +0,0 @@ -extends Camera3D - -const RAY_LENGTH = 1000. - -var cockpit_action_hovered : CockpitAction = null -var _mouse_event : InputEventMouse -var _query_mouse := false - -func _unhandled_input(event): - if event is InputEventMouse: - _mouse_event = event - _query_mouse = true - if event.is_action_pressed("action") and cockpit_action_hovered and cockpit_action_hovered: - cockpit_action_hovered.click() - -func _physics_process(_delta): - if _query_mouse: - update_mouse_hovered_cockpit_actions() - _query_mouse = false - -func update_mouse_hovered_cockpit_actions() -> void: - - var space_state = get_world_3d().direct_space_state - var from = project_ray_origin(_mouse_event.position) - var to = from + project_ray_normal(_mouse_event.position) * RAY_LENGTH - - var query = PhysicsRayQueryParameters3D.create(from, to) - query.collide_with_areas = true - var result = space_state.intersect_ray(query) - - if result.is_empty(): - if cockpit_action_hovered: - cockpit_action_hovered._on_mouse_exited() - cockpit_action_hovered = null - elif result.collider is CockpitAction: - if cockpit_action_hovered and cockpit_action_hovered != result.collider: - cockpit_action_hovered._on_mouse_exited() - cockpit_action_hovered = result.collider - cockpit_action_hovered._on_mouse_entered() diff --git a/stages/cockpit/scripts/cockpit_camera.gd.uid b/stages/cockpit/scripts/cockpit_camera.gd.uid deleted file mode 100644 index b62a480..0000000 --- a/stages/cockpit/scripts/cockpit_camera.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://jsxatpqfid88 diff --git a/stages/intro/intro.tscn b/stages/intro/intro.tscn index 70b2ed2..967fbde 100644 --- a/stages/intro/intro.tscn +++ b/stages/intro/intro.tscn @@ -1,7 +1,31 @@ -[gd_scene load_steps=2 format=3 uid="uid://d0n52psuns1vl"] +[gd_scene load_steps=3 format=3 uid="uid://d0n52psuns1vl"] [ext_resource type="Script" uid="uid://ddf3fktoer2ng" path="res://stages/intro/scripts/intro.gd" id="1_2nxbv"] +[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/hud.tres" id="2_851lr"] [node name="Intro" type="Node"] script = ExtResource("1_2nxbv") game_scene_path = "uid://d28cp7a21kwou" + +[node name="CanvasLayer" type="CanvasLayer" parent="."] +layer = 100 + +[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +theme = ExtResource("2_851lr") + +[node name="PassDialogButton" type="Button" parent="CanvasLayer/MarginContainer"] +unique_name_in_owner = true +modulate = Color(1, 1, 1, 0.23529412) +layout_mode = 2 +size_flags_horizontal = 8 +size_flags_vertical = 8 +theme = ExtResource("2_851lr") +theme_override_font_sizes/font_size = 20 +text = "PASS_THE_DIALOG" +flat = true diff --git a/stages/intro/scripts/intro.gd b/stages/intro/scripts/intro.gd index 4616e74..1d5ad1f 100644 --- a/stages/intro/scripts/intro.gd +++ b/stages/intro/scripts/intro.gd @@ -4,33 +4,35 @@ class_name Intro var steps : Array[IntroStep] @export_file var game_scene_path : String +var pass_asked := false +var tutorial_started := false + func _ready(): + %PassDialogButton.button_down.connect(_on_pass_dialog_button_pressed) + Dialogic.start('demeter_intro') - await Dialogic.timeline_ended + Dialogic.timeline_ended.connect(start_tutorial) - await LoadingScreen.show_loading_screen() +func start_tutorial(): + if not tutorial_started: + tutorial_started = true + Dialogic.end_timeline() + GameInfo.game_data.start_region( + RegionParameter.new( + 10, + 3, + "Tutorial", + true, + ) + ) - SceneManager.change_scene(SceneManager.REGION_SELECTION_SCREEN) + SceneManager.change_scene("REGION") -# for c in get_children(): -# if c is IntroStep: -# steps.append(c) -# c.hide() -# for i in range(len(steps)): -# steps[i].step_over.connect( -# func(): -# change_step(i+1) -# ) - -# change_step(0) - -# func change_step(nb): -# if nb >= len(steps): -# get_tree().change_scene_to_file(game_scene_path) -# for i in range(len(steps)): -# if i == nb: -# steps[i].show() -# else : -# steps[i].hide() \ No newline at end of file +func _on_pass_dialog_button_pressed(): + if not pass_asked: + pass_asked = true + %PassDialogButton.text = tr('ARE_YOU_SURE') + else: + start_tutorial() diff --git a/stages/region_selection/region_point/region_point.tscn b/stages/region_selection/region_point/region_point.tscn index 7a10326..56859f9 100644 --- a/stages/region_selection/region_point/region_point.tscn +++ b/stages/region_selection/region_point/region_point.tscn @@ -2,7 +2,7 @@ [ext_resource type="Script" uid="uid://j8cd0qbk4bma" path="res://stages/region_selection/region_point/scripts/region_point.gd" id="1_65ijn"] [ext_resource type="Script" uid="uid://b4eimt3v08jhc" path="res://common/game_data/scripts/run/run_point.gd" id="2_34ylp"] -[ext_resource type="Script" uid="uid://ddk7j5b8p51dk" path="res://stages/terrain/planet/scripts/planet_parameter.gd" id="3_dm7jk"] +[ext_resource type="Script" uid="uid://ddk7j5b8p51dk" path="res://stages/terrain/region/scripts/region_parameter.gd" id="3_dm7jk"] [ext_resource type="Texture2D" uid="uid://dqsx56wc73wry" path="res://common/icons/map-pin-check.svg" id="4_ndccb"] [sub_resource type="Resource" id="Resource_ndccb"] diff --git a/stages/region_selection/scripts/region_selection.gd b/stages/region_selection/scripts/region_selection.gd index 1a385c7..dafab20 100644 --- a/stages/region_selection/scripts/region_selection.gd +++ b/stages/region_selection/scripts/region_selection.gd @@ -15,15 +15,24 @@ var selected_run_point : RunPoint @export_tool_button("Update Region Points", "Callable") var update_action = update_region_points -@onready var run_data : RunData = GameInfo.game_data.current_run +var run_data : RunData @onready var planet_radius = %Planet3d.radius + %Planet3d.height func _ready(): + var region_data = GameInfo.game_data.current_region_data + if ( + not GameInfo.game_data.current_run + or (region_data and region_data.get_state() == RegionData.State.FAILED) + or GameInfo.game_data.current_run.get_state() == RunData.State.FINISHED + ): + GameInfo.game_data.start_run() + + run_data = GameInfo.game_data.current_run + %TravelValidation.hide() update_region_points() - %Planet3d.generate_noise(GameInfo.game_data.current_run.run_seed) - if not GameInfo.game_data.get_current_planet_data(): + if not GameInfo.game_data.current_region_data: %ReturnButton.hide() func _process(delta): @@ -98,17 +107,17 @@ func update_region_points(): func _on_camera_3d_region_point_clicked(rp : RunPoint): selected_run_point = rp - %TravelValidationLabel.text = tr("TRAVEL_TO_REGION_%s") % rp.region_name + %TravelValidationLabel.text = tr("TRAVEL_TO_REGION_%s") % rp.region_parameter.name %TravelValidation.show() func _on_travel_validation_go_button_button_down(): if selected_run_point: GameInfo.game_data.current_run.choose_next_run_point(selected_run_point) - SceneManager.change_scene(SceneManager.PLANET_SCENE) + SceneManager.change_scene("REGION") func _on_travel_validation_no_now_button_button_down(): %TravelValidation.hide() func _on_return_button_button_down(): - if GameInfo.game_data.get_current_planet_data(): - SceneManager.change_scene(SceneManager.COCKPIT_SCENE) + if GameInfo.game_data.current_region_data: + SceneManager.change_scene("COCKPIT") diff --git a/stages/terrain/planet/planet.tscn b/stages/terrain/planet/planet.tscn deleted file mode 100644 index 70f2351..0000000 --- a/stages/terrain/planet/planet.tscn +++ /dev/null @@ -1,44 +0,0 @@ -[gd_scene load_steps=9 format=3 uid="uid://tsi5j1uxppa4"] - -[ext_resource type="Script" uid="uid://d1mp5sguc0b6u" path="res://stages/terrain/planet/scripts/planet.gd" id="1_y7d8a"] -[ext_resource type="PackedScene" uid="uid://dt6mptqg80dew" path="res://gui/game/tutorial/tutorial.tscn" id="2_0wx6t"] -[ext_resource type="PackedScene" uid="uid://12nak7amd1uq" path="res://gui/game/game_gui.tscn" id="2_02xai"] -[ext_resource type="PackedScene" uid="uid://yk78ubpu5ghq" path="res://gui/game/pass_day/pass_day.tscn" id="3_0wx6t"] -[ext_resource type="PackedScene" uid="uid://dj7gp3crtg2yt" path="res://entities/camera/camera.tscn" id="3_6qoee"] -[ext_resource type="PackedScene" uid="uid://bgvbgeq46wee2" path="res://entities/player/player.tscn" id="4_hyapw"] -[ext_resource type="PackedScene" uid="uid://cg1visg52i21a" path="res://entities/interactables/truck/ladder/truck_ladder.tscn" id="5_yjoqs"] -[ext_resource type="PackedScene" uid="uid://d324mlmgls4fs" path="res://entities/interactables/truck/recharge/truck_recharge.tscn" id="6_0wx6t"] - -[node name="Planet" type="Node2D" node_paths=PackedStringArray("entity_container")] -script = ExtResource("1_y7d8a") -entity_container = NodePath("Entities") - -[node name="PlanetGui" type="CanvasLayer" parent="."] -layer = 2 - -[node name="Tutorial" parent="PlanetGui" node_paths=PackedStringArray("player", "planet") instance=ExtResource("2_0wx6t")] -player = NodePath("../../Entities/Player") -planet = NodePath("../..") - -[node name="PassDay" parent="PlanetGui" instance=ExtResource("3_0wx6t")] -unique_name_in_owner = true - -[node name="GameGui" parent="." instance=ExtResource("2_02xai")] - -[node name="Entities" type="Node2D" parent="."] -y_sort_enabled = true - -[node name="Player" parent="Entities" instance=ExtResource("4_hyapw")] - -[node name="TruckLadder" parent="Entities" instance=ExtResource("5_yjoqs")] -position = Vector2(71, -149) - -[node name="TruckRecharge" parent="Entities" instance=ExtResource("6_0wx6t")] -position = Vector2(-85, -165) - -[node name="Camera" parent="." node_paths=PackedStringArray("following") instance=ExtResource("3_6qoee")] -position = Vector2(573, 324) -following = NodePath("../Entities/Player") - -[connection signal="pass_day_ended" from="." to="GameGui" method="_on_planet_pass_day_ended"] -[connection signal="pass_day_started" from="." to="GameGui" method="_on_planet_pass_day_started"] diff --git a/stages/terrain/planet/scripts/garden.gd b/stages/terrain/planet/scripts/garden.gd deleted file mode 100644 index fc6869b..0000000 --- a/stages/terrain/planet/scripts/garden.gd +++ /dev/null @@ -1,60 +0,0 @@ -extends Node2D -class_name Garden - -var plants : Array[Plant] -var planet_data : PlanetData - -func _init(_planet_data : PlanetData, _initial_plants : Array[Plant] = []): - planet_data = _planet_data - plants = _initial_plants - # update_garden_score() - -func _ready(): - for p in plants: - p.harvested.connect(_on_plant_harvested) - p.state_changed.connect(_on_plant_state_changed) - -func get_score(): - var score = 0 - planet_data.score_by_plant.resize(len(plants)) - for i in range(len(plants)): - var plant_score = plants[i].calculate_plant_score() - score += plant_score - var old_score = 0 if planet_data.score_by_plant[i] == null else planet_data.score_by_plant[i] - if old_score < plant_score: - planet_data.plant_has_gained_score(plants[i], plant_score - old_score) - planet_data.score_by_plant[i] = plant_score - return score - -func plant( - type : PlantType, - plant_mutations : Array[PlantMutation] = [] -) -> Plant: - var new_plant = Plant.new( - type, - plant_mutations - ) - plants.append(new_plant) - planet_data.score_by_plant.append(0) - new_plant.harvested.connect(_on_plant_harvested) - new_plant.state_changed.connect(_on_plant_state_changed) - get_tree().create_timer(0.05).timeout.connect(update_garden_score) - return new_plant - -func _on_plant_state_changed(_p: Plant): - update_garden_score() - -func _on_plant_harvested(p: Plant): - remove_plant(p) - -func remove_plant(p: Plant): - var id = plants.find(p) - if id >= 0: - plants.remove_at(id) - planet_data.score_by_plant.remove_at(id) - - get_tree().create_timer(0.05).timeout.connect(update_garden_score) - - -func update_garden_score(): - planet_data.garden_score = get_score() diff --git a/stages/terrain/planet/scripts/garden.gd.uid b/stages/terrain/planet/scripts/garden.gd.uid deleted file mode 100644 index de5a0e4..0000000 --- a/stages/terrain/planet/scripts/garden.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dpgtjhjgfqquj diff --git a/stages/terrain/planet/scripts/planet_data.gd b/stages/terrain/planet/scripts/planet_data.gd deleted file mode 100644 index 5ee2fce..0000000 --- a/stages/terrain/planet/scripts/planet_data.gd +++ /dev/null @@ -1,62 +0,0 @@ -extends Resource -class_name PlanetData - -signal plant_gaining_score(p : Plant, amount : int) -signal updated(planet_data : PlanetData) - -const DEFAULT_START_CHARGE := 10 -const DEFAULT_OBJECTIVE := 10 - -@export var planet_seed : int -@export var garden_score : int = 0 : - set(v): - garden_score = v - updated.emit(self) -@export var day : int = 1 -@export var entities_saved_data : Array[EntityData] = [] -@export var score_by_plant : Array[int] = [] -@export var generated_chunk_entities : Array[Vector2i] -@export var tutorial_step : int = 0 - -@export var chunks_data : Dictionary[String, ChunkData] - -@export var charges : int -@export var objective : int - -func _init( - parameter : PlanetParameter = PlanetParameter.new() -): - charges = parameter.charges - objective = parameter.objective - planet_seed = parameter.planet_seed - -#region ------------------ Chunks ------------------ - -func get_coord_id(coord): - return "%d:%d" % [coord.x, coord.y] - -func has_chunk_data(coord : Vector2i) -> bool: - return chunks_data.has(get_coord_id(coord)) - -func add_chunk_data(coord : Vector2i, data : ChunkData): - chunks_data[get_coord_id(coord)] = data - -func get_chunk_data(coord : Vector2i) -> ChunkData: - return chunks_data[get_coord_id(coord)] - -func get_or_create_chunk_data(coord : Vector2i) -> ChunkData: - if has_chunk_data(coord): - return get_chunk_data(coord) - else: - var new_chunk_data = ChunkData.new(coord) - add_chunk_data(coord, new_chunk_data) - return new_chunk_data - -#endregion - -#region ------------------ Score ------------------ - -func plant_has_gained_score(plant : Plant, amount : int): - plant_gaining_score.emit(plant, amount) - -#endregion diff --git a/stages/terrain/planet/scripts/planet_parameter.gd b/stages/terrain/planet/scripts/planet_parameter.gd deleted file mode 100644 index f455505..0000000 --- a/stages/terrain/planet/scripts/planet_parameter.gd +++ /dev/null @@ -1,14 +0,0 @@ -extends Resource -class_name PlanetParameter - -@export var charges : int -@export var objective : int -@export var planet_seed : int - -func _init( - _charges : int = 10, - _objective : int = 10 -): - charges = _charges - objective = _objective - planet_seed = randi() \ No newline at end of file diff --git a/stages/terrain/planet/assets/sounds/alert.wav b/stages/terrain/region/assets/sounds/alert.wav similarity index 100% rename from stages/terrain/planet/assets/sounds/alert.wav rename to stages/terrain/region/assets/sounds/alert.wav diff --git a/stages/terrain/planet/assets/sounds/alert.wav.import b/stages/terrain/region/assets/sounds/alert.wav.import similarity index 54% rename from stages/terrain/planet/assets/sounds/alert.wav.import rename to stages/terrain/region/assets/sounds/alert.wav.import index b392738..036a13d 100644 --- a/stages/terrain/planet/assets/sounds/alert.wav.import +++ b/stages/terrain/region/assets/sounds/alert.wav.import @@ -3,12 +3,12 @@ importer="wav" type="AudioStreamWAV" uid="uid://cjspglv6gidd7" -path="res://.godot/imported/alert.wav-d5e63ab6c4571ed5f0d9340b9c046178.sample" +path="res://.godot/imported/alert.wav-d6f6d417dbab2ed86fb9c828e1764c61.sample" [deps] -source_file="res://stages/terrain/planet/assets/sounds/alert.wav" -dest_files=["res://.godot/imported/alert.wav-d5e63ab6c4571ed5f0d9340b9c046178.sample"] +source_file="res://stages/terrain/region/assets/sounds/alert.wav" +dest_files=["res://.godot/imported/alert.wav-d6f6d417dbab2ed86fb9c828e1764c61.sample"] [params] diff --git a/stages/terrain/planet/assets/sounds/quota_announcement.wav b/stages/terrain/region/assets/sounds/quota_announcement.wav similarity index 100% rename from stages/terrain/planet/assets/sounds/quota_announcement.wav rename to stages/terrain/region/assets/sounds/quota_announcement.wav diff --git a/stages/terrain/planet/assets/sounds/quota_announcement.wav.import b/stages/terrain/region/assets/sounds/quota_announcement.wav.import similarity index 53% rename from stages/terrain/planet/assets/sounds/quota_announcement.wav.import rename to stages/terrain/region/assets/sounds/quota_announcement.wav.import index 3c0c904..ed630c1 100644 --- a/stages/terrain/planet/assets/sounds/quota_announcement.wav.import +++ b/stages/terrain/region/assets/sounds/quota_announcement.wav.import @@ -3,12 +3,12 @@ importer="wav" type="AudioStreamWAV" uid="uid://c30s61i0j7l88" -path="res://.godot/imported/quota_announcement.wav-e296196858a1e87a106693abaaa5f6af.sample" +path="res://.godot/imported/quota_announcement.wav-b06177dc8ee27bb609c7b0a8b9812aa9.sample" [deps] -source_file="res://stages/terrain/planet/assets/sounds/quota_announcement.wav" -dest_files=["res://.godot/imported/quota_announcement.wav-e296196858a1e87a106693abaaa5f6af.sample"] +source_file="res://stages/terrain/region/assets/sounds/quota_announcement.wav" +dest_files=["res://.godot/imported/quota_announcement.wav-b06177dc8ee27bb609c7b0a8b9812aa9.sample"] [params] diff --git a/stages/terrain/planet/assets/textures/blue_rect.png b/stages/terrain/region/assets/textures/blue_rect.png similarity index 100% rename from stages/terrain/planet/assets/textures/blue_rect.png rename to stages/terrain/region/assets/textures/blue_rect.png diff --git a/stages/terrain/planet/assets/textures/blue_rect.png.import b/stages/terrain/region/assets/textures/blue_rect.png.import similarity index 75% rename from stages/terrain/planet/assets/textures/blue_rect.png.import rename to stages/terrain/region/assets/textures/blue_rect.png.import index 7baf2d6..3e29b79 100644 --- a/stages/terrain/planet/assets/textures/blue_rect.png.import +++ b/stages/terrain/region/assets/textures/blue_rect.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://cd62k5urdpw3i" -path="res://.godot/imported/blue_rect.png-d2bf0f89bd9a318145a3150338e6ed14.ctex" +path="res://.godot/imported/blue_rect.png-6eb6bcb621810ab61b6d3aead70129b2.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/blue_rect.png" -dest_files=["res://.godot/imported/blue_rect.png-d2bf0f89bd9a318145a3150338e6ed14.ctex"] +source_file="res://stages/terrain/region/assets/textures/blue_rect.png" +dest_files=["res://.godot/imported/blue_rect.png-6eb6bcb621810ab61b6d3aead70129b2.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/garden_background_texture.png b/stages/terrain/region/assets/textures/garden_background_texture.png similarity index 100% rename from stages/terrain/planet/assets/textures/garden_background_texture.png rename to stages/terrain/region/assets/textures/garden_background_texture.png diff --git a/stages/terrain/planet/assets/textures/garden_background_texture.png.import b/stages/terrain/region/assets/textures/garden_background_texture.png.import similarity index 80% rename from stages/terrain/planet/assets/textures/garden_background_texture.png.import rename to stages/terrain/region/assets/textures/garden_background_texture.png.import index d220212..f4dc615 100644 --- a/stages/terrain/planet/assets/textures/garden_background_texture.png.import +++ b/stages/terrain/region/assets/textures/garden_background_texture.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://bnrjnvceprxfn" -path="res://.godot/imported/garden_background_texture.png-15af9185e7f2afb324adf3e5bc16d734.ctex" +path="res://.godot/imported/garden_background_texture.png-002bbb09c02ebe4313ea8a293c00ef9e.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/garden_background_texture.png" -dest_files=["res://.godot/imported/garden_background_texture.png-15af9185e7f2afb324adf3e5bc16d734.ctex"] +source_file="res://stages/terrain/region/assets/textures/garden_background_texture.png" +dest_files=["res://.godot/imported/garden_background_texture.png-002bbb09c02ebe4313ea8a293c00ef9e.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/garden_background_texture.png~ b/stages/terrain/region/assets/textures/garden_background_texture.png~ similarity index 100% rename from stages/terrain/planet/assets/textures/garden_background_texture.png~ rename to stages/terrain/region/assets/textures/garden_background_texture.png~ diff --git a/stages/terrain/planet/assets/textures/garden_decontamined_background_texture.png b/stages/terrain/region/assets/textures/garden_decontamined_background_texture.png similarity index 100% rename from stages/terrain/planet/assets/textures/garden_decontamined_background_texture.png rename to stages/terrain/region/assets/textures/garden_decontamined_background_texture.png diff --git a/stages/terrain/planet/assets/textures/garden_decontamined_background_texture.png.import b/stages/terrain/region/assets/textures/garden_decontamined_background_texture.png.import similarity index 84% rename from stages/terrain/planet/assets/textures/garden_decontamined_background_texture.png.import rename to stages/terrain/region/assets/textures/garden_decontamined_background_texture.png.import index 16e3541..a7f73c9 100644 --- a/stages/terrain/planet/assets/textures/garden_decontamined_background_texture.png.import +++ b/stages/terrain/region/assets/textures/garden_decontamined_background_texture.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://bseoyd8mqjo7y" -path="res://.godot/imported/garden_decontamined_background_texture.png-059bd195ae2e24916e642e6f3275cffd.ctex" +path="res://.godot/imported/garden_decontamined_background_texture.png-d2e9b3111739dbe0f3e878510238390a.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/garden_decontamined_background_texture.png" -dest_files=["res://.godot/imported/garden_decontamined_background_texture.png-059bd195ae2e24916e642e6f3275cffd.ctex"] +source_file="res://stages/terrain/region/assets/textures/garden_decontamined_background_texture.png" +dest_files=["res://.godot/imported/garden_decontamined_background_texture.png-d2e9b3111739dbe0f3e878510238390a.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/garden_decontamined_background_texture_old.png b/stages/terrain/region/assets/textures/garden_decontamined_background_texture_old.png similarity index 100% rename from stages/terrain/planet/assets/textures/garden_decontamined_background_texture_old.png rename to stages/terrain/region/assets/textures/garden_decontamined_background_texture_old.png diff --git a/stages/terrain/planet/assets/textures/garden_decontamined_background_texture_old.png.import b/stages/terrain/region/assets/textures/garden_decontamined_background_texture_old.png.import similarity index 83% rename from stages/terrain/planet/assets/textures/garden_decontamined_background_texture_old.png.import rename to stages/terrain/region/assets/textures/garden_decontamined_background_texture_old.png.import index d048532..88835c6 100644 --- a/stages/terrain/planet/assets/textures/garden_decontamined_background_texture_old.png.import +++ b/stages/terrain/region/assets/textures/garden_decontamined_background_texture_old.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://ex35g5nvtsy0" -path="res://.godot/imported/garden_decontamined_background_texture_old.png-df017d633ed63644def49f2ef3a9d5b3.ctex" +path="res://.godot/imported/garden_decontamined_background_texture_old.png-951b3e125e8b7083a60c2b7435bce68a.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/garden_decontamined_background_texture_old.png" -dest_files=["res://.godot/imported/garden_decontamined_background_texture_old.png-df017d633ed63644def49f2ef3a9d5b3.ctex"] +source_file="res://stages/terrain/region/assets/textures/garden_decontamined_background_texture_old.png" +dest_files=["res://.godot/imported/garden_decontamined_background_texture_old.png-951b3e125e8b7083a60c2b7435bce68a.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/green_rect.png b/stages/terrain/region/assets/textures/green_rect.png similarity index 100% rename from stages/terrain/planet/assets/textures/green_rect.png rename to stages/terrain/region/assets/textures/green_rect.png diff --git a/stages/terrain/planet/assets/textures/green_rect.png.import b/stages/terrain/region/assets/textures/green_rect.png.import similarity index 75% rename from stages/terrain/planet/assets/textures/green_rect.png.import rename to stages/terrain/region/assets/textures/green_rect.png.import index 0a8f4f1..5e1f238 100644 --- a/stages/terrain/planet/assets/textures/green_rect.png.import +++ b/stages/terrain/region/assets/textures/green_rect.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://bvangyp301tsp" -path="res://.godot/imported/green_rect.png-2cde15567ae810adb5864776d70ef438.ctex" +path="res://.godot/imported/green_rect.png-5f705079cd8c03d8ad17266e7ce975db.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/green_rect.png" -dest_files=["res://.godot/imported/green_rect.png-2cde15567ae810adb5864776d70ef438.ctex"] +source_file="res://stages/terrain/region/assets/textures/green_rect.png" +dest_files=["res://.godot/imported/green_rect.png-5f705079cd8c03d8ad17266e7ce975db.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/green_tiles.png b/stages/terrain/region/assets/textures/green_tiles.png similarity index 100% rename from stages/terrain/planet/assets/textures/green_tiles.png rename to stages/terrain/region/assets/textures/green_tiles.png diff --git a/stages/terrain/planet/assets/textures/green_tiles.png.import b/stages/terrain/region/assets/textures/green_tiles.png.import similarity index 75% rename from stages/terrain/planet/assets/textures/green_tiles.png.import rename to stages/terrain/region/assets/textures/green_tiles.png.import index 2c4c1c0..651de73 100644 --- a/stages/terrain/planet/assets/textures/green_tiles.png.import +++ b/stages/terrain/region/assets/textures/green_tiles.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://yl4dg6gerykb" -path="res://.godot/imported/green_tiles.png-24cb2e8d3d77d0f127478dc375fc7791.ctex" +path="res://.godot/imported/green_tiles.png-8b5f7bc46b5efa30092dac78c9cc56fc.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/green_tiles.png" -dest_files=["res://.godot/imported/green_tiles.png-24cb2e8d3d77d0f127478dc375fc7791.ctex"] +source_file="res://stages/terrain/region/assets/textures/green_tiles.png" +dest_files=["res://.godot/imported/green_tiles.png-8b5f7bc46b5efa30092dac78c9cc56fc.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_red.png b/stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_red.png similarity index 100% rename from stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_red.png rename to stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_red.png diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_red.png.import b/stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_red.png.import similarity index 79% rename from stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_red.png.import rename to stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_red.png.import index 375d4f3..2d909b0 100644 --- a/stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_red.png.import +++ b/stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_red.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://o43d0p2ojbbh" -path="res://.godot/imported/moss_contamination_atlas_red.png-285da16354bb22d2c5b8102e267e7ff9.ctex" +path="res://.godot/imported/moss_contamination_atlas_red.png-70e6e889f4d027e7e5a753054fb81f78.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_red.png" -dest_files=["res://.godot/imported/moss_contamination_atlas_red.png-285da16354bb22d2c5b8102e267e7ff9.ctex"] +source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_red.png" +dest_files=["res://.godot/imported/moss_contamination_atlas_red.png-70e6e889f4d027e7e5a753054fb81f78.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture.png b/stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture.png similarity index 100% rename from stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture.png rename to stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture.png diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture.png.import b/stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture.png.import similarity index 85% rename from stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture.png.import rename to stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture.png.import index bc171f5..5178c4d 100644 --- a/stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture.png.import +++ b/stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://dr72xhc07i56e" -path="res://.godot/imported/moss_contamination_atlas_texture.png-315849d799f890ff8a71f9ec9fcd4776.ctex" +path="res://.godot/imported/moss_contamination_atlas_texture.png-80aa9a19eb65e2c40b783557f4f8a743.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture.png" -dest_files=["res://.godot/imported/moss_contamination_atlas_texture.png-315849d799f890ff8a71f9ec9fcd4776.ctex"] +source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture.png" +dest_files=["res://.godot/imported/moss_contamination_atlas_texture.png-80aa9a19eb65e2c40b783557f4f8a743.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture_2.png b/stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture_2.png similarity index 100% rename from stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture_2.png rename to stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture_2.png diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture_2.png.import b/stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture_2.png.import similarity index 85% rename from stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture_2.png.import rename to stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture_2.png.import index 06d12ea..bc5ccf3 100644 --- a/stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture_2.png.import +++ b/stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture_2.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://cquonnydto387" -path="res://.godot/imported/moss_contamination_atlas_texture_2.png-273150e06680f719d234dbf50850407d.ctex" +path="res://.godot/imported/moss_contamination_atlas_texture_2.png-d3b17c123dfe73058f82ef745ed7ae76.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture_2.png" -dest_files=["res://.godot/imported/moss_contamination_atlas_texture_2.png-273150e06680f719d234dbf50850407d.ctex"] +source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture_2.png" +dest_files=["res://.godot/imported/moss_contamination_atlas_texture_2.png-d3b17c123dfe73058f82ef745ed7ae76.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_element_1.png b/stages/terrain/region/assets/textures/moss_biome/moss_element_1.png similarity index 100% rename from stages/terrain/planet/assets/textures/moss_biome/moss_element_1.png rename to stages/terrain/region/assets/textures/moss_biome/moss_element_1.png diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_element_1.png.import b/stages/terrain/region/assets/textures/moss_biome/moss_element_1.png.import similarity index 75% rename from stages/terrain/planet/assets/textures/moss_biome/moss_element_1.png.import rename to stages/terrain/region/assets/textures/moss_biome/moss_element_1.png.import index 2777975..5b7701d 100644 --- a/stages/terrain/planet/assets/textures/moss_biome/moss_element_1.png.import +++ b/stages/terrain/region/assets/textures/moss_biome/moss_element_1.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://c07hqxv7mybw7" -path="res://.godot/imported/moss_element_1.png-a6f9a32694a449c52289ffe35904adcc.ctex" +path="res://.godot/imported/moss_element_1.png-5689c80beabd4d37765ecc4aa128cd18.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_element_1.png" -dest_files=["res://.godot/imported/moss_element_1.png-a6f9a32694a449c52289ffe35904adcc.ctex"] +source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_element_1.png" +dest_files=["res://.godot/imported/moss_element_1.png-5689c80beabd4d37765ecc4aa128cd18.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_element_2.png b/stages/terrain/region/assets/textures/moss_biome/moss_element_2.png similarity index 100% rename from stages/terrain/planet/assets/textures/moss_biome/moss_element_2.png rename to stages/terrain/region/assets/textures/moss_biome/moss_element_2.png diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_element_2.png.import b/stages/terrain/region/assets/textures/moss_biome/moss_element_2.png.import similarity index 75% rename from stages/terrain/planet/assets/textures/moss_biome/moss_element_2.png.import rename to stages/terrain/region/assets/textures/moss_biome/moss_element_2.png.import index 7a83e41..f4c3230 100644 --- a/stages/terrain/planet/assets/textures/moss_biome/moss_element_2.png.import +++ b/stages/terrain/region/assets/textures/moss_biome/moss_element_2.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://x68ggxb8jbid" -path="res://.godot/imported/moss_element_2.png-5cbf59b34a70d33c02f41b72eab35dd5.ctex" +path="res://.godot/imported/moss_element_2.png-0612506a49d7e87c3d31a8a0d4bbe052.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_element_2.png" -dest_files=["res://.godot/imported/moss_element_2.png-5cbf59b34a70d33c02f41b72eab35dd5.ctex"] +source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_element_2.png" +dest_files=["res://.godot/imported/moss_element_2.png-0612506a49d7e87c3d31a8a0d4bbe052.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_element_3.png b/stages/terrain/region/assets/textures/moss_biome/moss_element_3.png similarity index 100% rename from stages/terrain/planet/assets/textures/moss_biome/moss_element_3.png rename to stages/terrain/region/assets/textures/moss_biome/moss_element_3.png diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_element_3.png.import b/stages/terrain/region/assets/textures/moss_biome/moss_element_3.png.import similarity index 75% rename from stages/terrain/planet/assets/textures/moss_biome/moss_element_3.png.import rename to stages/terrain/region/assets/textures/moss_biome/moss_element_3.png.import index 5fa8806..1f12e17 100644 --- a/stages/terrain/planet/assets/textures/moss_biome/moss_element_3.png.import +++ b/stages/terrain/region/assets/textures/moss_biome/moss_element_3.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://cb1k4g8fcsuke" -path="res://.godot/imported/moss_element_3.png-c6f84b36571c3be4bea3a4fbc54917b2.ctex" +path="res://.godot/imported/moss_element_3.png-590cfa4dea5af9388a3be231b1eb9e69.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_element_3.png" -dest_files=["res://.godot/imported/moss_element_3.png-c6f84b36571c3be4bea3a4fbc54917b2.ctex"] +source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_element_3.png" +dest_files=["res://.godot/imported/moss_element_3.png-590cfa4dea5af9388a3be231b1eb9e69.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_ground_texture.png b/stages/terrain/region/assets/textures/moss_biome/moss_ground_texture.png similarity index 100% rename from stages/terrain/planet/assets/textures/moss_biome/moss_ground_texture.png rename to stages/terrain/region/assets/textures/moss_biome/moss_ground_texture.png diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_ground_texture.png.import b/stages/terrain/region/assets/textures/moss_biome/moss_ground_texture.png.import similarity index 74% rename from stages/terrain/planet/assets/textures/moss_biome/moss_ground_texture.png.import rename to stages/terrain/region/assets/textures/moss_biome/moss_ground_texture.png.import index 419ad49..e7f39b5 100644 --- a/stages/terrain/planet/assets/textures/moss_biome/moss_ground_texture.png.import +++ b/stages/terrain/region/assets/textures/moss_biome/moss_ground_texture.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://dsa7wbwjiebnw" -path="res://.godot/imported/moss_ground_texture.png-c04fbb538eff33b5a200a959b09aefb5.ctex" +path="res://.godot/imported/moss_ground_texture.png-db5ac5662696a68d00ce73febb556cc3.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_ground_texture.png" -dest_files=["res://.godot/imported/moss_ground_texture.png-c04fbb538eff33b5a200a959b09aefb5.ctex"] +source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_ground_texture.png" +dest_files=["res://.godot/imported/moss_ground_texture.png-db5ac5662696a68d00ce73febb556cc3.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_rock_atlas_texture.png b/stages/terrain/region/assets/textures/moss_biome/moss_rock_atlas_texture.png similarity index 100% rename from stages/terrain/planet/assets/textures/moss_biome/moss_rock_atlas_texture.png rename to stages/terrain/region/assets/textures/moss_biome/moss_rock_atlas_texture.png diff --git a/stages/terrain/planet/assets/textures/moss_biome/moss_rock_atlas_texture.png.import b/stages/terrain/region/assets/textures/moss_biome/moss_rock_atlas_texture.png.import similarity index 74% rename from stages/terrain/planet/assets/textures/moss_biome/moss_rock_atlas_texture.png.import rename to stages/terrain/region/assets/textures/moss_biome/moss_rock_atlas_texture.png.import index 43f8d95..fb6416c 100644 --- a/stages/terrain/planet/assets/textures/moss_biome/moss_rock_atlas_texture.png.import +++ b/stages/terrain/region/assets/textures/moss_biome/moss_rock_atlas_texture.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://ch4rydip0nlt6" -path="res://.godot/imported/moss_rock_atlas_texture.png-9e39fbed50de2857d6c90ff91f86917a.ctex" +path="res://.godot/imported/moss_rock_atlas_texture.png-42db73700a39c396acd665f1acf7a968.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/moss_biome/moss_rock_atlas_texture.png" -dest_files=["res://.godot/imported/moss_rock_atlas_texture.png-9e39fbed50de2857d6c90ff91f86917a.ctex"] +source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_rock_atlas_texture.png" +dest_files=["res://.godot/imported/moss_rock_atlas_texture.png-42db73700a39c396acd665f1acf7a968.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/red_rect.png b/stages/terrain/region/assets/textures/red_rect.png similarity index 100% rename from stages/terrain/planet/assets/textures/red_rect.png rename to stages/terrain/region/assets/textures/red_rect.png diff --git a/stages/terrain/planet/assets/textures/red_rect.png.import b/stages/terrain/region/assets/textures/red_rect.png.import similarity index 75% rename from stages/terrain/planet/assets/textures/red_rect.png.import rename to stages/terrain/region/assets/textures/red_rect.png.import index 84486f5..dfbdb23 100644 --- a/stages/terrain/planet/assets/textures/red_rect.png.import +++ b/stages/terrain/region/assets/textures/red_rect.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://bi08trir23od2" -path="res://.godot/imported/red_rect.png-2c97ffc5003cb92590914f11ff4ed41d.ctex" +path="res://.godot/imported/red_rect.png-37a9e533ba7e4668f9eb8a241791dccb.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/red_rect.png" -dest_files=["res://.godot/imported/red_rect.png-2c97ffc5003cb92590914f11ff4ed41d.ctex"] +source_file="res://stages/terrain/region/assets/textures/red_rect.png" +dest_files=["res://.godot/imported/red_rect.png-37a9e533ba7e4668f9eb8a241791dccb.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/red_tiles.png b/stages/terrain/region/assets/textures/red_tiles.png similarity index 100% rename from stages/terrain/planet/assets/textures/red_tiles.png rename to stages/terrain/region/assets/textures/red_tiles.png diff --git a/stages/terrain/planet/assets/textures/red_tiles.png.import b/stages/terrain/region/assets/textures/red_tiles.png.import similarity index 75% rename from stages/terrain/planet/assets/textures/red_tiles.png.import rename to stages/terrain/region/assets/textures/red_tiles.png.import index c67c3f0..421a8a6 100644 --- a/stages/terrain/planet/assets/textures/red_tiles.png.import +++ b/stages/terrain/region/assets/textures/red_tiles.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://ddecvei4l62gn" -path="res://.godot/imported/red_tiles.png-0bb5056d42a3159163beb701fb8aa247.ctex" +path="res://.godot/imported/red_tiles.png-a93183162dddbf2e40094e4a73dd9c29.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/red_tiles.png" -dest_files=["res://.godot/imported/red_tiles.png-0bb5056d42a3159163beb701fb8aa247.ctex"] +source_file="res://stages/terrain/region/assets/textures/red_tiles.png" +dest_files=["res://.godot/imported/red_tiles.png-a93183162dddbf2e40094e4a73dd9c29.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/rock_background_texture.png b/stages/terrain/region/assets/textures/rock_background_texture.png similarity index 100% rename from stages/terrain/planet/assets/textures/rock_background_texture.png rename to stages/terrain/region/assets/textures/rock_background_texture.png diff --git a/stages/terrain/planet/assets/textures/rock_background_texture.png.import b/stages/terrain/region/assets/textures/rock_background_texture.png.import similarity index 80% rename from stages/terrain/planet/assets/textures/rock_background_texture.png.import rename to stages/terrain/region/assets/textures/rock_background_texture.png.import index 4541037..4f0519f 100644 --- a/stages/terrain/planet/assets/textures/rock_background_texture.png.import +++ b/stages/terrain/region/assets/textures/rock_background_texture.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://beqx4rmgthkql" -path="res://.godot/imported/rock_background_texture.png-7bbae13b0384e1483bd66633981b566b.ctex" +path="res://.godot/imported/rock_background_texture.png-79a8569ff49f7d85f8b64d55ac1ce62d.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/rock_background_texture.png" -dest_files=["res://.godot/imported/rock_background_texture.png-7bbae13b0384e1483bd66633981b566b.ctex"] +source_file="res://stages/terrain/region/assets/textures/rock_background_texture.png" +dest_files=["res://.godot/imported/rock_background_texture.png-79a8569ff49f7d85f8b64d55ac1ce62d.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/rock_background_texture.png~ b/stages/terrain/region/assets/textures/rock_background_texture.png~ similarity index 100% rename from stages/terrain/planet/assets/textures/rock_background_texture.png~ rename to stages/terrain/region/assets/textures/rock_background_texture.png~ diff --git a/stages/terrain/planet/assets/textures/rock_cristal_texture.png b/stages/terrain/region/assets/textures/rock_cristal_texture.png similarity index 100% rename from stages/terrain/planet/assets/textures/rock_cristal_texture.png rename to stages/terrain/region/assets/textures/rock_cristal_texture.png diff --git a/stages/terrain/planet/assets/textures/rock_cristal_texture.png.import b/stages/terrain/region/assets/textures/rock_cristal_texture.png.import similarity index 74% rename from stages/terrain/planet/assets/textures/rock_cristal_texture.png.import rename to stages/terrain/region/assets/textures/rock_cristal_texture.png.import index 1289aa3..2ece088 100644 --- a/stages/terrain/planet/assets/textures/rock_cristal_texture.png.import +++ b/stages/terrain/region/assets/textures/rock_cristal_texture.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://02nuoqleo4yu" -path="res://.godot/imported/rock_cristal_texture.png-33ee9694873f9aa2e8604c502b12dee5.ctex" +path="res://.godot/imported/rock_cristal_texture.png-c34612644dbfa24e49296bfe43df46c6.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/rock_cristal_texture.png" -dest_files=["res://.godot/imported/rock_cristal_texture.png-33ee9694873f9aa2e8604c502b12dee5.ctex"] +source_file="res://stages/terrain/region/assets/textures/rock_cristal_texture.png" +dest_files=["res://.godot/imported/rock_cristal_texture.png-c34612644dbfa24e49296bfe43df46c6.ctex"] [params] diff --git a/stages/terrain/planet/assets/textures/round_red_tiles.png b/stages/terrain/region/assets/textures/round_red_tiles.png similarity index 100% rename from stages/terrain/planet/assets/textures/round_red_tiles.png rename to stages/terrain/region/assets/textures/round_red_tiles.png diff --git a/stages/terrain/planet/assets/textures/round_red_tiles.png.import b/stages/terrain/region/assets/textures/round_red_tiles.png.import similarity index 75% rename from stages/terrain/planet/assets/textures/round_red_tiles.png.import rename to stages/terrain/region/assets/textures/round_red_tiles.png.import index cd33a85..0f0bf2f 100644 --- a/stages/terrain/planet/assets/textures/round_red_tiles.png.import +++ b/stages/terrain/region/assets/textures/round_red_tiles.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://bmdb63witojeg" -path="res://.godot/imported/round_red_tiles.png-7f838ac911f20be784ac93821bd5d5ba.ctex" +path="res://.godot/imported/round_red_tiles.png-c254569faa1f0323275dcc266f2b4c86.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://stages/terrain/planet/assets/textures/round_red_tiles.png" -dest_files=["res://.godot/imported/round_red_tiles.png-7f838ac911f20be784ac93821bd5d5ba.ctex"] +source_file="res://stages/terrain/region/assets/textures/round_red_tiles.png" +dest_files=["res://.godot/imported/round_red_tiles.png-c254569faa1f0323275dcc266f2b4c86.ctex"] [params] diff --git a/stages/terrain/planet/moss_biome.tscn b/stages/terrain/region/moss_biome.tscn similarity index 77% rename from stages/terrain/planet/moss_biome.tscn rename to stages/terrain/region/moss_biome.tscn index 8fd443e..be88a19 100644 --- a/stages/terrain/planet/moss_biome.tscn +++ b/stages/terrain/region/moss_biome.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3 uid="uid://bnwq0xl7ak661"] -[ext_resource type="Script" uid="uid://d1mp5sguc0b6u" path="res://stages/terrain/planet/scripts/planet.gd" id="1_ne67o"] +[ext_resource type="Script" uid="uid://d1mp5sguc0b6u" path="res://stages/terrain/region/scripts/region.gd" id="1_ne67o"] [node name="Planet" type="Node2D"] script = ExtResource("1_ne67o") diff --git a/stages/terrain/region/region.tscn b/stages/terrain/region/region.tscn new file mode 100644 index 0000000..bf755e3 --- /dev/null +++ b/stages/terrain/region/region.tscn @@ -0,0 +1,43 @@ +[gd_scene load_steps=9 format=3 uid="uid://tsi5j1uxppa4"] + +[ext_resource type="Script" uid="uid://d1mp5sguc0b6u" path="res://stages/terrain/region/scripts/region.gd" id="1_441sk"] +[ext_resource type="PackedScene" uid="uid://dt6mptqg80dew" path="res://gui/game/tutorial/tutorial.tscn" id="2_2f6js"] +[ext_resource type="PackedScene" uid="uid://yk78ubpu5ghq" path="res://gui/game/pass_day/pass_day.tscn" id="3_ktnx3"] +[ext_resource type="PackedScene" uid="uid://12nak7amd1uq" path="res://gui/game/game_gui.tscn" id="4_qdnee"] +[ext_resource type="PackedScene" uid="uid://bgvbgeq46wee2" path="res://entities/player/player.tscn" id="5_ovqi1"] +[ext_resource type="PackedScene" uid="uid://cg1visg52i21a" path="res://entities/interactables/ladder/ladder.tscn" id="6_2w03p"] +[ext_resource type="PackedScene" uid="uid://d324mlmgls4fs" path="res://entities/interactables/truck/recharge/truck_recharge.tscn" id="7_6d8m3"] +[ext_resource type="PackedScene" uid="uid://dj7gp3crtg2yt" path="res://entities/camera/camera.tscn" id="8_fwgig"] + +[node name="Region" type="Node2D" node_paths=PackedStringArray("entity_container")] +script = ExtResource("1_441sk") +first_loot_number = null +loot_item_number = null +entity_container = NodePath("Entities") + +[node name="RegionGui" type="CanvasLayer" parent="."] +layer = 2 + +[node name="Tutorial" parent="RegionGui" node_paths=PackedStringArray("player", "region") instance=ExtResource("2_2f6js")] +player = NodePath("../../Entities/Player") +region = NodePath("../..") + +[node name="PassDay" parent="RegionGui" instance=ExtResource("3_ktnx3")] +unique_name_in_owner = true + +[node name="GameGui" parent="." instance=ExtResource("4_qdnee")] + +[node name="Entities" type="Node2D" parent="."] +y_sort_enabled = true + +[node name="TruckLadder" parent="Entities" instance=ExtResource("6_2w03p")] +position = Vector2(51, -112) + +[node name="Player" parent="Entities" instance=ExtResource("5_ovqi1")] +z_index = 1 + +[node name="TruckRecharge" parent="Entities" instance=ExtResource("7_6d8m3")] +position = Vector2(-50, -124) + +[node name="Camera" parent="." node_paths=PackedStringArray("following") instance=ExtResource("8_fwgig")] +following = NodePath("../Entities/Player") diff --git a/stages/terrain/planet/resources/materials/contamination_planet_tilemap.tres b/stages/terrain/region/resources/materials/contamination_planet_tilemap.tres similarity index 87% rename from stages/terrain/planet/resources/materials/contamination_planet_tilemap.tres rename to stages/terrain/region/resources/materials/contamination_planet_tilemap.tres index 81cd832..bf79b4e 100644 --- a/stages/terrain/planet/resources/materials/contamination_planet_tilemap.tres +++ b/stages/terrain/region/resources/materials/contamination_planet_tilemap.tres @@ -1,7 +1,7 @@ [gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://b3vnia5tb6pil"] [ext_resource type="Shader" uid="uid://q5isn3rwrir8" path="res://common/vfx/materials/shaders/texture_color_filter.gdshader" id="1_4m73r"] -[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/planet/assets/textures/garden_background_texture.png" id="2_4m73r"] +[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/region/assets/textures/garden_background_texture.png" id="2_4m73r"] [resource] shader = ExtResource("1_4m73r") diff --git a/stages/terrain/planet/resources/materials/decontamination_planet_tilemap.tres b/stages/terrain/region/resources/materials/decontamination_planet_tilemap.tres similarity index 87% rename from stages/terrain/planet/resources/materials/decontamination_planet_tilemap.tres rename to stages/terrain/region/resources/materials/decontamination_planet_tilemap.tres index 53ec195..5324dfd 100644 --- a/stages/terrain/planet/resources/materials/decontamination_planet_tilemap.tres +++ b/stages/terrain/region/resources/materials/decontamination_planet_tilemap.tres @@ -1,7 +1,7 @@ [gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://85ap1buim1ha"] [ext_resource type="Shader" uid="uid://q5isn3rwrir8" path="res://common/vfx/materials/shaders/texture_color_filter.gdshader" id="1_v8wor"] -[ext_resource type="Texture2D" uid="uid://bseoyd8mqjo7y" path="res://stages/terrain/planet/assets/textures/garden_decontamined_background_texture.png" id="2_v8wor"] +[ext_resource type="Texture2D" uid="uid://bseoyd8mqjo7y" path="res://stages/terrain/region/assets/textures/garden_decontamined_background_texture.png" id="2_v8wor"] [resource] shader = ExtResource("1_v8wor") diff --git a/stages/terrain/planet/resources/materials/default_chunk_material.tres b/stages/terrain/region/resources/materials/default_chunk_material.tres similarity index 88% rename from stages/terrain/planet/resources/materials/default_chunk_material.tres rename to stages/terrain/region/resources/materials/default_chunk_material.tres index 8160c70..750bb86 100644 --- a/stages/terrain/planet/resources/materials/default_chunk_material.tres +++ b/stages/terrain/region/resources/materials/default_chunk_material.tres @@ -1,8 +1,8 @@ [gd_resource type="ShaderMaterial" load_steps=6 format=3 uid="uid://bq3dmwkej5gmx"] [ext_resource type="Shader" uid="uid://bglep64ppn74p" path="res://common/vfx/materials/shaders/textures_data_filter.gdshader" id="1_kujx0"] -[ext_resource type="Texture2D" uid="uid://beqx4rmgthkql" path="res://stages/terrain/planet/assets/textures/rock_background_texture.png" id="2_6cs2h"] -[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/planet/assets/textures/garden_background_texture.png" id="2_ydx6d"] +[ext_resource type="Texture2D" uid="uid://beqx4rmgthkql" path="res://stages/terrain/region/assets/textures/rock_background_texture.png" id="2_6cs2h"] +[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/region/assets/textures/garden_background_texture.png" id="2_ydx6d"] [sub_resource type="FastNoiseLite" id="FastNoiseLite_kujx0"] noise_type = 0 diff --git a/stages/terrain/planet/resources/materials/ground_contamination.tres b/stages/terrain/region/resources/materials/ground_contamination.tres similarity index 78% rename from stages/terrain/planet/resources/materials/ground_contamination.tres rename to stages/terrain/region/resources/materials/ground_contamination.tres index 7c747e0..3678f50 100644 --- a/stages/terrain/planet/resources/materials/ground_contamination.tres +++ b/stages/terrain/region/resources/materials/ground_contamination.tres @@ -1,8 +1,8 @@ [gd_resource type="ShaderMaterial" load_steps=6 format=3 uid="uid://ljvaj1vab53a"] [ext_resource type="Shader" uid="uid://bglep64ppn74p" path="res://common/vfx/materials/shaders/textures_data_filter.gdshader" id="1_ye8oh"] -[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/planet/assets/textures/garden_background_texture.png" id="2_6hswu"] -[ext_resource type="Texture2D" uid="uid://c3t26nlbnkxg7" path="res://stages/terrain/planet/assets/textures/garden_decontamined_background_texture_old.png" id="2_r7pv0"] +[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/region/assets/textures/garden_background_texture.png" id="2_6hswu"] +[ext_resource type="Texture2D" uid="uid://ex35g5nvtsy0" path="res://stages/terrain/region/assets/textures/garden_decontamined_background_texture_old.png" id="2_r7pv0"] [sub_resource type="FastNoiseLite" id="FastNoiseLite_6hswu"] frequency = 0.0109 diff --git a/stages/terrain/planet/resources/materials/moss_biome/ground_planet_tilemap.tres b/stages/terrain/region/resources/materials/moss_biome/ground_planet_tilemap.tres similarity index 87% rename from stages/terrain/planet/resources/materials/moss_biome/ground_planet_tilemap.tres rename to stages/terrain/region/resources/materials/moss_biome/ground_planet_tilemap.tres index b2d3eaf..37729c4 100644 --- a/stages/terrain/planet/resources/materials/moss_biome/ground_planet_tilemap.tres +++ b/stages/terrain/region/resources/materials/moss_biome/ground_planet_tilemap.tres @@ -1,7 +1,7 @@ [gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://dpxu8yeee4qi1"] [ext_resource type="Shader" uid="uid://q5isn3rwrir8" path="res://common/vfx/materials/shaders/texture_color_filter.gdshader" id="1_k4e5t"] -[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/planet/assets/textures/garden_background_texture.png" id="2_k4e5t"] +[ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/region/assets/textures/garden_background_texture.png" id="2_k4e5t"] [resource] shader = ExtResource("1_k4e5t") diff --git a/stages/terrain/planet/resources/materials/rock_planet_tilemap.tres b/stages/terrain/region/resources/materials/rock_planet_tilemap.tres similarity index 82% rename from stages/terrain/planet/resources/materials/rock_planet_tilemap.tres rename to stages/terrain/region/resources/materials/rock_planet_tilemap.tres index ce8a0ab..df304df 100644 --- a/stages/terrain/planet/resources/materials/rock_planet_tilemap.tres +++ b/stages/terrain/region/resources/materials/rock_planet_tilemap.tres @@ -1,8 +1,8 @@ [gd_resource type="ShaderMaterial" load_steps=4 format=3 uid="uid://d365ovfmi3d0s"] [ext_resource type="Shader" uid="uid://q5isn3rwrir8" path="res://common/vfx/materials/shaders/texture_color_filter.gdshader" id="1_xr5ia"] -[ext_resource type="Texture2D" uid="uid://beqx4rmgthkql" path="res://stages/terrain/planet/assets/textures/rock_background_texture.png" id="2_ieaec"] -[ext_resource type="Texture2D" uid="uid://02nuoqleo4yu" path="res://stages/terrain/planet/assets/textures/rock_cristal_texture.png" id="2_sc014"] +[ext_resource type="Texture2D" uid="uid://beqx4rmgthkql" path="res://stages/terrain/region/assets/textures/rock_background_texture.png" id="2_ieaec"] +[ext_resource type="Texture2D" uid="uid://02nuoqleo4yu" path="res://stages/terrain/region/assets/textures/rock_cristal_texture.png" id="2_sc014"] [resource] shader = ExtResource("1_xr5ia") diff --git a/stages/terrain/planet/resources/moss_biome.tres b/stages/terrain/region/resources/moss_biome.tres similarity index 99% rename from stages/terrain/planet/resources/moss_biome.tres rename to stages/terrain/region/resources/moss_biome.tres index c397c65..1911385 100644 --- a/stages/terrain/planet/resources/moss_biome.tres +++ b/stages/terrain/region/resources/moss_biome.tres @@ -1,9 +1,9 @@ [gd_resource type="TileSet" load_steps=9 format=3 uid="uid://bqo32vh5etspf"] -[ext_resource type="Texture2D" uid="uid://ch4rydip0nlt6" path="res://stages/terrain/planet/assets/textures/moss_biome/moss_rock_atlas_texture.png" id="1_spfgy"] -[ext_resource type="Texture2D" uid="uid://dr72xhc07i56e" path="res://stages/terrain/planet/assets/textures/moss_biome/moss_contamination_atlas_texture.png" id="1_uqnql"] -[ext_resource type="Texture2D" uid="uid://yl4dg6gerykb" path="res://stages/terrain/planet/assets/textures/green_tiles.png" id="2_04qcq"] -[ext_resource type="Texture2D" uid="uid://bi08trir23od2" path="res://stages/terrain/planet/assets/textures/red_rect.png" id="4_spfgy"] +[ext_resource type="Texture2D" uid="uid://ch4rydip0nlt6" path="res://stages/terrain/region/assets/textures/moss_biome/moss_rock_atlas_texture.png" id="1_spfgy"] +[ext_resource type="Texture2D" uid="uid://dr72xhc07i56e" path="res://stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture.png" id="1_uqnql"] +[ext_resource type="Texture2D" uid="uid://yl4dg6gerykb" path="res://stages/terrain/region/assets/textures/green_tiles.png" id="2_04qcq"] +[ext_resource type="Texture2D" uid="uid://bi08trir23od2" path="res://stages/terrain/region/assets/textures/red_rect.png" id="4_spfgy"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_4i8c6"] resource_name = "Rock" diff --git a/stages/terrain/planet/scripts/chunk.gd b/stages/terrain/region/scripts/chunk.gd similarity index 67% rename from stages/terrain/planet/scripts/chunk.gd rename to stages/terrain/region/scripts/chunk.gd index c183d61..6c64d0a 100644 --- a/stages/terrain/planet/scripts/chunk.gd +++ b/stages/terrain/region/scripts/chunk.gd @@ -4,8 +4,8 @@ class_name Chunk signal generated -var planet : Planet -var planet_seed : int +var region : Region +var region_seed : int var wall_threshold = 0.3 var decontamination_threshold = 0. var cristal_threshold = 0.08 @@ -27,24 +27,24 @@ const ROCK_NOISE_FREQUENCY := 0.01 const DECONTAMINATION_NOISE_FREQUENCY := 0.01 @export_tool_button("Update", "Callable") var update_action = func(): - planet_seed = randi() + region_seed = randi() generate() var data : ChunkData func _init( _data : ChunkData, - _planet : Planet = null, + _planet : Region = null, ): - planet = _planet - if planet: - planet_seed = planet.data.planet_seed + region = _planet + if region: + region_seed = region.data.region_seed data = _data func generate(): - rock_noise_image = generate_noise(planet_seed + 1, ROCK_NOISE_FREQUENCY) - decontamination_noise_image = generate_noise(planet_seed + 2, DECONTAMINATION_NOISE_FREQUENCY) - global_position = data.chunk_coord * (Planet.CHUNK_TILE_SIZE * Planet.TILE_SIZE) + rock_noise_image = generate_noise(region_seed + 1, ROCK_NOISE_FREQUENCY) + decontamination_noise_image = generate_noise(region_seed + 2, DECONTAMINATION_NOISE_FREQUENCY) + global_position = data.chunk_coord * (Region.CHUNK_TILE_SIZE * Region.TILE_SIZE) generate_rocks() generate_ground() generate_decontamination() @@ -55,17 +55,17 @@ func finish_one_generation(generation_name : String): is_generated = true func unload(): - for x in range(Planet.CHUNK_TILE_SIZE): - for y in range(Planet.CHUNK_TILE_SIZE): - var global_coord = Vector2i(x, y) + Planet.CHUNK_TILE_SIZE * data.chunk_coord - planet.rock_layer.erase_cell(global_coord) - planet.ground_layer.erase_cell(global_coord) - planet.decontamination_layer.erase_cell(global_coord) + for x in range(Region.CHUNK_TILE_SIZE): + for y in range(Region.CHUNK_TILE_SIZE): + var global_coord = Vector2i(x, y) + Region.CHUNK_TILE_SIZE * data.chunk_coord + region.rock_layer.erase_cell(global_coord) + region.ground_layer.erase_cell(global_coord) + region.decontamination_layer.erase_cell(global_coord) # Debug # func _draw(): # draw_rect( -# Rect2(Vector2.ZERO, Vector2.ONE * Planet.CHUNK_TILE_SIZE * Planet.TILE_SIZE), +# Rect2(Vector2.ZERO, Vector2.ONE * Region.CHUNK_TILE_SIZE * Region.TILE_SIZE), # Color.WHITE, # false, # 3 @@ -78,7 +78,7 @@ func unload(): # y # ) # draw_rect( - # Rect2(Vector2i(x,y) * Planet.CHUNK_SIZE / NOISE_IMAGE_SIZE, Vector2i.ONE * Planet.CHUNK_SIZE / NOISE_IMAGE_SIZE), + # Rect2(Vector2i(x,y) * Region.CHUNK_SIZE / NOISE_IMAGE_SIZE, Vector2i.ONE * Region.CHUNK_SIZE / NOISE_IMAGE_SIZE), # Color.WHITE * ((noise_value+1)/2), # true, # ) @@ -104,25 +104,25 @@ func generate_noise( func get_tile_value_from_noise(tile_position : Vector2i, noise : Noise) -> float: var val = noise.get_noise_2d( - floori(float(tile_position.x * NOISE_IMAGE_SIZE) / Planet.CHUNK_TILE_SIZE), - floori(float(tile_position.y * NOISE_IMAGE_SIZE) / Planet.CHUNK_TILE_SIZE) + floori(float(tile_position.x * NOISE_IMAGE_SIZE) / Region.CHUNK_TILE_SIZE), + floori(float(tile_position.y * NOISE_IMAGE_SIZE) / Region.CHUNK_TILE_SIZE) ) return (val + 1)/2 func generate_rocks(): var cristals : Array[Vector2i] = [] var rocks : Array[Vector2i] = [] - for x in range(Planet.CHUNK_TILE_SIZE): - for y in range(Planet.CHUNK_TILE_SIZE): + for x in range(Region.CHUNK_TILE_SIZE): + for y in range(Region.CHUNK_TILE_SIZE): var tile_type := get_generated_rock_type(Vector2i(x, y)) - var global_coord = Vector2i(x, y) + Planet.CHUNK_TILE_SIZE * data.chunk_coord + var global_coord = Vector2i(x, y) + Region.CHUNK_TILE_SIZE * data.chunk_coord if tile_type == RockLayer.TileType.CRISTAL: cristals.append(global_coord) elif tile_type == RockLayer.TileType.ROCK: rocks.append(global_coord) - planet.rock_layer.place_rocks(cristals, RockLayer.TileType.CRISTAL, func(): finish_one_generation("rock")) - planet.rock_layer.place_rocks(rocks, RockLayer.TileType.ROCK, func(): finish_one_generation("cristal")) + region.rock_layer.place_rocks(cristals, RockLayer.TileType.CRISTAL, func(): finish_one_generation("rock")) + region.rock_layer.place_rocks(rocks, RockLayer.TileType.ROCK, func(): finish_one_generation("cristal")) func get_generated_rock_type(coord : Vector2i) -> RockLayer.TileType: var tile_value : float = get_tile_value_from_noise(coord, rock_noise_image) @@ -137,16 +137,16 @@ func get_generated_rock_type(coord : Vector2i) -> RockLayer.TileType: func generate_ground(): var coords : Array[Vector2i] = [] - for x in range(Planet.CHUNK_TILE_SIZE): - for y in range(Planet.CHUNK_TILE_SIZE): - coords.append(Vector2i(x,y) + Planet.CHUNK_TILE_SIZE * data.chunk_coord) + for x in range(Region.CHUNK_TILE_SIZE): + for y in range(Region.CHUNK_TILE_SIZE): + coords.append(Vector2i(x,y) + Region.CHUNK_TILE_SIZE * data.chunk_coord) - planet.ground_layer.place_ground(coords, func(): finish_one_generation("ground")) + region.ground_layer.place_ground(coords, func(): finish_one_generation("ground")) func generate_decontamination(): var decontamination_tiles : Array[Vector2i] = [] - for x in range(Planet.CHUNK_TILE_SIZE): - for y in range(Planet.CHUNK_TILE_SIZE): + for x in range(Region.CHUNK_TILE_SIZE): + for y in range(Region.CHUNK_TILE_SIZE): var coord = Vector2i(x,y) var tile_value : float = get_tile_value_from_noise(coord, decontamination_noise_image) var saved_diff := data.get_decontamination_tile_diff(coord) @@ -154,9 +154,9 @@ func generate_decontamination(): (saved_diff == ChunkData.TileDiff.PRESENT or tile_value < decontamination_threshold) and saved_diff != ChunkData.TileDiff.ABSENT ): - decontamination_tiles.append(Vector2i(x,y) + Planet.CHUNK_TILE_SIZE * data.chunk_coord) + decontamination_tiles.append(Vector2i(x,y) + Region.CHUNK_TILE_SIZE * data.chunk_coord) - planet.decontamination_layer.place_decontaminations( + region.decontamination_layer.place_decontaminations( decontamination_tiles, false, func(): diff --git a/stages/terrain/planet/scripts/chunk.gd.uid b/stages/terrain/region/scripts/chunk.gd.uid similarity index 100% rename from stages/terrain/planet/scripts/chunk.gd.uid rename to stages/terrain/region/scripts/chunk.gd.uid diff --git a/stages/terrain/planet/scripts/chunk_data.gd b/stages/terrain/region/scripts/chunk_data.gd similarity index 100% rename from stages/terrain/planet/scripts/chunk_data.gd rename to stages/terrain/region/scripts/chunk_data.gd diff --git a/stages/terrain/planet/scripts/chunk_data.gd.uid b/stages/terrain/region/scripts/chunk_data.gd.uid similarity index 100% rename from stages/terrain/planet/scripts/chunk_data.gd.uid rename to stages/terrain/region/scripts/chunk_data.gd.uid diff --git a/stages/terrain/planet/scripts/planet.gd b/stages/terrain/region/scripts/region.gd similarity index 82% rename from stages/terrain/planet/scripts/planet.gd rename to stages/terrain/region/scripts/region.gd index 3199bb5..c24ee0c 100644 --- a/stages/terrain/planet/scripts/planet.gd +++ b/stages/terrain/region/scripts/region.gd @@ -1,13 +1,11 @@ extends Terrain -class_name Planet - -signal pass_day_started(planet : Planet) -signal pass_day_proceeded(planet : Planet) -signal pass_day_ended(planet : Planet) +class_name Region const MIN_PASS_DAY_ANIMATION_TIME : float = PassDay.TIME_MARGIN * 2 -const TILE_SET : TileSet = preload("res://stages/terrain/planet/resources/moss_biome.tres") +const TUTORIAL_SCENE : PackedScene = preload("res://gui/game/tutorial/tutorial.tscn") + +const TILE_SET : TileSet = preload("res://stages/terrain/region/resources/moss_biome.tres") const TILE_SCALE = 1 const TILE_SIZE : int = roundi(TILE_SET.tile_size.x * TILE_SCALE) const START_ROCK_HOLE_RADIUS = 5 @@ -23,21 +21,22 @@ const CHUNK_UNLOAD_DISTANCE : int = 2 var is_generated : bool : get = check_is_generated var generated_value : float : get = get_generated_value -var data : PlanetData +var data : RegionData + +var in_passing_day_animation = false var contamination_texture : ImageTexture var rock_layer : RockLayer var ground_layer : GroundLayer var decontamination_layer : DecontaminationLayer -var garden : Garden = null -var tile_set = Planet.TILE_SET +var tile_set = Region.TILE_SET var generated_chunks : Dictionary[String,Chunk] = {} var generation_semaphore: Semaphore func _init(): - data = GameInfo.game_data.current_planet_data + data = GameInfo.game_data.current_region_data func _ready(): generation_semaphore = Semaphore.new() @@ -46,18 +45,12 @@ func _ready(): entity_container.position = TILE_SIZE * CHUNK_TILE_SIZE * Vector2.ONE / 2 load_entities(data.entities_saved_data) - var plants : Array[Plant] = [] for e in entity_container.get_children(): if e is Plant: - plants.append(e) - - garden = Garden.new(data, plants) - add_child(garden) + data.add_plant_data(e.data) generate_first_entities() - AudioManager.enter_planet() - ground_layer = GroundLayer.new(self) add_child(ground_layer) rock_layer = RockLayer.new(self) @@ -74,21 +67,6 @@ func _process(_d): generate_near_chunks(player) remove_far_chunks(player) -# queue_redraw() - -# func _draw(): -# var factor = 20 -# for x in range(terrain_size.x / factor): -# for y in range(terrain_size.y / factor): -# var point = Vector2(x, y) * factor - -# draw_circle( -# point, -# factor/10, -# Color.BLUE if garden.is_there_contamination(point) else Color.RED, -# true -# ) - #region ------------------ Generation ------------------ func generate_first_entities(): @@ -182,37 +160,37 @@ func save(): #region ------------------ Usage ------------------ func plant( - type : PlantType, - plant_position : Vector2, - plant_mutations : Array[PlantMutation] = [] + plant_seed : Seed, + plant_position : Vector2i ) -> bool: - var new_plant = garden.plant(type, plant_mutations) + var new_plant_data = PlantData.generate_from_seed(plant_seed, plant_position) + data.add_plant_data(new_plant_data) + var new_plant = Plant.new(new_plant_data) add_entity(new_plant, plant_position) return true func pass_day(): + data.start_pass_day() %PassDay.pass_day_animation() for e : Node2D in entity_container.get_children(): if e.has_method("_start_pass_day"): e._start_pass_day() - pass_day_started.emit(self) if not %PassDay.is_animation_appeared: await %PassDay.animation_appeared - - pass_day_proceeded.emit(self) + data.day += 1 for e : Node2D in entity_container.get_children(): if e.has_method("_pass_day"): e._pass_day() - pass_day_ended.emit(self) + data.proceed_pass_day() if not %PassDay.is_animation_disappeared: await %PassDay.animation_disappeared for e : Node2D in entity_container.get_children(): if e.has_method("_end_pass_day"): e._end_pass_day() - garden.update_garden_score() + data.end_pass_day() save() #endregion diff --git a/stages/terrain/planet/scripts/planet.gd.uid b/stages/terrain/region/scripts/region.gd.uid similarity index 100% rename from stages/terrain/planet/scripts/planet.gd.uid rename to stages/terrain/region/scripts/region.gd.uid diff --git a/stages/terrain/region/scripts/region_data.gd b/stages/terrain/region/scripts/region_data.gd new file mode 100644 index 0000000..882e892 --- /dev/null +++ b/stages/terrain/region/scripts/region_data.gd @@ -0,0 +1,128 @@ +extends Resource +class_name RegionData + +enum State {IN_PROGRESS,FAILED,SUCCEEDED} + +signal plant_changing_score(p : PlantData, amount : int) +signal updated(region_data : RegionData) + +signal pass_day_started(region_data : RegionData) +signal pass_day_proceeded(region_data : RegionData) +signal pass_day_ended(region_data : RegionData) + +const DEFAULT_START_CHARGE := 10 +const DEFAULT_OBJECTIVE := 10 + +@export var region_seed : int +@export var region_name : String +@export var day : int = 1 +@export var entities_saved_data : Array[EntityData] = [] +@export var score_by_plant : Dictionary[PlantData, int] = {} +@export var generated_chunk_entities : Array[Vector2i] +@export var tutorial_step : int = 0 +@export var tutorial = false + +@export var chunks_data : Dictionary[String, ChunkData] + +@export var charges : int : + set(v): + charges = v + updated.emit(self) +@export var objective : int : + set(v): + objective = v + updated.emit(self) + + +var in_passing_day_animation := false + +func _init( + parameter : RegionParameter = RegionParameter.new() +): + charges = parameter.charges + objective = parameter.objective + region_name = parameter.name + region_seed = parameter.region_seed + + tutorial = parameter.tutorial + +#region ------------------ Chunks ------------------ + +func get_coord_id(coord): + return "%d:%d" % [coord.x, coord.y] + +func has_chunk_data(coord : Vector2i) -> bool: + return chunks_data.has(get_coord_id(coord)) + +func add_chunk_data(coord : Vector2i, data : ChunkData): + chunks_data[get_coord_id(coord)] = data + +func get_chunk_data(coord : Vector2i) -> ChunkData: + return chunks_data[get_coord_id(coord)] + +func get_or_create_chunk_data(coord : Vector2i) -> ChunkData: + if has_chunk_data(coord): + return get_chunk_data(coord) + else: + var new_chunk_data = ChunkData.new(coord) + add_chunk_data(coord, new_chunk_data) + return new_chunk_data + +#endregion + +#region ------------------ Score ------------------ + +func get_score(): + var score = 0 + for plant_data in score_by_plant: + score += score_by_plant[plant_data] + return score + +func is_objective_reached(): + return get_score() >= objective + +func get_state() -> State: + if get_score() >= objective: + return State.SUCCEEDED + elif charges <= 0: + return State.FAILED + else: + return State.IN_PROGRESS +#endregion + +#region ------------------ Day ------------------ + +func start_pass_day(): + in_passing_day_animation = true + pass_day_started.emit(self) + +func proceed_pass_day(): + pass_day_proceeded.emit(self) + +func end_pass_day(): + pass_day_ended.emit(self) + in_passing_day_animation = false + +#endregion + +#region ------------------ Plants ------------------ + +func add_plant_data(plant_data : PlantData): + score_by_plant[plant_data] = plant_data.get_score() + plant_data.disappeared.connect(_on_plant_disappeared) + plant_data.updated.connect(_on_plant_updated) + +func _on_plant_updated(plant_data : PlantData): + var old_plant_score = score_by_plant[plant_data] + score_by_plant[plant_data] = plant_data.get_score() + + if old_plant_score != score_by_plant[plant_data]: + plant_changing_score.emit(plant_data, score_by_plant[plant_data] - old_plant_score) + updated.emit(self) + +func _on_plant_disappeared(plant_data : PlantData): + plant_changing_score.emit(plant_data, - score_by_plant[plant_data]) + score_by_plant.erase(plant_data) + updated.emit(self) + +#endregion diff --git a/stages/terrain/planet/scripts/planet_data.gd.uid b/stages/terrain/region/scripts/region_data.gd.uid similarity index 100% rename from stages/terrain/planet/scripts/planet_data.gd.uid rename to stages/terrain/region/scripts/region_data.gd.uid diff --git a/stages/terrain/region/scripts/region_parameter.gd b/stages/terrain/region/scripts/region_parameter.gd new file mode 100644 index 0000000..3b2ed73 --- /dev/null +++ b/stages/terrain/region/scripts/region_parameter.gd @@ -0,0 +1,21 @@ +extends Resource +class_name RegionParameter + +@export var charges : int +@export var objective : int +@export var name : String +@export var tutorial : bool +@export var region_seed : int + +func _init( + _charges : int = 10, + _objective : int = 10, + _name = Random.generate_random_name(), + _tutorial = false, + _region_seed = randi(), +): + charges = _charges + objective = _objective + name = _name + tutorial = _tutorial + region_seed = _region_seed \ No newline at end of file diff --git a/stages/terrain/planet/scripts/planet_parameter.gd.uid b/stages/terrain/region/scripts/region_parameter.gd.uid similarity index 100% rename from stages/terrain/planet/scripts/planet_parameter.gd.uid rename to stages/terrain/region/scripts/region_parameter.gd.uid diff --git a/stages/terrain/planet/scripts/tile_map_layers/decontamination_layer.gd b/stages/terrain/region/scripts/tile_map_layers/decontamination_layer.gd similarity index 82% rename from stages/terrain/planet/scripts/tile_map_layers/decontamination_layer.gd rename to stages/terrain/region/scripts/tile_map_layers/decontamination_layer.gd index e8de9cd..bc56f98 100644 --- a/stages/terrain/planet/scripts/tile_map_layers/decontamination_layer.gd +++ b/stages/terrain/region/scripts/tile_map_layers/decontamination_layer.gd @@ -1,5 +1,5 @@ @tool -extends PlanetLayer +extends RegionLayer class_name DecontaminationLayer const DECONTAMINATION_TILE_TERRAIN_SET : int = 0 @@ -21,10 +21,10 @@ func place_decontaminations(coords : Array[Vector2i], save := false, on_finished if save: for coord in coords: var chunk_coord = Vector2i( - floori(coord.x / float(Planet.CHUNK_TILE_SIZE)), - floori(coord.y / float(Planet.CHUNK_TILE_SIZE)), + floori(coord.x / float(Region.CHUNK_TILE_SIZE)), + floori(coord.y / float(Region.CHUNK_TILE_SIZE)), ) - (planet.data + (region.data .get_chunk_data(chunk_coord) .update_decontamination_tile_diff(coord, ChunkData.TileDiff.PRESENT)) diff --git a/stages/terrain/planet/scripts/tile_map_layers/decontamination_layer.gd.uid b/stages/terrain/region/scripts/tile_map_layers/decontamination_layer.gd.uid similarity index 100% rename from stages/terrain/planet/scripts/tile_map_layers/decontamination_layer.gd.uid rename to stages/terrain/region/scripts/tile_map_layers/decontamination_layer.gd.uid diff --git a/stages/terrain/planet/scripts/tile_map_layers/ground_layer.gd b/stages/terrain/region/scripts/tile_map_layers/ground_layer.gd similarity index 84% rename from stages/terrain/planet/scripts/tile_map_layers/ground_layer.gd rename to stages/terrain/region/scripts/tile_map_layers/ground_layer.gd index 2cf548f..ff65103 100644 --- a/stages/terrain/planet/scripts/tile_map_layers/ground_layer.gd +++ b/stages/terrain/region/scripts/tile_map_layers/ground_layer.gd @@ -1,8 +1,8 @@ @tool -extends PlanetLayer +extends RegionLayer class_name GroundLayer -const MATERIAL : Material = preload("res://stages/terrain/planet/resources/materials/moss_biome/ground_planet_tilemap.tres") +const MATERIAL : Material = preload("res://stages/terrain/region/resources/materials/moss_biome/ground_planet_tilemap.tres") const GROUND_TILE_TERRAIN_SET : int = 0 const GROUND_TILE_TERRAIN : int = 3 diff --git a/stages/terrain/planet/scripts/tile_map_layers/ground_layer.gd.uid b/stages/terrain/region/scripts/tile_map_layers/ground_layer.gd.uid similarity index 100% rename from stages/terrain/planet/scripts/tile_map_layers/ground_layer.gd.uid rename to stages/terrain/region/scripts/tile_map_layers/ground_layer.gd.uid diff --git a/stages/terrain/planet/scripts/tile_map_layers/planet_layer.gd b/stages/terrain/region/scripts/tile_map_layers/region_layer.gd similarity index 85% rename from stages/terrain/planet/scripts/tile_map_layers/planet_layer.gd rename to stages/terrain/region/scripts/tile_map_layers/region_layer.gd index 1bb0e55..163710b 100644 --- a/stages/terrain/planet/scripts/tile_map_layers/planet_layer.gd +++ b/stages/terrain/region/scripts/tile_map_layers/region_layer.gd @@ -1,19 +1,19 @@ @abstract extends TileMapLayer -class_name PlanetLayer +class_name RegionLayer var threads : Array[Thread] = [] var is_generated = false -var planet : Planet +var region : Region func _init( - _planet : Planet = null + _planet : Region = null ): - planet = _planet + region = _planet func _ready(): - tile_set = planet.tile_set - scale = Vector2.ONE * Planet.TILE_SCALE + tile_set = region.tile_set + scale = Vector2.ONE * Region.TILE_SCALE navigation_enabled = false setup() @@ -58,13 +58,13 @@ func place_terrain_cells( tile_terrain_set : int = 0, tile_terrain : int = 0 ): - planet.generation_semaphore.wait() + region.generation_semaphore.wait() set_cells_terrain_connect( coords, tile_terrain_set, tile_terrain ) - planet.generation_semaphore.post() + region.generation_semaphore.post() func _exit_tree(): for t in threads: diff --git a/stages/terrain/planet/scripts/tile_map_layers/planet_layer.gd.uid b/stages/terrain/region/scripts/tile_map_layers/region_layer.gd.uid similarity index 100% rename from stages/terrain/planet/scripts/tile_map_layers/planet_layer.gd.uid rename to stages/terrain/region/scripts/tile_map_layers/region_layer.gd.uid diff --git a/stages/terrain/planet/scripts/tile_map_layers/rock_layer.gd b/stages/terrain/region/scripts/tile_map_layers/rock_layer.gd similarity index 74% rename from stages/terrain/planet/scripts/tile_map_layers/rock_layer.gd rename to stages/terrain/region/scripts/tile_map_layers/rock_layer.gd index a5f25d6..a895924 100644 --- a/stages/terrain/planet/scripts/tile_map_layers/rock_layer.gd +++ b/stages/terrain/region/scripts/tile_map_layers/rock_layer.gd @@ -1,8 +1,8 @@ @tool -extends PlanetLayer +extends RegionLayer class_name RockLayer -const MATERIAL : Material = preload("res://stages/terrain/planet/resources/materials/rock_planet_tilemap.tres") +const MATERIAL : Material = preload("res://stages/terrain/region/resources/materials/rock_planet_tilemap.tres") const ROCK_TILE_TERRAIN_SET : int = 0 const ROCK_TILE_TERRAIN : int = 1 const CRISTAL_TILE_TERRAIN : int = 2 @@ -34,11 +34,11 @@ func remove_rocks(coords : Array[Vector2i], save = false,on_finished : Callable if save: for coord in coords: var chunk_coord = Vector2i( - floori(coord.x / float(Planet.CHUNK_TILE_SIZE)), - floori(coord.y / float(Planet.CHUNK_TILE_SIZE)), + floori(coord.x / float(Region.CHUNK_TILE_SIZE)), + floori(coord.y / float(Region.CHUNK_TILE_SIZE)), ) - var chunk_tile_coord : Vector2i = coord - chunk_coord * Planet.CHUNK_TILE_SIZE - (planet.data + var chunk_tile_coord : Vector2i = coord - chunk_coord * Region.CHUNK_TILE_SIZE + (region.data .get_chunk_data(chunk_coord) .update_rock_tile_diff(chunk_tile_coord, ChunkData.TileDiff.ABSENT)) @@ -57,15 +57,12 @@ func dig_rocks(coords : Array[Vector2i]) -> bool: func loot_rock(coord : Vector2i): if get_tile_type(coord) == TileType.CRISTAL and randf() < CRISTAL_LOOT_CHANCE: - if len(GameInfo.game_data.unlocked_plant_types): - var loot = Seed.new( - GameInfo.game_data.unlocked_plant_types.pick_random() - ) - planet.drop_item( - loot, - coord * Planet.TILE_SIZE + Vector2i.ONE * floori(Planet.TILE_SIZE/2.), - floor(Planet.TILE_SIZE/2.) - ) + var loot = Seed.generate_random() + region.drop_item( + loot, + coord * Region.TILE_SIZE + Vector2i.ONE * floori(Region.TILE_SIZE/2.), + floor(Region.TILE_SIZE/2.) + ) func has_tile(coord : Vector2i) -> bool: return has_cell(coord) diff --git a/stages/terrain/planet/scripts/tile_map_layers/rock_layer.gd.uid b/stages/terrain/region/scripts/tile_map_layers/rock_layer.gd.uid similarity index 100% rename from stages/terrain/planet/scripts/tile_map_layers/rock_layer.gd.uid rename to stages/terrain/region/scripts/tile_map_layers/rock_layer.gd.uid diff --git a/stages/terrain/scripts/terrain.gd b/stages/terrain/scripts/terrain.gd index f3bdac4..499154c 100644 --- a/stages/terrain/scripts/terrain.gd +++ b/stages/terrain/scripts/terrain.gd @@ -48,7 +48,7 @@ func load_entities(saved_entities_data : Array[EntityData]): enroll_entity(static_entity) for save_data in saved_entities_data: - var entity = save_data.load() + var entity = save_data.load_entity() if entity: add_entity(entity, save_data.position) diff --git a/stages/terrain/truck/assets/sprite/truck_interior.png b/stages/terrain/truck/assets/sprite/truck_interior.png deleted file mode 100644 index 7a18fb5..0000000 Binary files a/stages/terrain/truck/assets/sprite/truck_interior.png and /dev/null differ diff --git a/stages/terrain/truck/assets/sprite/truck_interior.png~ b/stages/terrain/truck/assets/sprite/truck_interior.png~ deleted file mode 100644 index 795b9ec..0000000 Binary files a/stages/terrain/truck/assets/sprite/truck_interior.png~ and /dev/null differ diff --git a/stages/terrain/truck/scripts/truck_data.gd b/stages/terrain/truck/scripts/truck_data.gd deleted file mode 100644 index 3231845..0000000 --- a/stages/terrain/truck/scripts/truck_data.gd +++ /dev/null @@ -1,8 +0,0 @@ -extends Resource -class_name TruckData - -@export var rewards_given : Array[Reward] = [] -@export var rewards : Array[Reward] = [] -@export var rewarded_times : int = 0 -@export var compost_containing_seeds : Array[int] = [] -@export var entities_saved_data : Array[EntityData] = [] diff --git a/stages/terrain/truck/scripts/truck_data.gd.uid b/stages/terrain/truck/scripts/truck_data.gd.uid deleted file mode 100644 index e42846c..0000000 --- a/stages/terrain/truck/scripts/truck_data.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dyx17r0phlodb diff --git a/stages/terrain/truck/scripts/truck_interior.gd b/stages/terrain/truck/scripts/truck_interior.gd deleted file mode 100644 index 8143153..0000000 --- a/stages/terrain/truck/scripts/truck_interior.gd +++ /dev/null @@ -1,93 +0,0 @@ -extends Terrain -class_name TruckInterior - -const PLANET_RUN_PATH = "res://stages/planet_run/planet_run.tscn" - -@export var composts : Array[Compost] -@onready var spawn_position : Node2D = %SpawnPosition -@onready var data : TruckData = GameInfo.game_data.truck_data - -func _on_exit_interacted(_p : Player): - data.entities_saved_data = save_entities() - data.rewards = [] - for c in composts: - data.rewards.append(c.reward) - SceneManager.change_scene(SceneManager.PLANET_SCENE) - -func _ready(): - load_entities(data.entities_saved_data) - while len(data.compost_containing_seeds) < len(composts): - data.compost_containing_seeds.append(0) - for i in range(len(composts)): - var compost = composts[i] - compost.containing_seed = data.compost_containing_seeds[i] - compost.filled.connect( - func (c: Compost): - data.compost_containing_seeds[i] = c.containing_seed - ) - - if i < len(data.rewards): - compost.reward = data.rewards[i] - else: - var new_reward = generate_reward() - compost.reward = new_reward - data.rewards.append(new_reward) - compost.rewarded.connect(_on_compost_rewarded) - - AudioManager.enter_truck() - -func _on_compost_rewarded(c: Compost): - data.rewarded_times += 1 - data.rewards_given.append(c.reward) - c.reward = generate_reward() - -func get_compost_rewards() -> Array[Reward]: - var rewards : Array[Reward] = [] - for c in composts: - if c.reward: - rewards.append(c.reward) - return rewards - -func get_random_reward_cost() -> int: - return randi_range(data.rewarded_times + 1, data.rewarded_times + 2) - -func get_possible_rewards() -> Array[Reward]: - var possible_rewards : Array[Reward] = [ - UpgradeMaxEnergyReward.new(get_random_reward_cost() + 2), - UpgradeMaxInventoryReward.new(get_random_reward_cost()), - GiveItemReward.new( - get_random_reward_cost(), - Blueprint.new(preload("res://entities/interactables/machines/solar_pannel/solar_pannel.tres")) - ), - ] - - if data.rewards_given.find_custom( - func(r : Reward): - return r is GiveItemReward and r.item is Trowel - ) == -1: - possible_rewards.append( - GiveItemReward.new( - get_random_reward_cost(), - Knife.new() - ) - ) - if data.rewards_given.find_custom( - func(r : Reward): - return r is GiveItemReward and r.item is Knife - ) == -1: - possible_rewards.append( - GiveItemReward.new( - get_random_reward_cost(), - Trowel.new() - ) - ) - - return possible_rewards - -func generate_reward() -> Reward: - var max_tries = 3 - var reward = get_possible_rewards().pick_random() - while get_compost_rewards().map(func(r): return r.desc()).find(reward.desc()) != -1 and max_tries > 0: - max_tries -= 1 - reward = get_possible_rewards().pick_random() - return reward diff --git a/stages/terrain/truck/scripts/truck_interior.gd.uid b/stages/terrain/truck/scripts/truck_interior.gd.uid deleted file mode 100644 index 2dcde8a..0000000 --- a/stages/terrain/truck/scripts/truck_interior.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://d0gmkwebxdptk diff --git a/stages/terrain/truck/truck.tscn b/stages/terrain/truck/truck.tscn deleted file mode 100644 index 4d44a06..0000000 --- a/stages/terrain/truck/truck.tscn +++ /dev/null @@ -1,27 +0,0 @@ -[gd_scene load_steps=5 format=3 uid="uid://biwkti5cir5ut"] - -[ext_resource type="PackedScene" uid="uid://ceplumcunebag" path="res://stages/terrain/truck/truck_interior.tscn" id="1_ycq4y"] -[ext_resource type="Script" uid="uid://d1nsr56bh1a1y" path="res://entities/camera/scripts/camera.gd" id="2_063c3"] -[ext_resource type="PackedScene" uid="uid://12nak7amd1uq" path="res://gui/game/game_gui.tscn" id="2_dw1sv"] -[ext_resource type="PackedScene" uid="uid://bgvbgeq46wee2" path="res://entities/player/player.tscn" id="5_dw1sv"] - -[node name="Truck" type="Node2D"] - -[node name="CanvasLayer" type="CanvasLayer" parent="."] - -[node name="GameGui" parent="CanvasLayer" instance=ExtResource("2_dw1sv")] - -[node name="TruckInterior" parent="." node_paths=PackedStringArray("entity_container") instance=ExtResource("1_ycq4y")] -position = Vector2(0, 0) -entity_container = NodePath("Entities") - -[node name="Entities" type="Node2D" parent="TruckInterior"] -y_sort_enabled = true - -[node name="Player" parent="TruckInterior/Entities" instance=ExtResource("5_dw1sv")] -position = Vector2(51, 492) - -[node name="Camera" type="Camera2D" parent="."] -position = Vector2(385, 343) -script = ExtResource("2_063c3") -metadata/_custom_type_script = "uid://d1nsr56bh1a1y" diff --git a/stages/terrain/truck/truck_interior.tscn b/stages/terrain/truck/truck_interior.tscn deleted file mode 100644 index 7ebd33a..0000000 --- a/stages/terrain/truck/truck_interior.tscn +++ /dev/null @@ -1,62 +0,0 @@ -[gd_scene load_steps=7 format=3 uid="uid://ceplumcunebag"] - -[ext_resource type="Texture2D" uid="uid://d2p7h0aga85tn" path="res://stages/terrain/truck/assets/sprite/truck_interior.png" id="1_5c5ey"] -[ext_resource type="Script" uid="uid://d0gmkwebxdptk" path="res://stages/terrain/truck/scripts/truck_interior.gd" id="1_fk6sc"] -[ext_resource type="Script" uid="uid://dyprcd68fjstf" path="res://entities/interactables/scripts/interactable.gd" id="3_fk6sc"] -[ext_resource type="Texture2D" uid="uid://dex283rx00fjb" path="res://common/icons/logout.svg" id="3_v18jm"] -[ext_resource type="PackedScene" uid="uid://p2dkmy6xs31c" path="res://entities/interactables/truck/compost/compost.tscn" id="6_b7823"] - -[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_wi5be"] -radius = 69.76956 -height = 376.0 - -[node name="TruckInterior" type="Node2D" node_paths=PackedStringArray("composts")] -position = Vector2(-40, -469) -script = ExtResource("1_fk6sc") -composts = [NodePath("Compost"), NodePath("Compost2")] -metadata/_custom_type_script = "uid://dfl1ijmbmw57r" - -[node name="Sprite" type="Sprite2D" parent="."] -modulate = Color(0.67495143, 0.69801295, 0.68495274, 1) -position = Vector2(292, 376) -scale = Vector2(0.5, 0.5) -texture = ExtResource("1_5c5ey") - -[node name="StaticBody2D" type="StaticBody2D" parent="."] -scale = Vector2(0.5, 0.5) - -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="StaticBody2D"] -position = Vector2(112.00001, 670) -scale = Vector2(0.8064369, 0.8064369) -polygon = PackedVector2Array(141.36256, -138.8825, 1616.9894, -111.60202, 1656.67, 461.2884, 389.36707, 466.24847, 386.88702, 545.6099, -173.60316, 533.2097, -141.36258, -57.041016, -2.480053, -89.28162, 109.12198, -106.64194, 131, -327, -487, -326, -465, 841, 2150.1992, 815.9348, 2110.5183, -825.855, -521, -732, -482, -327, 133, -331) - -[node name="SpawnPosition" type="Node2D" parent="."] -unique_name_in_owner = true -position = Vector2(52, 473.00003) -scale = Vector2(0.5539248, 0.5539248) - -[node name="Exit" type="Area2D" parent="."] -position = Vector2(47, 497.00003) -scale = Vector2(0.5539248, 0.5539248) -script = ExtResource("3_fk6sc") -default_interact_text = "EXIT_TRUCK" -default_info_title = "EXIT" -default_info_desc = "LADDER_DESC_TEXT" -metadata/_custom_type_script = "uid://dyprcd68fjstf" - -[node name="Bolt" type="Sprite2D" parent="Exit"] -position = Vector2(10.831797, -16.24775) -scale = Vector2(1.8052993, 1.8052993) -texture = ExtResource("3_v18jm") - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Exit"] -position = Vector2(9.026497, 81.2384) -shape = SubResource("CapsuleShape2D_wi5be") - -[node name="Compost" parent="." instance=ExtResource("6_b7823")] -position = Vector2(358, 357) - -[node name="Compost2" parent="." instance=ExtResource("6_b7823")] -position = Vector2(536, 365) - -[connection signal="interacted" from="Exit" to="." method="_on_exit_interacted"] diff --git a/stages/title_screen/scripts/title_screen.gd b/stages/title_screen/scripts/title_screen.gd index 2c9aa4e..8bf2d92 100644 --- a/stages/title_screen/scripts/title_screen.gd +++ b/stages/title_screen/scripts/title_screen.gd @@ -14,7 +14,7 @@ func _ready(): %Version.text = ProjectSettings.get_setting("application/config/version") func _on_start_pressed(): - SceneManager.change_scene(SceneManager.INTRO_SCENE) + SceneManager.change_scene("INTRO") func _process(delta): next_mouse_pos = get_viewport().get_mouse_position() diff --git a/stages/title_screen/title_screen.tscn b/stages/title_screen/title_screen.tscn index 66c3f8a..2a47a4e 100644 --- a/stages/title_screen/title_screen.tscn +++ b/stages/title_screen/title_screen.tscn @@ -1,19 +1,17 @@ -[gd_scene load_steps=14 format=3 uid="uid://dxvtm81tq1a6w"] +[gd_scene load_steps=12 format=3 uid="uid://dxvtm81tq1a6w"] [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_y6tw6"] -[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="4_y6tw6"] [ext_resource type="PackedScene" uid="uid://cm5b7w7j6527f" path="res://stages/title_screen/planet_3d.tscn" id="5_7a1qq"] [ext_resource type="Shader" uid="uid://bv2rghn44mrrf" path="res://stages/title_screen/resources/shaders/stars.gdshader" id="7_y6tw6"] -[ext_resource type="AudioStream" uid="uid://bpf6witukorka" path="res://common/audio_manager/assets/morceaux/autres/main_menu.ogg" id="8_y6tw6"] [sub_resource type="ViewportTexture" id="ViewportTexture_6yuhi"] viewport_path = NodePath("SubViewport") -[sub_resource type="FastNoiseLite" id="FastNoiseLite_6yuhi"] -seed = -964506676 +[sub_resource type="FastNoiseLite" id="FastNoiseLite_qnk88"] +seed = -907666519 frequency = 1.0 [sub_resource type="ShaderMaterial" id="ShaderMaterial_7a1qq"] @@ -52,7 +50,6 @@ adjustment_saturation = 0.88 [node name="TitleScreen" type="CanvasLayer"] script = ExtResource("1_6yuhi") -game_scene_path = "uid://d0n52psuns1vl" [node name="Background1" type="TextureRect" parent="."] z_index = -1 @@ -117,62 +114,15 @@ layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 4 -[node name="ArtTitle" type="Label" parent="MarginContainer/GridContainer/Credits"] -layout_mode = 2 -size_flags_horizontal = 3 -theme = ExtResource("1_4ph5l") -text = "ART" -label_settings = ExtResource("4_y6tw6") -horizontal_alignment = 1 - -[node name="ArtText" type="Label" parent="MarginContainer/GridContainer/Credits"] -layout_mode = 2 -theme = ExtResource("1_4ph5l") -text = "Baptiste Pocard -Céline Ferrand / Lunarde -Camille Fleury -" -horizontal_alignment = 1 - -[node name="DevTitle" type="Label" parent="MarginContainer/GridContainer/Credits"] -layout_mode = 2 -size_flags_horizontal = 3 -theme = ExtResource("1_4ph5l") -text = "DEV_AND_GAME_DESIGN" -label_settings = ExtResource("4_y6tw6") -horizontal_alignment = 1 - -[node name="DevText" type="Label" parent="MarginContainer/GridContainer/Credits"] -layout_mode = 2 -theme = ExtResource("1_4ph5l") -text = "Zacharie Guet / Zink -Victor Robert Jaunet / Altaezio -" -horizontal_alignment = 1 - -[node name="MusicTitle" type="Label" parent="MarginContainer/GridContainer/Credits"] -layout_mode = 2 -size_flags_horizontal = 3 -theme = ExtResource("1_4ph5l") -text = "MUSIC" -label_settings = ExtResource("4_y6tw6") -horizontal_alignment = 1 - -[node name="MusicText" type="Label" parent="MarginContainer/GridContainer/Credits"] -layout_mode = 2 -theme = ExtResource("1_4ph5l") -text = "Niels Cauterman / Nilou" -horizontal_alignment = 1 - [node name="SubViewport" type="SubViewport" parent="."] size = Vector2i(1980, 1080) [node name="Planet3d" parent="SubViewport" instance=ExtResource("5_7a1qq")] unique_name_in_owner = true -noise = SubResource("FastNoiseLite_6yuhi") +noise = SubResource("FastNoiseLite_qnk88") [node name="Camera3D" type="Camera3D" parent="SubViewport"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 64.323425) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -14.369979, 0, 64.323425) current = true fov = 34.0 @@ -182,8 +132,4 @@ environment = SubResource("Environment_nmsah") [node name="DirectionalLight3D" type="DirectionalLight3D" parent="SubViewport"] transform = Transform3D(0.044800885, 0.76661056, -0.6405476, -0.8325595, 0.38302267, 0.4001729, 0.55212104, 0.51536596, 0.65540874, -23.18848, 19.508549, 0) -[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] -stream = ExtResource("8_y6tw6") -autoplay = true - [connection signal="pressed" from="MarginContainer/GridContainer/VBoxContainer/Start" to="." method="_on_start_pressed"] diff --git a/translation/game/gui.csv b/translation/game/gui.csv index 2c3ab9a..4aa55a8 100644 --- a/translation/game/gui.csv +++ b/translation/game/gui.csv @@ -57,6 +57,7 @@ MATURE_ON_DAY_%d,Mature on day [b]%d[/b],Mature au jour [b]%d[/b] %d_SCORE_WHEN_MATURE,Grants [b]%d[/b] garden points when mature,Donne [b]%d[/b] points de jardin une fois mature ABSURD,[rainbow]Absurd[/rainbow],[rainbow]Absurde[/rainbow] GROW_IN_%d,Grow in [b]%d[/b] days,Mature dans [b]%d[/b] jours +DIE_ON_DAY_%d,Die on day %d,Meurs au jour %d %s_SCORE_WHEN_MATURE,Grants [b]%s[/b] garden points when mature,Donne [b]%s[/b] points de jardin une fois mature DISCOVER_%s,Discover %s,Découvre %s EVOLVE_%s,Upgrade %s,Améliore %s @@ -108,7 +109,7 @@ TAKE_A_SEED,Take a seed,Prend une graine PLANT_THE_SEED_IN_DECONTAMINED_ZONE,Plant the seed in the decontamined zone,Plante la graine dans la zone décontaminée RECHARGE_TO_PASS_DAYS,Recharge to pass the day,Recharge-toi pour passer la journée HARVEST_MATURE_PLANTS_WITH_SHOVEL,Harvest mature plants with the shovel,Récolte les plantes matures avec la pelle -SCORE_%d,Score : %d,Score : %d +SCORE_%d,Score %d,Score %d SOLAR_PANNEL,Solar panel,Panneau solaire SOLAR_PANNEL_DESCRIPTION_TEXT,Grants energy when charged. Take several days to recharge,Donne de l’énergie quand chargé. Prend plusieurs jours à se recharger TRUCK_ENTRANCE,Truck entrance,Entrée du camion @@ -174,4 +175,10 @@ CHOOSE_A_REGION,Choose a region,Choisissez une région TRAVEL_TO_REGION_%s,Travel to region %s,Voyager vers la région %s NOT_NOW,Not now,Pas maintenant GO,Go !,Go ! -RETURN,Return,Retour \ No newline at end of file +RETURN,Return,Retour +PASS_THE_DIALOG,Pass the dialog,Passer le dialogue +ARE_YOU_SURE,Are you sure ?,Êtes vous sûr ? +MISSION_SUCCEEDED,Mission Succeeded,Mission Réussie +MISSION_FAILED,Mission Failed,Mission Échouée +MISSION_IN_PROGRESS,Mission In Progress,Mission En Cours +%d_PLANTS,%d plants,%d plantes \ No newline at end of file