* Ajout des icônes dans les descriptions des mutations * QOL sur la fonctionnalité de drop d'item * Ajout des contrôles dans le tutoriel * Réécriture des dialogues d'intro et d'échec * Changements mineurs sur des dialogues et traduction * Les graines apparaissent avec déjà une mutation * Limitation du Talion autour de la station de recharge * Fix de l'ascenseur dans la base Astra * Ajout d'un effet visuel quand il n'y a plus d'énergie * Le nombre de graine apparrait désormais dans l'inspécteur de plantes * Ajout d'un petit icône de progrès de durée de vie de la plante au survol * Ajout d'une description de la signification des icônes dans le menu pause * La mutation éphémère réduit désormais la durée de vie de 1
145 lines
4.1 KiB
GDScript
145 lines
4.1 KiB
GDScript
extends Control
|
|
class_name Tutorial
|
|
|
|
const STEP_SCENE = preload("res://gui/game/tutorial/step_gui/step_gui.tscn")
|
|
|
|
signal succeded
|
|
|
|
var indicators : Array[InGameIndicator]
|
|
@export var player : Player
|
|
@export var region : Region
|
|
|
|
@onready var steps : Array[Step] = [
|
|
Step.new(
|
|
"MOVE_WITH_RIGHT_CLICK_OR_WASD",
|
|
(func ():
|
|
return player.global_position.distance_to(region.data.player_spawn) > 30)
|
|
),
|
|
Step.new(
|
|
"SELECT_ITEM_WITH_SCROLL_CLICK_OR_NUMBER",
|
|
(func ():
|
|
return player.data.inventory.current_item_ind != player.data.inventory.n_tools)
|
|
),
|
|
Step.new(
|
|
"LEFT_CLICK_TO_USE_ITEMS",
|
|
(func ():
|
|
return player.data.inventory.get_item() and Input.is_action_just_pressed("action"))
|
|
),
|
|
Step.new(
|
|
"USE_YOUR_DETECTOR_TO_FIND_THE_BATTERY",
|
|
(func ():
|
|
return player.position.distance_to(Vector2.ZERO) < 600)
|
|
),
|
|
Step.new(
|
|
"DIG_A_TALION_VEIN_WITH_SHOVEL",
|
|
(func ():
|
|
for e in region.entity_container.get_children():
|
|
if e is ItemObject and e.item is Seed:
|
|
return true
|
|
return false)
|
|
),
|
|
Step.new(
|
|
"TAKE_A_SEED_BY_CLICKING_ON_IT",
|
|
(func ():
|
|
return player.data.inventory.items.find_custom(
|
|
func(i:Item): return i is Seed
|
|
) != -1)
|
|
),
|
|
Step.new(
|
|
"DROP_SEED_WITH_KEY",
|
|
(func ():
|
|
return (
|
|
Input.is_action_pressed("drop"))
|
|
)
|
|
),
|
|
Step.new(
|
|
"PLANT_SEED_IN_FERTILE_ZONE",
|
|
(func ():
|
|
for e in region.entity_container.get_children():
|
|
if e is Plant:
|
|
return true
|
|
return false)
|
|
),
|
|
Step.new(
|
|
"RECHARGE_TO_PASS_DAYS",
|
|
(func ():
|
|
return region and region.data and region.data.charges != 10)
|
|
),
|
|
Step.new(
|
|
"GAIN_FIRST_PLANT_POINT",
|
|
(func ():
|
|
return region.data.get_score() != 0)
|
|
),
|
|
Step.new(
|
|
"HARVEST_A_MATURE_PLANT",
|
|
(func ():
|
|
for e in region.entity_container.get_children():
|
|
if e is Plant and e.harvested:
|
|
return true
|
|
return false)
|
|
),
|
|
]
|
|
|
|
func _ready():
|
|
if region and region.data and "tutorial" in region.data.flags:
|
|
setup_gui()
|
|
show()
|
|
else:
|
|
hide()
|
|
|
|
func setup_gui():
|
|
for s in %Steps.get_children():
|
|
s.queue_free()
|
|
|
|
for s in steps:
|
|
var new_step = STEP_SCENE.instantiate() as TutorialStepGui
|
|
new_step.suceeded = false
|
|
new_step.text = s.get_text()
|
|
%Steps.add_child(new_step)
|
|
|
|
|
|
func _process(_d):
|
|
if region and region.data and "tutorial" in region.data.flags and not GameInfo.game_data.tutorial_done:
|
|
var success = true
|
|
for i in len(steps):
|
|
var step := steps[i]
|
|
var step_gui := %Steps.get_children()[i] as TutorialStepGui
|
|
step_gui.visible = i == 0 or steps[i-1].succeeded
|
|
if step_gui.visible:
|
|
var old_succeeded = step.succeeded
|
|
step.update_succeeded()
|
|
if old_succeeded != step.succeeded: # Put a delay so two state don't collide
|
|
return
|
|
step_gui.suceeded = step.succeeded
|
|
if not step.succeeded:
|
|
success = false
|
|
if success:
|
|
finish_tutorial()
|
|
|
|
func finish_tutorial():
|
|
GameInfo.game_data.tutorial_done = true
|
|
region.data.state = RegionData.State.SUCCEEDED
|
|
region.data.update()
|
|
succeded.emit()
|
|
|
|
class Step:
|
|
|
|
var text : String : get = get_text
|
|
var is_step_over_callable : Callable
|
|
var succeeded = false
|
|
|
|
func _init(
|
|
_text : String = "",
|
|
_is_step_over_callable : Callable = (func():return false)
|
|
):
|
|
text = _text
|
|
is_step_over_callable = _is_step_over_callable
|
|
|
|
func get_text() -> String:
|
|
return text
|
|
|
|
func update_succeeded() -> bool:
|
|
if not succeeded:
|
|
succeeded = is_step_over_callable.call()
|
|
return succeeded
|