feat: add responsive HUD prompts

This commit is contained in:
goose
2026-10-01 15:40:58 -04:00
parent 502492ffc0
commit 5679ed3008
9 changed files with 314 additions and 20 deletions
+11
View File
@@ -8,6 +8,7 @@ var enemies: Dictionary[StringName, ActorState]
var map: GridMapState
var visible_cells: Dictionary[Vector2i, bool] = {}
var explored_cells: Dictionary[Vector2i, bool] = {}
var exit_reached := false
func _init(new_map: GridMapState, new_player: ActorState, new_enemies: Dictionary[StringName, ActorState]) -> void:
map = new_map
@@ -15,6 +16,16 @@ func _init(new_map: GridMapState, new_player: ActorState, new_enemies: Dictionar
enemies = new_enemies
update_exploration()
func get_context_target() -> StringName:
if exit_reached:
return &"exit_reached"
if map.get_cell(player.cell) == GridMapState.CellKind.STAIRS:
return &"stairs"
for direction in [Vector2i.UP, Vector2i.RIGHT, Vector2i.DOWN, Vector2i.LEFT, Vector2i(1, -1), Vector2i(1, 1), Vector2i(-1, 1), Vector2i(-1, -1)]:
if map.get_cell(player.cell + direction) == GridMapState.CellKind.CLOSED_DOOR:
return &"closed_door"
return &""
func try_player_action(direction: Vector2i) -> Array[TurnResult]:
var results := TurnResolverType.resolve_player_action(self, direction)
update_exploration()