Allow Null hints

This commit is contained in:
TheThomaas 2026-10-13 09:03:55 +02:00
parent e115200194
commit 65ccb1905c
6 changed files with 14 additions and 9 deletions

View file

@ -90,3 +90,6 @@ func end_dodge() -> void:
transitioned.emit(self, play_char.walk_or_run)
else:
transitioned.emit(self, "IdleState")
func get_hints() -> Variant:
return null

View file

@ -110,5 +110,5 @@ func jump() -> void:
play_char.squash_and_strech(1.12, 0.1)
#play_char.particles_manager.display_particles(play_char.jump_particles, play_char)
func get_hints() -> Array:
return [{"action": &"player_jump", "text": "Sauter"}]
func get_hints() -> Variant:
return null

View file

@ -69,5 +69,5 @@ func move(delta : float) -> void:
if !play_char.continious_run: play_char.walk_or_run = "WalkState"
transitioned.emit(self, "IdleState")
func get_hints() -> Array:
return [{"action": &"player_jump", "text": "Sauter"}]
func get_hints() -> Variant:
return null

View file

@ -20,5 +20,5 @@ func physics_update(_delta : float) -> void:
#physics_process update
pass
func get_hints() -> Array:
func get_hints() -> Variant:
return []

View file

@ -27,7 +27,8 @@ func _ready() -> void:
initial_state.enter(char_ref)
curr_state = initial_state
curr_state_name = curr_state.state_name
Hints.set_state_hints(curr_state.get_hints())
var hints = curr_state.get_hints()
if hints != null: Hints.set_state_hints(hints)
func _process(delta : float) -> void:
if curr_state: curr_state.update(delta)
@ -74,7 +75,8 @@ func on_state_child_transition(state : State, new_state_name : String) -> void:
curr_state = new_state
curr_state_name = curr_state.state_name
Hints.set_state_hints(curr_state.get_hints())
var hints = curr_state.get_hints()
if hints != null: Hints.set_state_hints(hints)
func set_state_blocked(state_name : String, blocked : bool) -> void:
if blocked: blocked_states[state_name.to_lower()] = true

View file

@ -71,5 +71,5 @@ func move(delta : float) -> void:
else:
transitioned.emit(self, "IdleState")
func get_hints() -> Array:
return [{"action": &"player_jump", "text": "Sauter"}]
func get_hints() -> Variant:
return null