feat: add S1 walking skeleton

This commit is contained in:
goose
2026-09-30 20:11:16 -04:00
parent fb52208a06
commit d18c8e26fa
252 changed files with 21191 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
class_name GameState
extends RefCounted
const TurnResolverType = preload("res://scripts/domain/turn_resolver.gd")
var player: ActorState
var enemies: Dictionary[StringName, ActorState]
var map: GridMapState
var visible_cells: Dictionary[Vector2i, bool] = {}
var explored_cells: Dictionary[Vector2i, bool] = {}
func _init(new_map: GridMapState, new_player: ActorState, new_enemies: Dictionary[StringName, ActorState]) -> void:
map = new_map
player = new_player
enemies = new_enemies
update_exploration()
func try_player_action(direction: Vector2i) -> Array[TurnResult]:
var results := TurnResolverType.resolve_player_action(self, direction)
update_exploration()
return results
func compute_visible_cells(origin: Vector2i, radius: int) -> Dictionary[Vector2i, bool]:
var visible: Dictionary[Vector2i, bool] = {}
for y in range(origin.y - radius, origin.y + radius + 1):
for x in range(origin.x - radius, origin.x + radius + 1):
var cell := Vector2i(x, y)
if map.is_inside(cell) and origin.distance_to(cell) <= radius:
visible[cell] = true
return visible
func update_exploration() -> void:
visible_cells = compute_visible_cells(player.cell, 6)
for cell in visible_cells:
explored_cells[cell] = true