Touches utilisant leur nom local + noms des touches dans le tuto + correction audio settings

This commit is contained in:
Altaezio
2026-07-24 12:19:36 +02:00
parent bb0424d67e
commit 896a92edfe
4 changed files with 110 additions and 77 deletions
@@ -235,7 +235,7 @@ func _ready():
player.stop() player.stop()
fetch_default_volumes() fetch_default_volumes()
# setup_players_bus() setup_players_bus()
settings.sound_changed.connect( settings.sound_changed.connect(
func(_s) : setup_players_bus() func(_s) : setup_players_bus()
) )
+64 -34
View File
@@ -5,28 +5,36 @@ const STEP_SCENE = preload("res://gui/game/tutorial/step_gui/step_gui.tscn")
signal succeded signal succeded
var indicators : Array[InGameIndicator] var indicators: Array[InGameIndicator]
var player : Player var player: Player
var region : Region var region: Region
var game_gui : GameGui var game_gui: GameGui
var success = false var success = false
@onready var steps : Array[Step] = [ @onready var steps: Array[Step] = [
Step.new( Step.new(
"MOVE_WITH_RIGHT_CLICK_OR_WASD", tr("MOVE_WITH_RIGHT_CLICK_OR_WASD").format({
(func (): "W": get_action_key_name("move_up"),
"A": get_action_key_name("move_left"),
"S": get_action_key_name("move_down"),
"D": get_action_key_name("move_right")
}),
(func():
return player.global_position.distance_to(region.data.player_spawn) > 30) return player.global_position.distance_to(region.data.player_spawn) > 30)
), ),
Step.new( Step.new(
"CHANGE_ZOOM_WITH_Z_X", tr("CHANGE_ZOOM_WITH_Z_X").format({
(func (): "Z": get_action_key_name("zoom_in"),
"X": get_action_key_name("zoom_out")
}),
(func():
return GameInfo.settings_data.zoom != 1.), return GameInfo.settings_data.zoom != 1.),
(func (): GameInfo.game_data.player_data.inventory.add_item(Detector.new())) (func(): GameInfo.game_data.player_data.inventory.add_item(Detector.new()))
), ),
Step.new( Step.new(
"SELECT_ITEM_WITH_SCROLL_CLICK_OR_NUMBER", "SELECT_ITEM_WITH_SCROLL_CLICK_OR_NUMBER",
(func (): (func():
return player.data.inventory.current_item_ind != player.data.inventory.tools.size()) return player.data.inventory.current_item_ind != player.data.inventory.tools.size())
), ),
Step.new( Step.new(
@@ -36,14 +44,14 @@ var success = false
), ),
Step.new( Step.new(
"USE_YOUR_DETECTOR_TO_FIND_THE_BATTERY", "USE_YOUR_DETECTOR_TO_FIND_THE_BATTERY",
(func (): (func():
return player.position.distance_to(Vector2.ZERO) < 600) return player.position.distance_to(Vector2.ZERO) < 600)
), ),
Step.new( Step.new(
"RECHARGE_IN_THE_RECHARGE_STATION", "RECHARGE_IN_THE_RECHARGE_STATION",
(func (): (func():
return region and region.data and not region.data.in_passing_day_animation and region.data.day != 1), return region and region.data and not region.data.in_passing_day_animation and region.data.day != 1),
(func (): (func():
game_gui.show_energy() game_gui.show_energy()
game_gui.show_help() game_gui.show_help()
game_gui.help.display_energy_tutorial() game_gui.help.display_energy_tutorial()
@@ -52,7 +60,7 @@ var success = false
), ),
Step.new( Step.new(
"DIG_A_TALION_VEIN_WITH_SHOVEL", "DIG_A_TALION_VEIN_WITH_SHOVEL",
(func (): (func():
for e in region.entity_container.get_children(): for e in region.entity_container.get_children():
if e is ItemObject and e.item is Seed: if e is ItemObject and e.item is Seed:
return true return true
@@ -60,21 +68,23 @@ var success = false
), ),
Step.new( Step.new(
"TAKE_A_SEED_BY_CLICKING_ON_IT", "TAKE_A_SEED_BY_CLICKING_ON_IT",
(func (): (func():
return player.data.inventory.seeds.find_custom( return player.data.inventory.seeds.find_custom(
func(i:Item): return i is Seed func(i: Item): return i is Seed
) != -1) ) != -1)
), ),
Step.new( Step.new(
"DROP_SEED_WITH_KEY", tr("DROP_SEED_WITH_KEY").format({
(func (): "Q": get_action_key_name("drop")
}),
(func():
return ( return (
Input.is_action_pressed("drop")) Input.is_action_pressed("drop"))
) )
), ),
Step.new( Step.new(
"PLANT_SEED_IN_FERTILE_ZONE", "PLANT_SEED_IN_FERTILE_ZONE",
(func (): (func():
for e in region.entity_container.get_children(): for e in region.entity_container.get_children():
if e is Plant: if e is Plant:
game_gui.help.display_plant_info_tutorial(e.card_info()) game_gui.help.display_plant_info_tutorial(e.card_info())
@@ -83,13 +93,13 @@ var success = false
), ),
Step.new( Step.new(
"WAIT_FOR_THE_PLANT_MATURATION", "WAIT_FOR_THE_PLANT_MATURATION",
(func (): (func():
return region and region.data and not region.data.in_passing_day_animation and region.data.get_score() != 0), return region and region.data and not region.data.in_passing_day_animation and region.data.get_score() != 0),
(func (): GameInfo.game_data.player_data.inventory.add_item(Fork.new())) (func(): GameInfo.game_data.player_data.inventory.add_item(Fork.new()))
), ),
Step.new( Step.new(
"HARVEST_A_MATURE_PLANT", "HARVEST_A_MATURE_PLANT",
(func (): (func():
for e in region.entity_container.get_children(): for e in region.entity_container.get_children():
if e is Plant and e.harvested: if e is Plant and e.harvested:
return true return true
@@ -97,20 +107,20 @@ var success = false
), ),
Step.new( Step.new(
"TAKE_HARVESTED_SEEDS", "TAKE_HARVESTED_SEEDS",
(func (): (func():
for s in player.data.inventory.seeds: for s in player.data.inventory.seeds:
if s is Seed and len(s.plant_mutations) > 0: if s is Seed and len(s.plant_mutations) > 0:
game_gui.help.display_mutations_tutorial(s.card_info()) game_gui.help.display_mutations_tutorial(s.card_info())
return true return true
return false), return false),
(func (): (func():
await game_gui.help.tutorial_passed await game_gui.help.tutorial_passed
game_gui.show_progress_bar() game_gui.show_progress_bar()
game_gui.help.display_plant_point_tutorial()) game_gui.help.display_plant_point_tutorial())
), ),
Step.new( Step.new(
"HAVE_3_PLANT_POINTS_SIMULTANEOUSLY", "HAVE_3_PLANT_POINTS_SIMULTANEOUSLY",
(func (): return region.data.get_score() >= 3) (func(): return region.data.get_score() >= 3)
), ),
] ]
@@ -141,7 +151,7 @@ func _process(_d):
for i in len(steps): for i in len(steps):
var step := steps[i] var step := steps[i]
var step_gui := %Steps.get_children()[i] as TutorialStepGui var step_gui := %Steps.get_children()[i] as TutorialStepGui
step_gui.visible = i == 0 or steps[i-1].succeeded step_gui.visible = i == 0 or steps[i - 1].succeeded
if step_gui.visible: if step_gui.visible:
var old_succeeded = step.succeeded var old_succeeded = step.succeeded
step.update_succeeded() step.update_succeeded()
@@ -162,16 +172,15 @@ func finish_tutorial():
SteamConnection.unlock_achievement(SteamConnection.ACH_FINISH_TUTORIAL) SteamConnection.unlock_achievement(SteamConnection.ACH_FINISH_TUTORIAL)
class Step: class Step:
var text: String: get = get_text
var text : String : get = get_text var is_step_over_callable: Callable
var is_step_over_callable : Callable var on_succeeded: Callable
var on_succeeded : Callable
var succeeded = false var succeeded = false
func _init( func _init(
_text : String = "", _text: String = "",
_is_step_over_callable : Callable = (func():return false), _is_step_over_callable: Callable = (func(): return false),
_on_succeeded : Callable = (func():return false) _on_succeeded: Callable = (func(): return false)
): ):
text = _text text = _text
is_step_over_callable = _is_step_over_callable is_step_over_callable = _is_step_over_callable
@@ -186,3 +195,24 @@ class Step:
if succeeded: if succeeded:
on_succeeded.call() on_succeeded.call()
return succeeded return succeeded
func get_action_key_name(action_name: String) -> String:
var events: Array[InputEvent] = InputMap.action_get_events(action_name)
var saved_remapped_input = null
var existing_remapped_id: int = GameInfo.settings_data.action_remapped.find(action_name)
if existing_remapped_id != -1:
saved_remapped_input = GameInfo.settings_data.input_remapped[existing_remapped_id]
var event: InputEvent = null
if saved_remapped_input:
event = saved_remapped_input
else:
event = null if events.size() == 0 else events[0]
var input_name: String = "UNASSIGNED" if event == null else event.as_text()
if event is InputEventKey:
var keycode = DisplayServer.keyboard_get_keycode_from_physical(event.physical_keycode)
input_name = OS.get_keycode_string(keycode)
return input_name
+42 -39
View File
@@ -8,54 +8,57 @@ var event : InputEvent = null
var is_remapping := false var is_remapping := false
@export var action_name : String : @export var action_name : String :
set(v): set(v):
action_name = v action_name = v
var events : Array[InputEvent] = InputMap.action_get_events(action_name) var events : Array[InputEvent] = InputMap.action_get_events(action_name)
var saved_remapped_input = get_remapped_input() var saved_remapped_input = get_remapped_input()
if saved_remapped_input : if saved_remapped_input :
event = saved_remapped_input event = saved_remapped_input
else : else :
event = null if events.size() == 0 else events[0] event = null if events.size() == 0 else events[0]
update() update()
func update(): func update():
%Text.text = action_name.to_upper() %Text.text = action_name.to_upper()
var input_name = "UNASSIGNED" if event == null else event.as_text() var input_name: String = "UNASSIGNED" if event == null else event.as_text()
if input_name.length() > MAX_INPUT_NAME: if event is InputEventKey:
input_name = input_name.substr(0,MAX_INPUT_NAME) + "..." var keycode = DisplayServer.keyboard_get_keycode_from_physical(event.physical_keycode)
%Button.text = input_name input_name = OS.get_keycode_string(keycode)
# (%Button as Button).add_theme_color_override("font_color", Color.RED if ) if input_name.length() > MAX_INPUT_NAME:
input_name = input_name.substr(0,MAX_INPUT_NAME) + "..."
%Button.text = input_name
# (%Button as Button).add_theme_color_override("font_color", Color.RED if )
func _input(new_event): func _input(new_event):
if is_remapping: if is_remapping:
if ( if (
new_event is InputEventKey or (new_event is InputEventMouseButton and new_event.is_pressed()) new_event is InputEventKey or (new_event is InputEventMouseButton and new_event.is_pressed())
): ):
is_remapping = false is_remapping = false
event = new_event event = new_event
save_remapped_input(event) save_remapped_input(event)
GameInfo.update_inputs() GameInfo.update_inputs()
update() update()
func get_remapped_input() -> InputEvent: func get_remapped_input() -> InputEvent:
var existing_remapped_id : int = GameInfo.settings_data.action_remapped.find(action_name) var existing_remapped_id : int = GameInfo.settings_data.action_remapped.find(action_name)
if existing_remapped_id != -1: if existing_remapped_id != -1:
return GameInfo.settings_data.input_remapped[existing_remapped_id] return GameInfo.settings_data.input_remapped[existing_remapped_id]
return null return null
func save_remapped_input(e : InputEvent = event): func save_remapped_input(e : InputEvent = event):
var existing_remapped_id : int = GameInfo.settings_data.action_remapped.find(action_name) var existing_remapped_id : int = GameInfo.settings_data.action_remapped.find(action_name)
if existing_remapped_id != -1: if existing_remapped_id != -1:
GameInfo.settings_data.action_remapped.remove_at(existing_remapped_id) GameInfo.settings_data.action_remapped.remove_at(existing_remapped_id)
GameInfo.settings_data.input_remapped.remove_at(existing_remapped_id) GameInfo.settings_data.input_remapped.remove_at(existing_remapped_id)
GameInfo.settings_data.action_remapped.push_back(action_name) GameInfo.settings_data.action_remapped.push_back(action_name)
GameInfo.settings_data.input_remapped.push_back(e) GameInfo.settings_data.input_remapped.push_back(e)
func _on_button_button_down(): func _on_button_button_down():
if !is_remapping: if !is_remapping:
is_remapping = true is_remapping = true
%Button.text = "PRESS_KEY" %Button.text = "PRESS_KEY"
+3 -3
View File
@@ -137,12 +137,12 @@ OPEN,Open,Ouvrir
%s_SEED,%s Seed,Graine de %s %s_SEED,%s Seed,Graine de %s
PLANT_%s_MUST_BE_USED_IN_DECONTAMINATED_ZONE,Plant [b]%s[/b]. Must be used in the fertile zone.,Plante [b]%s[/b]. Doit être utilisée dans la zone fertile. PLANT_%s_MUST_BE_USED_IN_DECONTAMINATED_ZONE,Plant [b]%s[/b]. Must be used in the fertile zone.,Plante [b]%s[/b]. Doit être utilisée dans la zone fertile.
PLANT_%s,Plant [b]%s[/b],Planter [b]%s[/b] PLANT_%s,Plant [b]%s[/b],Planter [b]%s[/b]
MOVE_WITH_RIGHT_CLICK_OR_WASD,"Move with right click or WASD","Déplace-toi avec le clic droit ou ZQSD" MOVE_WITH_RIGHT_CLICK_OR_WASD,"Move with right click or {W}{A}{S}{D}","Déplace-toi avec clic droit ou {W}{A}{S}{D}"
INTERACT_WITH_LEFT_CLICK,"Interact with left click","Interagis avec le clic gauche" INTERACT_WITH_LEFT_CLICK,"Interact with left click","Interagis avec le clic gauche"
CHANGE_ZOOM_WITH_Z_X,"Change the zoom with Z and X","Changez le zoom avec W et X" CHANGE_ZOOM_WITH_Z_X,"Change the zoom with {Z} and {X}","Changez le zoom avec {Z} et {X}"
SELECT_ITEM_WITH_SCROLL_CLICK_OR_NUMBER,"Select an item in your toolbar with the mouse wheel or by clicking on it","Sélectionne un item dans ta barre d'outil en utilisant la molette ou en cliquant dessus" SELECT_ITEM_WITH_SCROLL_CLICK_OR_NUMBER,"Select an item in your toolbar with the mouse wheel or by clicking on it","Sélectionne un item dans ta barre d'outil en utilisant la molette ou en cliquant dessus"
LEFT_CLICK_TO_USE_ITEMS,"Use an item with left click","Utilise un item avec le clic gauche" LEFT_CLICK_TO_USE_ITEMS,"Use an item with left click","Utilise un item avec le clic gauche"
DROP_SEED_WITH_KEY,"Drop current item with Q","Lâche l'item sélectionné avec A" DROP_SEED_WITH_KEY,"Drop current item with {Q}","Lâche l'item sélectionné avec {Q}"
USE_YOUR_DETECTOR_TO_FIND_THE_BATTERY,Use your [b]Detector[/b] to find the [b]Recharge station[/b],Utilise ton [b]Détecteur[/b] pour trouver la [b]Station de recharge[/b] USE_YOUR_DETECTOR_TO_FIND_THE_BATTERY,Use your [b]Detector[/b] to find the [b]Recharge station[/b],Utilise ton [b]Détecteur[/b] pour trouver la [b]Station de recharge[/b]
RECHARGE_IN_THE_RECHARGE_STATION,Recharge on the [b]Recharge station[/b] to pass the day,Se recharger sur la [b]Station de recharge[/b] pour passer la journée RECHARGE_IN_THE_RECHARGE_STATION,Recharge on the [b]Recharge station[/b] to pass the day,Se recharger sur la [b]Station de recharge[/b] pour passer la journée
TAKE_A_SEED_BY_CLICKING_ON_IT,Take a [b]Seed[/b] by clicking or moving over it,Prend une [b]Graine[/b] en cliquant ou en passant dessus TAKE_A_SEED_BY_CLICKING_ON_IT,Take a [b]Seed[/b] by clicking or moving over it,Prend une [b]Graine[/b] en cliquant ou en passant dessus
1 keys en fr
137 %s_SEED %s Seed Graine de %s
138 PLANT_%s_MUST_BE_USED_IN_DECONTAMINATED_ZONE Plant [b]%s[/b]. Must be used in the fertile zone. Plante [b]%s[/b]. Doit être utilisée dans la zone fertile.
139 PLANT_%s Plant [b]%s[/b] Planter [b]%s[/b]
140 MOVE_WITH_RIGHT_CLICK_OR_WASD Move with right click or WASD Move with right click or {W}{A}{S}{D} Déplace-toi avec le clic droit ou ZQSD Déplace-toi avec clic droit ou {W}{A}{S}{D}
141 INTERACT_WITH_LEFT_CLICK Interact with left click Interagis avec le clic gauche
142 CHANGE_ZOOM_WITH_Z_X Change the zoom with Z and X Change the zoom with {Z} and {X} Changez le zoom avec W et X Changez le zoom avec {Z} et {X}
143 SELECT_ITEM_WITH_SCROLL_CLICK_OR_NUMBER Select an item in your toolbar with the mouse wheel or by clicking on it Sélectionne un item dans ta barre d'outil en utilisant la molette ou en cliquant dessus
144 LEFT_CLICK_TO_USE_ITEMS Use an item with left click Utilise un item avec le clic gauche
145 DROP_SEED_WITH_KEY Drop current item with Q Drop current item with {Q} Lâche l'item sélectionné avec A Lâche l'item sélectionné avec {Q}
146 USE_YOUR_DETECTOR_TO_FIND_THE_BATTERY Use your [b]Detector[/b] to find the [b]Recharge station[/b] Utilise ton [b]Détecteur[/b] pour trouver la [b]Station de recharge[/b]
147 RECHARGE_IN_THE_RECHARGE_STATION Recharge on the [b]Recharge station[/b] to pass the day Se recharger sur la [b]Station de recharge[/b] pour passer la journée
148 TAKE_A_SEED_BY_CLICKING_ON_IT Take a [b]Seed[/b] by clicking or moving over it Prend une [b]Graine[/b] en cliquant ou en passant dessus