Ajout d'un mode infini
This commit is contained in:
@@ -1,16 +1,28 @@
|
||||
extends Resource
|
||||
class_name GameData
|
||||
|
||||
enum GameMode {STORY}
|
||||
enum Mode {STORY, INFINITE}
|
||||
|
||||
signal current_run_updated(r : RunData)
|
||||
signal current_region_data_updated(p : RegionData)
|
||||
|
||||
|
||||
func _init(
|
||||
_game_mode : Mode = Mode.STORY
|
||||
):
|
||||
game_mode = _game_mode
|
||||
if game_mode == Mode.STORY:
|
||||
progression_data = StoryProgressionData.new()
|
||||
elif game_mode == Mode.INFINITE:
|
||||
progression_data = InfiniteProgressionData.new()
|
||||
|
||||
|
||||
@export var game_mode : Mode = GameData.Mode.STORY
|
||||
|
||||
@export var player_data : PlayerData = PlayerData.new()
|
||||
|
||||
@export var progression_data : ProgressionData = ProgressionData.new()
|
||||
@export var progression_data : ProgressionData
|
||||
|
||||
@export var current_run : RunData = start_run() :
|
||||
@export var current_run : RunData :
|
||||
set(v):
|
||||
current_run = v
|
||||
current_run_updated.emit(v)
|
||||
@@ -30,8 +42,6 @@ signal current_region_data_updated(p : RegionData)
|
||||
|
||||
@export var item_announced = []
|
||||
|
||||
@export var game_mode : GameMode = GameMode.STORY
|
||||
|
||||
@export var dialogs_done : Array[String] = [] #Chemin des dialogues terminés
|
||||
@export var tutorials_done : Array[String] = []
|
||||
|
||||
@@ -39,7 +49,7 @@ func start_run() -> RunData:
|
||||
player_data.clear_inventory()
|
||||
player_data.update_with_artefacts([])
|
||||
current_run = RunData.new()
|
||||
current_run.story_step = progression_data.story_step.duplicate_deep()
|
||||
current_run.story_step = progression_data.get_story_step().duplicate_deep()
|
||||
current_run.generate_next_run_points()
|
||||
current_run.current_run_point_changed.connect(
|
||||
func(rp : RunPoint):
|
||||
@@ -59,12 +69,14 @@ func start_region(region_param : RegionParameter):
|
||||
current_region_data = RegionData.new(region_param)
|
||||
|
||||
func give_up():
|
||||
progression_data.finish_run(current_run)
|
||||
current_region_data = null
|
||||
current_run = null
|
||||
start_run()
|
||||
SceneManager.change_to_scene(progression_data.story_step.get_respawn_scene())
|
||||
SceneManager.change_to_scene(progression_data.get_story_step().get_respawn_scene())
|
||||
|
||||
func finish_story_step():
|
||||
progression_data.finish_run(current_run)
|
||||
progression_data.next_story_step()
|
||||
current_region_data = null
|
||||
start_run()
|
||||
|
||||
29
common/game_data/scripts/infinite_progression_data.gd
Normal file
29
common/game_data/scripts/infinite_progression_data.gd
Normal file
@@ -0,0 +1,29 @@
|
||||
extends ProgressionData
|
||||
class_name InfiniteProgressionData
|
||||
|
||||
func get_story_step() -> StoryStep:
|
||||
return InfiniteStoryStep.new(run_number)
|
||||
|
||||
func get_story_progression() -> float:
|
||||
return 0.
|
||||
|
||||
func discover_mutation(_pm : PlantMutation) -> void:
|
||||
pass
|
||||
|
||||
func get_mutations_discovered() -> Array[String]:
|
||||
var mutation_discovered : Array[String] = []
|
||||
for m in get_all_mutations():
|
||||
mutation_discovered.append(m.get_mutation_id())
|
||||
return mutation_discovered
|
||||
|
||||
func next_story_step() -> void:
|
||||
pass
|
||||
|
||||
func are_all_mutations_unlocked() -> bool:
|
||||
return true
|
||||
|
||||
func unlock_new_mutation() -> PlantMutation:
|
||||
return null
|
||||
|
||||
func get_available_mutations() -> Array[PlantMutation]:
|
||||
return get_all_mutations()
|
||||
@@ -0,0 +1 @@
|
||||
uid://iigxgqiyn0p4
|
||||
@@ -1,25 +1,25 @@
|
||||
@abstract
|
||||
extends Resource
|
||||
class_name ProgressionData
|
||||
|
||||
@export var planted_mutation_ids: Array[String] = []
|
||||
@export var story_step_i := 0
|
||||
@export var mutations_unlocked = 8
|
||||
@export var run_number : int = 0
|
||||
@export var best_run : int = 0
|
||||
|
||||
var all_mutations: Array[PlantMutation] : get = get_all_mutations
|
||||
var available_mutations: Array[PlantMutation] : get = get_available_mutations
|
||||
var available_artefacts: Array[Artefact] : get = get_all_artifacts
|
||||
var story_step : StoryStep : get = get_story_step
|
||||
@abstract func get_story_step() -> StoryStep
|
||||
|
||||
func get_story_step() -> StoryStep:
|
||||
return get_all_story_steps()[story_step_i]
|
||||
@abstract func get_story_progression() -> float
|
||||
|
||||
func next_story_step() -> void:
|
||||
get_story_step()._on_finish()
|
||||
if story_step_i + 1 < len(get_all_story_steps()):
|
||||
story_step_i += 1
|
||||
@abstract func next_story_step() -> void
|
||||
|
||||
func get_available_mutations() -> Array[PlantMutation]:
|
||||
return get_all_mutations().slice(0, mutations_unlocked)
|
||||
@abstract func get_available_mutations() -> Array[PlantMutation]
|
||||
|
||||
@abstract func are_all_mutations_unlocked() -> bool
|
||||
|
||||
@abstract func discover_mutation(_pm : PlantMutation) -> void
|
||||
|
||||
@abstract func get_mutations_discovered() -> Array[String]
|
||||
|
||||
@abstract func unlock_new_mutation() -> PlantMutation
|
||||
|
||||
func get_all_mutations() -> Array[PlantMutation]:
|
||||
return [
|
||||
@@ -49,7 +49,6 @@ func get_all_artifacts() -> Array[Artefact]:
|
||||
TalionSoilArtifact.new(),
|
||||
]
|
||||
|
||||
|
||||
func get_all_story_steps() -> Array[StoryStep]:
|
||||
return [
|
||||
TutorialStoryStep.new(),
|
||||
@@ -57,3 +56,7 @@ func get_all_story_steps() -> Array[StoryStep]:
|
||||
MercuryStoryStep.new(),
|
||||
BoreaStoryStep.new()
|
||||
]
|
||||
|
||||
func finish_run(run : RunData):
|
||||
run_number += 1
|
||||
best_run = max(best_run, run.level)
|
||||
|
||||
36
common/game_data/scripts/story/infinite_story_step.gd
Normal file
36
common/game_data/scripts/story/infinite_story_step.gd
Normal file
@@ -0,0 +1,36 @@
|
||||
@tool
|
||||
extends StoryStep
|
||||
class_name InfiniteStoryStep
|
||||
|
||||
var run_number := 0
|
||||
|
||||
func _init(
|
||||
_run_number := 0
|
||||
):
|
||||
run_number = _run_number
|
||||
|
||||
|
||||
func get_respawn_scene() -> Scene:
|
||||
return RelayBaseScene.new(
|
||||
"INFINITE_MODE",
|
||||
str(run_number),
|
||||
true
|
||||
)
|
||||
|
||||
func get_cave_occurence(_level : int) -> int:
|
||||
return 0
|
||||
|
||||
func is_region_sequence_infinite() -> bool:
|
||||
return true
|
||||
|
||||
func get_region_sequence_length() -> int:
|
||||
return 1000
|
||||
|
||||
func is_run_point_dangerous(level : int) -> bool:
|
||||
return level%6 == 0 and level != 0
|
||||
|
||||
func get_destination_text() -> String:
|
||||
return tr("INFINITE")
|
||||
|
||||
func get_destination_scene() -> Scene:
|
||||
return BoreaScene.new()
|
||||
@@ -0,0 +1 @@
|
||||
uid://bdonub7t01xmi
|
||||
@@ -12,6 +12,8 @@ func get_destination_scene() -> Scene:
|
||||
return BoreaScene.new()
|
||||
|
||||
func get_run_progress(level : int) -> int:
|
||||
if is_region_sequence_infinite():
|
||||
return 0
|
||||
return get_region_sequence_length() - level
|
||||
|
||||
func get_ship_dialog_path(_level : int, _ship_in_space := true) -> String:
|
||||
@@ -19,8 +21,13 @@ func get_ship_dialog_path(_level : int, _ship_in_space := true) -> String:
|
||||
#region ------------------ Run ------------------
|
||||
|
||||
func is_run_finished(level : int) -> bool:
|
||||
if is_region_sequence_infinite():
|
||||
return false
|
||||
return level == get_region_sequence_length() - 1
|
||||
|
||||
func is_region_sequence_infinite() -> bool:
|
||||
return false
|
||||
|
||||
func get_region_sequence_length() -> int:
|
||||
return 7
|
||||
|
||||
@@ -48,6 +55,8 @@ func get_charge_number(_level : int) -> int:
|
||||
return 10
|
||||
|
||||
func is_run_point_dangerous(level : int) -> bool:
|
||||
if is_region_sequence_infinite():
|
||||
return false
|
||||
return level == get_region_sequence_length() - 2
|
||||
|
||||
func get_objective_for_region(level : int) -> int:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@tool
|
||||
extends StoryStep
|
||||
class_name MercuryStoryStep
|
||||
|
||||
|
||||
36
common/game_data/scripts/story_progression_data.gd
Normal file
36
common/game_data/scripts/story_progression_data.gd
Normal file
@@ -0,0 +1,36 @@
|
||||
extends ProgressionData
|
||||
class_name StoryProgressionData
|
||||
|
||||
@export var planted_mutation_ids: Array[String] = []
|
||||
@export var story_step_i := 0
|
||||
@export var mutations_unlocked = 8
|
||||
|
||||
func get_story_step() -> StoryStep:
|
||||
return get_all_story_steps()[story_step_i]
|
||||
|
||||
func get_story_progression() -> float:
|
||||
return max(0,float(story_step_i)) / len(
|
||||
get_all_story_steps()
|
||||
)
|
||||
|
||||
func discover_mutation(pm : PlantMutation) -> void:
|
||||
planted_mutation_ids.append(pm.id)
|
||||
|
||||
func get_mutations_discovered() -> Array[String]:
|
||||
return planted_mutation_ids
|
||||
|
||||
func next_story_step() -> void:
|
||||
get_story_step()._on_finish()
|
||||
if story_step_i + 1 < len(get_all_story_steps()):
|
||||
story_step_i += 1
|
||||
|
||||
func get_available_mutations() -> Array[PlantMutation]:
|
||||
return get_all_mutations().slice(0, mutations_unlocked)
|
||||
|
||||
func are_all_mutations_unlocked() -> bool:
|
||||
return mutations_unlocked >= len(get_all_mutations())
|
||||
|
||||
func unlock_new_mutation() -> PlantMutation:
|
||||
var new_mutation = get_all_mutations()[mutations_unlocked]
|
||||
mutations_unlocked += 1
|
||||
return new_mutation
|
||||
1
common/game_data/scripts/story_progression_data.gd.uid
Normal file
1
common/game_data/scripts/story_progression_data.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://vcoy8pt780cl
|
||||
@@ -1,35 +1,62 @@
|
||||
extends Node
|
||||
|
||||
const SAVE_GAME_LOCATION = "user://stw_playtest_2_save.tres"
|
||||
const SAVE_NAME = "playtest_2"
|
||||
|
||||
const SAVE_STORY_GAME_LOCATION = "user://stw_%s_save.tres" % SAVE_NAME
|
||||
const SAVE_INFINTE_GAME_LOCATION = "user://stw_%s_infinite_save.tres" % SAVE_NAME
|
||||
const SAVE_SETTINGS_LOCATION = "user://stw_settings.tres"
|
||||
|
||||
signal game_loaded
|
||||
signal game_data_updated(g : GameData)
|
||||
|
||||
var game_mode_choosen := GameData.Mode.STORY
|
||||
|
||||
var game_data : GameData :
|
||||
set(v):
|
||||
game_data = v
|
||||
game_data_updated.emit(v)
|
||||
get():
|
||||
if game_mode_choosen == GameData.Mode.STORY:
|
||||
return story_game_data
|
||||
elif game_mode_choosen == GameData.Mode.INFINITE:
|
||||
return infinite_game_data
|
||||
return null
|
||||
|
||||
var story_game_data : GameData
|
||||
var infinite_game_data : GameData
|
||||
|
||||
var settings_data : SettingsData
|
||||
|
||||
var current_dialog_path : String
|
||||
|
||||
func load_game_data() -> GameData:
|
||||
game_data = null
|
||||
if ResourceLoader.exists(SAVE_GAME_LOCATION) and ResourceLoader.load(SAVE_GAME_LOCATION):
|
||||
game_data = ResourceLoader.load(SAVE_GAME_LOCATION).duplicate_deep()
|
||||
func load_story_game_data() -> GameData:
|
||||
story_game_data = null
|
||||
if ResourceLoader.exists(SAVE_STORY_GAME_LOCATION) and ResourceLoader.load(SAVE_STORY_GAME_LOCATION):
|
||||
story_game_data = ResourceLoader.load(SAVE_STORY_GAME_LOCATION).duplicate_deep()
|
||||
game_loaded.emit()
|
||||
|
||||
return game_data
|
||||
return story_game_data
|
||||
|
||||
func load_infinite_game_data() -> GameData:
|
||||
infinite_game_data = null
|
||||
if ResourceLoader.exists(SAVE_INFINTE_GAME_LOCATION) and ResourceLoader.load(SAVE_INFINTE_GAME_LOCATION):
|
||||
infinite_game_data = ResourceLoader.load(SAVE_INFINTE_GAME_LOCATION).duplicate_deep()
|
||||
|
||||
return infinite_game_data
|
||||
|
||||
func start_game_data():
|
||||
game_data = GameData.new()
|
||||
if game_mode_choosen == GameData.Mode.STORY:
|
||||
story_game_data = GameData.new(GameData.Mode.STORY)
|
||||
story_game_data.start_run()
|
||||
else:
|
||||
infinite_game_data = GameData.new(GameData.Mode.INFINITE)
|
||||
infinite_game_data.start_run()
|
||||
|
||||
save_game_data()
|
||||
|
||||
func save_game_data():
|
||||
if game_data:
|
||||
ResourceSaver.save(game_data, SAVE_GAME_LOCATION)
|
||||
if game_mode_choosen == GameData.Mode.STORY:
|
||||
if story_game_data:
|
||||
ResourceSaver.save(story_game_data, SAVE_STORY_GAME_LOCATION)
|
||||
elif game_mode_choosen == GameData.Mode.INFINITE:
|
||||
if infinite_game_data:
|
||||
ResourceSaver.save(infinite_game_data, SAVE_INFINTE_GAME_LOCATION)
|
||||
|
||||
func load_settings_data() -> SettingsData:
|
||||
if ResourceLoader.exists(SAVE_SETTINGS_LOCATION):
|
||||
@@ -45,7 +72,8 @@ func save_settings():
|
||||
ResourceSaver.save(settings_data, SAVE_SETTINGS_LOCATION)
|
||||
|
||||
func _init():
|
||||
load_game_data()
|
||||
load_story_game_data()
|
||||
load_infinite_game_data()
|
||||
load_settings_data()
|
||||
update_language_settings()
|
||||
update_video_settings()
|
||||
@@ -91,3 +119,5 @@ func update_inputs(s : SettingsData = settings_data):
|
||||
InputMap.action_erase_events(s.action_remapped[i])
|
||||
InputMap.action_add_event(s.action_remapped[i], s.input_remapped[i])
|
||||
|
||||
func has_unlocked_infinite_mode():
|
||||
return true
|
||||
35
common/icons/dots.svg
Normal file
35
common/icons/dots.svg
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
class="icon icon-tabler icons-tabler-outline icon-tabler-dots"
|
||||
version="1.1"
|
||||
id="svg4"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<path
|
||||
stroke="none"
|
||||
d="M0 0h24v24H0z"
|
||||
fill="none"
|
||||
id="path1" />
|
||||
<path
|
||||
d="M4 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"
|
||||
id="path2"
|
||||
style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-opacity:1" />
|
||||
<path
|
||||
d="M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"
|
||||
id="path3"
|
||||
style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-opacity:1" />
|
||||
<path
|
||||
d="M18 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"
|
||||
id="path4"
|
||||
style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-opacity:1" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 956 B |
43
common/icons/dots.svg.import
Normal file
43
common/icons/dots.svg.import
Normal file
@@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://elds8r780ted"
|
||||
path="res://.godot/imported/dots.svg-c5aaef419fc83aaf7bc0ae28dabbcd0f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/dots.svg"
|
||||
dest_files=["res://.godot/imported/dots.svg-c5aaef419fc83aaf7bc0ae28dabbcd0f.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
Reference in New Issue
Block a user