feat: port item instances and inventory

This commit is contained in:
goose
2026-10-03 13:16:00 -04:00
parent 391e95f6f4
commit f9e68e6110
16 changed files with 417 additions and 7 deletions
+20
View File
@@ -24,6 +24,7 @@ var _explored_cells: Dictionary[Vector2i, bool] = {}
var _traps: Dictionary[Vector2i, Dictionary] = {}
var _shrines: Dictionary[Vector2i, Dictionary] = {}
var _quest_boards: Dictionary[Vector2i, Dictionary] = {}
var _ground_items: Dictionary[Vector2i, Array] = {}
func get_cell_rect(cell: Vector2i) -> Rect2:
return Rect2(Vector2(cell * TILE_SIZE), Vector2(TILE_SIZE))
@@ -43,6 +44,17 @@ func set_special_markers(traps: Dictionary[Vector2i, Dictionary], shrines: Dicti
_quest_boards = quest_boards.duplicate(true)
queue_redraw()
func set_ground_items(ground_items: Dictionary[Vector2i, Array]) -> void:
_ground_items = ground_items.duplicate()
queue_redraw()
func get_ground_item_marker_cells() -> Dictionary[Vector2i, bool]:
var cells: Dictionary[Vector2i, bool] = {}
for cell in _ground_items:
if _visible_cells.has(cell) and not _ground_items[cell].is_empty():
cells[cell] = true
return cells
func get_cell_visibility_state(cell: Vector2i) -> StringName:
if _visible_cells.has(cell):
return &"visible"
@@ -88,3 +100,11 @@ func _draw_special_marker(cell: Vector2i, tile_rect: Rect2) -> void:
draw_circle(tile_rect.get_center(), 5.0, Color(0.45, 0.85, 1.0, 0.95))
if _quest_boards.has(cell):
draw_rect(Rect2(tile_rect.position + Vector2(10, 7), Vector2(12, 18)), Color(0.95, 0.78, 0.32, 0.95))
if _ground_items.has(cell) and not _ground_items[cell].is_empty():
# Gold diamond: visible only inside current FOV, matching all world markers.
var center := tile_rect.get_center()
var diamond := PackedVector2Array([
center + Vector2(0, -7), center + Vector2(7, 0),
center + Vector2(0, 7), center + Vector2(-7, 0),
])
draw_colored_polygon(diamond, Color(1.0, 0.82, 0.22, 0.96))