feat: add responsive HUD prompts
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user