feat: implement door interaction
This commit is contained in:
@@ -17,7 +17,7 @@ static func resolve_player_action(state: GameState, direction: Vector2i) -> Arra
|
||||
state.enemies.erase(enemy.id)
|
||||
results.append(TurnResultType.new(enemy.id, &"enemy_defeated", enemy.cell, enemy.cell, player.id, 0, "The goblin is defeated."))
|
||||
else:
|
||||
_append_enemy_response(state, results)
|
||||
append_enemy_response(state, results)
|
||||
return results
|
||||
if not state.map.is_walkable(destination):
|
||||
results.append(TurnResultType.new(player.id, &"blocked", player.cell, destination, &"", 0, "Your way is blocked."))
|
||||
@@ -25,7 +25,7 @@ static func resolve_player_action(state: GameState, direction: Vector2i) -> Arra
|
||||
var from: Vector2i = player.cell
|
||||
player.cell = destination
|
||||
results.append(TurnResultType.new(player.id, &"moved", from, destination, &"", 0, "You move to (%d, %d)." % [destination.x, destination.y]))
|
||||
_append_enemy_response(state, results)
|
||||
append_enemy_response(state, results)
|
||||
return results
|
||||
|
||||
static func _enemy_at(state: GameState, cell: Vector2i) -> ActorState:
|
||||
@@ -34,7 +34,7 @@ static func _enemy_at(state: GameState, cell: Vector2i) -> ActorState:
|
||||
return enemy
|
||||
return null
|
||||
|
||||
static func _append_enemy_response(state: GameState, results: Array[TurnResult]) -> void:
|
||||
static func append_enemy_response(state: GameState, results: Array[TurnResult]) -> void:
|
||||
for enemy: ActorState in state.enemies.values():
|
||||
var delta: Vector2i = state.player.cell - enemy.cell
|
||||
if abs(delta.x) + abs(delta.y) == 1:
|
||||
|
||||
Reference in New Issue
Block a user