From 1d8fa9c44dbc8a441e6c427c4e655aa9b2fa6d5d Mon Sep 17 00:00:00 2001 From: Yaxian Date: Thu, 2 Oct 2025 12:33:27 +0800 Subject: [PATCH] Add player_state dictionary to manage player state names for FSM demo (#1143) * Add player_state dictionary to manage player state names for FSM demo * Use a constant typed Dictionary of StringNames and update to Godot 4.5 --------- Co-authored-by: Aaron Franke --- 2d/finite_state_machine/Demo.tscn | 2 +- .../debug/states_stack_displayer.gd.uid | 2 +- .../fonts/SourceCodePro-Bold.ttf.import | 1 + 2d/finite_state_machine/icon.webp.import | 6 +++++ .../player/body.png.import | 6 +++++ .../player/bullet/bullet.gd.uid | 2 +- .../player/bullet/bullet_spawner.gd | 4 ++-- .../player/bullet/bullet_spawner.gd.uid | 2 +- .../player/player_controller.gd.uid | 2 +- .../player/player_state.gd | 13 ++++++++++ .../player/player_state.gd.uid | 1 + .../player/player_state_machine.gd | 24 ++++++++++--------- .../player/player_state_machine.gd.uid | 2 +- .../player/shadow.png.import | 6 +++++ .../player/states/combat/attack.gd | 6 ++--- .../player/states/combat/attack.gd.uid | 2 +- .../player/states/combat/stagger.gd | 8 +++---- .../player/states/combat/stagger.gd.uid | 2 +- .../states/debug/state_name_displayer.gd.uid | 2 +- 2d/finite_state_machine/player/states/die.gd | 6 ++--- .../player/states/die.gd.uid | 2 +- .../player/states/motion/in_air/jump.gd | 4 ++-- .../player/states/motion/in_air/jump.gd.uid | 2 +- .../player/states/motion/motion.gd | 8 +++---- .../player/states/motion/motion.gd.uid | 2 +- .../player/states/motion/on_ground/idle.gd | 8 +++---- .../states/motion/on_ground/idle.gd.uid | 2 +- .../player/states/motion/on_ground/move.gd | 8 +++---- .../states/motion/on_ground/move.gd.uid | 2 +- .../states/motion/on_ground/on_ground.gd | 8 +++---- .../states/motion/on_ground/on_ground.gd.uid | 2 +- .../player/weapon/sword.gd | 4 ++-- .../player/weapon/sword.gd.uid | 2 +- .../player/weapon/sword.png.import | 6 +++++ .../player/weapon/weapon_pivot.gd.uid | 2 +- 2d/finite_state_machine/project.godot | 2 +- .../state_machine/state.gd | 4 ++-- .../state_machine/state.gd.uid | 2 +- .../state_machine/state_machine.gd | 4 ++-- .../state_machine/state_machine.gd.uid | 2 +- 40 files changed, 108 insertions(+), 67 deletions(-) create mode 100644 2d/finite_state_machine/player/player_state.gd create mode 100644 2d/finite_state_machine/player/player_state.gd.uid diff --git a/2d/finite_state_machine/Demo.tscn b/2d/finite_state_machine/Demo.tscn index f758816b..1f31afd9 100644 --- a/2d/finite_state_machine/Demo.tscn +++ b/2d/finite_state_machine/Demo.tscn @@ -41,7 +41,7 @@ start_state = NodePath("Idle") [node name="AnimationPlayer" parent="Player" index="1"] libraries = { -"": SubResource("AnimationLibrary_qbwwp") +&"": SubResource("AnimationLibrary_qbwwp") } [node name="StateNameDisplayer" parent="Player" index="5"] diff --git a/2d/finite_state_machine/debug/states_stack_displayer.gd.uid b/2d/finite_state_machine/debug/states_stack_displayer.gd.uid index a7d0f1d9..a900ff80 100644 --- a/2d/finite_state_machine/debug/states_stack_displayer.gd.uid +++ b/2d/finite_state_machine/debug/states_stack_displayer.gd.uid @@ -1 +1 @@ -uid://8e5wvxrlv1ct +uid://h4p2eq3snhjs diff --git a/2d/finite_state_machine/fonts/SourceCodePro-Bold.ttf.import b/2d/finite_state_machine/fonts/SourceCodePro-Bold.ttf.import index 57452390..25ea396c 100644 --- a/2d/finite_state_machine/fonts/SourceCodePro-Bold.ttf.import +++ b/2d/finite_state_machine/fonts/SourceCodePro-Bold.ttf.import @@ -21,6 +21,7 @@ msdf_pixel_range=8 msdf_size=48 allow_system_fallback=true force_autohinter=false +modulate_color_glyphs=false hinting=1 subpixel_positioning=1 keep_rounding_remainders=true diff --git a/2d/finite_state_machine/icon.webp.import b/2d/finite_state_machine/icon.webp.import index cc29159c..6d517c78 100644 --- a/2d/finite_state_machine/icon.webp.import +++ b/2d/finite_state_machine/icon.webp.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ct 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 @@ -25,6 +27,10 @@ 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 diff --git a/2d/finite_state_machine/player/body.png.import b/2d/finite_state_machine/player/body.png.import index 9630a52b..df7abc93 100644 --- a/2d/finite_state_machine/player/body.png.import +++ b/2d/finite_state_machine/player/body.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/body.png-313f6363670a5852a7b7126ab476d8b1.cte 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 @@ -25,6 +27,10 @@ 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 diff --git a/2d/finite_state_machine/player/bullet/bullet.gd.uid b/2d/finite_state_machine/player/bullet/bullet.gd.uid index 4a227fa9..12663896 100644 --- a/2d/finite_state_machine/player/bullet/bullet.gd.uid +++ b/2d/finite_state_machine/player/bullet/bullet.gd.uid @@ -1 +1 @@ -uid://crm4tdogdpumr +uid://b44c6s1shm5f7 diff --git a/2d/finite_state_machine/player/bullet/bullet_spawner.gd b/2d/finite_state_machine/player/bullet/bullet_spawner.gd index 61105e2b..2f3d063d 100644 --- a/2d/finite_state_machine/player/bullet/bullet_spawner.gd +++ b/2d/finite_state_machine/player/bullet/bullet_spawner.gd @@ -2,8 +2,8 @@ extends Node2D var bullet := preload("Bullet.tscn") -func _unhandled_input(event: InputEvent) -> void: - if event.is_action_pressed("fire"): +func _unhandled_input(input_event: InputEvent) -> void: + if input_event.is_action_pressed("fire"): fire() diff --git a/2d/finite_state_machine/player/bullet/bullet_spawner.gd.uid b/2d/finite_state_machine/player/bullet/bullet_spawner.gd.uid index 6f8dc99a..32f29614 100644 --- a/2d/finite_state_machine/player/bullet/bullet_spawner.gd.uid +++ b/2d/finite_state_machine/player/bullet/bullet_spawner.gd.uid @@ -1 +1 @@ -uid://duw4ejcjfrp7o +uid://toean0857ojh diff --git a/2d/finite_state_machine/player/player_controller.gd.uid b/2d/finite_state_machine/player/player_controller.gd.uid index 96667de5..98c92414 100644 --- a/2d/finite_state_machine/player/player_controller.gd.uid +++ b/2d/finite_state_machine/player/player_controller.gd.uid @@ -1 +1 @@ -uid://clya0ymtv6cnn +uid://bctcyb2y6vuvd diff --git a/2d/finite_state_machine/player/player_state.gd b/2d/finite_state_machine/player/player_state.gd new file mode 100644 index 00000000..9ed2c1c7 --- /dev/null +++ b/2d/finite_state_machine/player/player_state.gd @@ -0,0 +1,13 @@ +extends "res://state_machine/state.gd" + +const PLAYER_STATE: Dictionary[StringName, StringName]= { + &"previous": &"previous", + &"jump": &"jump", + &"idle": &"idle", + &"move": &"move", + &"stagger": &"stagger", + &"attack": &"attack", + &"die": &"die", + &"dead": &"dead", + &"walk": &"walk", +} diff --git a/2d/finite_state_machine/player/player_state.gd.uid b/2d/finite_state_machine/player/player_state.gd.uid new file mode 100644 index 00000000..7a1c179c --- /dev/null +++ b/2d/finite_state_machine/player/player_state.gd.uid @@ -0,0 +1 @@ +uid://de3fjmahdmo0r diff --git a/2d/finite_state_machine/player/player_state_machine.gd b/2d/finite_state_machine/player/player_state_machine.gd index 369ee269..39ce4ee1 100644 --- a/2d/finite_state_machine/player/player_state_machine.gd +++ b/2d/finite_state_machine/player/player_state_machine.gd @@ -1,5 +1,7 @@ extends "res://state_machine/state_machine.gd" +var PLAYER_STATE = preload("res://player/player_state.gd").PLAYER_STATE + @onready var idle: Node = $Idle @onready var move: Node = $Move @onready var jump: Node = $Jump @@ -8,11 +10,11 @@ extends "res://state_machine/state_machine.gd" func _ready() -> void: states_map = { - "idle": idle, - "move": move, - "jump": jump, - "stagger": stagger, - "attack": attack, + PLAYER_STATE.idle: idle, + PLAYER_STATE.move: move, + PLAYER_STATE.jump: jump, + PLAYER_STATE.stagger: stagger, + PLAYER_STATE.attack: attack, } @@ -20,21 +22,21 @@ func _change_state(state_name: String) -> void: # The base state_machine interface this node extends does most of the work. if not _active: return - if state_name in ["stagger", "jump", "attack"]: + if state_name in [PLAYER_STATE.stagger, PLAYER_STATE.jump, PLAYER_STATE.attack]: states_stack.push_front(states_map[state_name]) - if state_name == "jump" and current_state == move: + if state_name == PLAYER_STATE.jump and current_state == move: jump.initialize(move.speed, move.velocity) super._change_state(state_name) -func _unhandled_input(event: InputEvent) -> void: +func _unhandled_input(input_event: InputEvent) -> void: # Here we only handle input that can interrupt states, attacking in this case, # otherwise we let the state node handle it. - if event.is_action_pressed("attack"): + if input_event.is_action_pressed(PLAYER_STATE.attack): if current_state in [attack, stagger]: return - _change_state("attack") + _change_state(PLAYER_STATE.attack) return - current_state.handle_input(event) + current_state.handle_input(input_event) diff --git a/2d/finite_state_machine/player/player_state_machine.gd.uid b/2d/finite_state_machine/player/player_state_machine.gd.uid index f26342e3..8666540e 100644 --- a/2d/finite_state_machine/player/player_state_machine.gd.uid +++ b/2d/finite_state_machine/player/player_state_machine.gd.uid @@ -1 +1 @@ -uid://bt4prj2loisak +uid://c5dcvd5nvu0e0 diff --git a/2d/finite_state_machine/player/shadow.png.import b/2d/finite_state_machine/player/shadow.png.import index d8495776..86d854d2 100644 --- a/2d/finite_state_machine/player/shadow.png.import +++ b/2d/finite_state_machine/player/shadow.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/shadow.png-493c4635eca1ce8bdece629560617dc7.c 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 @@ -25,6 +27,10 @@ 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 diff --git a/2d/finite_state_machine/player/states/combat/attack.gd b/2d/finite_state_machine/player/states/combat/attack.gd index 917b3871..1c31cb07 100644 --- a/2d/finite_state_machine/player/states/combat/attack.gd +++ b/2d/finite_state_machine/player/states/combat/attack.gd @@ -1,8 +1,8 @@ -extends "res://state_machine/state.gd" +extends "res://player/player_state.gd" func enter() -> void: - owner.get_node(^"AnimationPlayer").play("idle") + owner.get_node(^"AnimationPlayer").play(PLAYER_STATE.idle) func _on_Sword_attack_finished() -> void: - finished.emit("previous") + finished.emit(PLAYER_STATE.previous) diff --git a/2d/finite_state_machine/player/states/combat/attack.gd.uid b/2d/finite_state_machine/player/states/combat/attack.gd.uid index 92efe8fe..cf97f208 100644 --- a/2d/finite_state_machine/player/states/combat/attack.gd.uid +++ b/2d/finite_state_machine/player/states/combat/attack.gd.uid @@ -1 +1 @@ -uid://bianktk6rvu15 +uid://d2qmapjilk64d diff --git a/2d/finite_state_machine/player/states/combat/stagger.gd b/2d/finite_state_machine/player/states/combat/stagger.gd index 80f4d968..c7e1e35d 100644 --- a/2d/finite_state_machine/player/states/combat/stagger.gd +++ b/2d/finite_state_machine/player/states/combat/stagger.gd @@ -1,12 +1,12 @@ -extends "res://state_machine/state.gd" +extends "res://player/player_state.gd" # The stagger state end with the stagger animation from the AnimationPlayer. # The animation only affects the Body Sprite2D's modulate property so it # could stack with other animations if we had two AnimationPlayer nodes. func enter() -> void: - owner.get_node(^"AnimationPlayer").play("stagger") + owner.get_node(^"AnimationPlayer").play(PLAYER_STATE.stagger) func _on_animation_finished(anim_name: String) -> void: - assert(anim_name == "stagger") - finished.emit("previous") + assert(anim_name == PLAYER_STATE.stagger) + finished.emit(PLAYER_STATE.previous) diff --git a/2d/finite_state_machine/player/states/combat/stagger.gd.uid b/2d/finite_state_machine/player/states/combat/stagger.gd.uid index cf89424d..2bcbce67 100644 --- a/2d/finite_state_machine/player/states/combat/stagger.gd.uid +++ b/2d/finite_state_machine/player/states/combat/stagger.gd.uid @@ -1 +1 @@ -uid://bdx6kcg1n8na3 +uid://c5kuv4fn7sjn diff --git a/2d/finite_state_machine/player/states/debug/state_name_displayer.gd.uid b/2d/finite_state_machine/player/states/debug/state_name_displayer.gd.uid index 80943706..ce16b59d 100644 --- a/2d/finite_state_machine/player/states/debug/state_name_displayer.gd.uid +++ b/2d/finite_state_machine/player/states/debug/state_name_displayer.gd.uid @@ -1 +1 @@ -uid://dgpfeu3yan7hq +uid://qc5os1n5tx4u diff --git a/2d/finite_state_machine/player/states/die.gd b/2d/finite_state_machine/player/states/die.gd index 5a4a255a..1f242bdc 100644 --- a/2d/finite_state_machine/player/states/die.gd +++ b/2d/finite_state_machine/player/states/die.gd @@ -1,10 +1,10 @@ -extends "res://state_machine/state.gd" +extends "res://player/player_state.gd" # Initialize the state. E.g. change the animation. func enter() -> void: owner.set_dead(true) - owner.get_node(^"AnimationPlayer").play("die") + owner.get_node(^"AnimationPlayer").play(PLAYER_STATE.die) func _on_animation_finished(_anim_name: String) -> void: - finished.emit("dead") + finished.emit(PLAYER_STATE.dead) diff --git a/2d/finite_state_machine/player/states/die.gd.uid b/2d/finite_state_machine/player/states/die.gd.uid index 0db4c1db..1e18e2a4 100644 --- a/2d/finite_state_machine/player/states/die.gd.uid +++ b/2d/finite_state_machine/player/states/die.gd.uid @@ -1 +1 @@ -uid://badi2yipj0y74 +uid://dt2ivp7vxkcwu diff --git a/2d/finite_state_machine/player/states/motion/in_air/jump.gd b/2d/finite_state_machine/player/states/motion/in_air/jump.gd index cc42424a..00182015 100644 --- a/2d/finite_state_machine/player/states/motion/in_air/jump.gd +++ b/2d/finite_state_machine/player/states/motion/in_air/jump.gd @@ -36,7 +36,7 @@ func enter() -> void: horizontal_velocity = Vector2() vertical_speed = 600.0 - owner.get_node(^"AnimationPlayer").play("idle") + owner.get_node(^"AnimationPlayer").play(PLAYER_STATE.idle) func update(delta: float) -> void: @@ -46,7 +46,7 @@ func update(delta: float) -> void: move_horizontally(delta, input_direction) animate_jump_height(delta) if height <= 0.0: - finished.emit("previous") + finished.emit(PLAYER_STATE.previous) func move_horizontally(delta: float, direction: Vector2) -> void: diff --git a/2d/finite_state_machine/player/states/motion/in_air/jump.gd.uid b/2d/finite_state_machine/player/states/motion/in_air/jump.gd.uid index 222a10bf..e729f6d5 100644 --- a/2d/finite_state_machine/player/states/motion/in_air/jump.gd.uid +++ b/2d/finite_state_machine/player/states/motion/in_air/jump.gd.uid @@ -1 +1 @@ -uid://c3jdmjrutxlu3 +uid://dqcb4mauxmn6i diff --git a/2d/finite_state_machine/player/states/motion/motion.gd b/2d/finite_state_machine/player/states/motion/motion.gd index 19f2c559..b6e4dd46 100644 --- a/2d/finite_state_machine/player/states/motion/motion.gd +++ b/2d/finite_state_machine/player/states/motion/motion.gd @@ -1,9 +1,9 @@ -extends "res://state_machine/state.gd" +extends "res://player/player_state.gd" # Collection of important methods to handle direction and animation. -func handle_input(event: InputEvent) -> void: - if event.is_action_pressed("simulate_damage"): - finished.emit("stagger") +func handle_input(input_event: InputEvent) -> void: + if input_event.is_action_pressed("simulate_damage"): + finished.emit(PLAYER_STATE.stagger) func get_input_direction() -> Vector2: diff --git a/2d/finite_state_machine/player/states/motion/motion.gd.uid b/2d/finite_state_machine/player/states/motion/motion.gd.uid index 1883d675..2cc65462 100644 --- a/2d/finite_state_machine/player/states/motion/motion.gd.uid +++ b/2d/finite_state_machine/player/states/motion/motion.gd.uid @@ -1 +1 @@ -uid://bbwnftow50xk3 +uid://b1olwifehhkdo diff --git a/2d/finite_state_machine/player/states/motion/on_ground/idle.gd b/2d/finite_state_machine/player/states/motion/on_ground/idle.gd index 3cca0343..5b626ba9 100644 --- a/2d/finite_state_machine/player/states/motion/on_ground/idle.gd +++ b/2d/finite_state_machine/player/states/motion/on_ground/idle.gd @@ -1,14 +1,14 @@ extends "on_ground.gd" func enter() -> void: - owner.get_node(^"AnimationPlayer").play("idle") + owner.get_node(^"AnimationPlayer").play(PLAYER_STATE.idle) -func handle_input(event: InputEvent) -> void: - return super.handle_input(event) +func handle_input(input_event: InputEvent) -> void: + return super.handle_input(input_event) func update(_delta: float) -> void: var input_direction: Vector2 = get_input_direction() if input_direction: - finished.emit("move") + finished.emit(PLAYER_STATE.move) diff --git a/2d/finite_state_machine/player/states/motion/on_ground/idle.gd.uid b/2d/finite_state_machine/player/states/motion/on_ground/idle.gd.uid index 48cb3759..7f91258e 100644 --- a/2d/finite_state_machine/player/states/motion/on_ground/idle.gd.uid +++ b/2d/finite_state_machine/player/states/motion/on_ground/idle.gd.uid @@ -1 +1 @@ -uid://duqfhrergdg0p +uid://txngtvc75ll4 diff --git a/2d/finite_state_machine/player/states/motion/on_ground/move.gd b/2d/finite_state_machine/player/states/motion/on_ground/move.gd index b722b7f8..2c85d017 100644 --- a/2d/finite_state_machine/player/states/motion/on_ground/move.gd +++ b/2d/finite_state_machine/player/states/motion/on_ground/move.gd @@ -9,17 +9,17 @@ func enter() -> void: var input_direction := get_input_direction() update_look_direction(input_direction) - owner.get_node(^"AnimationPlayer").play("walk") + owner.get_node(^"AnimationPlayer").play(PLAYER_STATE.walk) -func handle_input(event: InputEvent) -> void: - return super.handle_input(event) +func handle_input(input_event: InputEvent) -> void: + return super.handle_input(input_event) func update(_delta: float) -> void: var input_direction := get_input_direction() if input_direction.is_zero_approx(): - finished.emit("idle") + finished.emit(PLAYER_STATE.idle) update_look_direction(input_direction) if Input.is_action_pressed("run"): diff --git a/2d/finite_state_machine/player/states/motion/on_ground/move.gd.uid b/2d/finite_state_machine/player/states/motion/on_ground/move.gd.uid index 100376dc..d326ea38 100644 --- a/2d/finite_state_machine/player/states/motion/on_ground/move.gd.uid +++ b/2d/finite_state_machine/player/states/motion/on_ground/move.gd.uid @@ -1 +1 @@ -uid://bprpybddlsqly +uid://qvf7gyuvbbd3 diff --git a/2d/finite_state_machine/player/states/motion/on_ground/on_ground.gd b/2d/finite_state_machine/player/states/motion/on_ground/on_ground.gd index 59c59c5a..bae36cc6 100644 --- a/2d/finite_state_machine/player/states/motion/on_ground/on_ground.gd +++ b/2d/finite_state_machine/player/states/motion/on_ground/on_ground.gd @@ -3,7 +3,7 @@ extends "../motion.gd" var speed := 0.0 var velocity := Vector2() -func handle_input(event: InputEvent) -> void: - if event.is_action_pressed("jump"): - finished.emit("jump") - return super.handle_input(event) +func handle_input(input_event: InputEvent) -> void: + if input_event.is_action_pressed("jump"): + finished.emit(PLAYER_STATE.jump) + return super.handle_input(input_event) diff --git a/2d/finite_state_machine/player/states/motion/on_ground/on_ground.gd.uid b/2d/finite_state_machine/player/states/motion/on_ground/on_ground.gd.uid index 0b2d7e23..71f2348e 100644 --- a/2d/finite_state_machine/player/states/motion/on_ground/on_ground.gd.uid +++ b/2d/finite_state_machine/player/states/motion/on_ground/on_ground.gd.uid @@ -1 +1 @@ -uid://qyf46nijd62s +uid://vj5xnepb8ost diff --git a/2d/finite_state_machine/player/weapon/sword.gd b/2d/finite_state_machine/player/weapon/sword.gd index f5410ee5..d34b3288 100644 --- a/2d/finite_state_machine/player/weapon/sword.gd +++ b/2d/finite_state_machine/player/weapon/sword.gd @@ -66,12 +66,12 @@ func _change_state(new_state: States) -> void: state = new_state -func _unhandled_input(event: InputEvent) -> void: +func _unhandled_input(input_event: InputEvent) -> void: if not state == States.ATTACK: return if attack_input_state != AttackInputStates.LISTENING: return - if event.is_action_pressed("attack"): + if input_event.is_action_pressed("attack"): attack_input_state = AttackInputStates.REGISTERED diff --git a/2d/finite_state_machine/player/weapon/sword.gd.uid b/2d/finite_state_machine/player/weapon/sword.gd.uid index baf4dd62..b163c658 100644 --- a/2d/finite_state_machine/player/weapon/sword.gd.uid +++ b/2d/finite_state_machine/player/weapon/sword.gd.uid @@ -1 +1 @@ -uid://1j2saaqxja3i +uid://bqq2dspaof34w diff --git a/2d/finite_state_machine/player/weapon/sword.png.import b/2d/finite_state_machine/player/weapon/sword.png.import index 534d90b6..bb09d394 100644 --- a/2d/finite_state_machine/player/weapon/sword.png.import +++ b/2d/finite_state_machine/player/weapon/sword.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/sword.png-fc7f0084cdf333c826eda2b33f2ec3cc.ct 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 @@ -25,6 +27,10 @@ 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 diff --git a/2d/finite_state_machine/player/weapon/weapon_pivot.gd.uid b/2d/finite_state_machine/player/weapon/weapon_pivot.gd.uid index 8f46b5bb..851eb583 100644 --- a/2d/finite_state_machine/player/weapon/weapon_pivot.gd.uid +++ b/2d/finite_state_machine/player/weapon/weapon_pivot.gd.uid @@ -1 +1 @@ -uid://d1hwnb818bhik +uid://beommici1nnah diff --git a/2d/finite_state_machine/project.godot b/2d/finite_state_machine/project.godot index eb5590b2..98d92d11 100644 --- a/2d/finite_state_machine/project.godot +++ b/2d/finite_state_machine/project.godot @@ -16,7 +16,7 @@ pattern in GDscript, including Hierarchical States, and a pushdown automaton." config/tags=PackedStringArray("2d", "ai", "demo", "official") run/main_scene="res://Demo.tscn" -config/features=PackedStringArray("4.4") +config/features=PackedStringArray("4.5") config/icon="res://icon.webp" [debug] diff --git a/2d/finite_state_machine/state_machine/state.gd b/2d/finite_state_machine/state_machine/state.gd index e360e6a5..9d7fd23b 100644 --- a/2d/finite_state_machine/state_machine/state.gd +++ b/2d/finite_state_machine/state_machine/state.gd @@ -4,7 +4,7 @@ extends Node # and makes sure every State object had all of these methods. @warning_ignore("unused_signal") -signal finished(next_state_name: String) +signal finished(next_state_name: StringName) # Initialize the state. E.g. change the animation. func enter() -> void: @@ -16,7 +16,7 @@ func exit() -> void: pass -func handle_input(_event: InputEvent) -> void: +func handle_input(_input_event: InputEvent) -> void: pass diff --git a/2d/finite_state_machine/state_machine/state.gd.uid b/2d/finite_state_machine/state_machine/state.gd.uid index 9ed5172a..4ecb7743 100644 --- a/2d/finite_state_machine/state_machine/state.gd.uid +++ b/2d/finite_state_machine/state_machine/state.gd.uid @@ -1 +1 @@ -uid://dhqouwibt7w6w +uid://bap5du402gbi diff --git a/2d/finite_state_machine/state_machine/state_machine.gd b/2d/finite_state_machine/state_machine/state_machine.gd index 59c2e8a4..57b66bd3 100644 --- a/2d/finite_state_machine/state_machine/state_machine.gd +++ b/2d/finite_state_machine/state_machine/state_machine.gd @@ -45,8 +45,8 @@ func set_active(value: bool) -> void: current_state = null -func _unhandled_input(event: InputEvent) -> void: - current_state.handle_input(event) +func _unhandled_input(input_event: InputEvent) -> void: + current_state.handle_input(input_event) func _physics_process(delta: float) -> void: diff --git a/2d/finite_state_machine/state_machine/state_machine.gd.uid b/2d/finite_state_machine/state_machine/state_machine.gd.uid index 95133bfb..5fcc8f15 100644 --- a/2d/finite_state_machine/state_machine/state_machine.gd.uid +++ b/2d/finite_state_machine/state_machine/state_machine.gd.uid @@ -1 +1 @@ -uid://b472efbw14vob +uid://cq4kyoh2byjwr