Spatial packets

This commit is contained in:
dingo
2026-02-09 08:58:44 -05:00
parent a0ee3deeca
commit 1c8dafabd1
9 changed files with 358 additions and 73 deletions
+13 -3
View File
@@ -281,7 +281,7 @@ func _update_minimap_entities():
if draw_x >= 0 and draw_x < MINIMAP_SIZE and draw_y >= 0 and draw_y < MINIMAP_SIZE:
minimap_image.set_pixel(draw_x, draw_y, Color.GREEN)
# Draw mobs (red dots)
# Draw mobs (red = nearby/visible, dark red = out-of-range)
for mob_id in GameState.mobs:
var mob = GameState.mobs[mob_id]
var mx = mob.get("x", mob.get("X", 0)) / 32.0
@@ -289,7 +289,8 @@ func _update_minimap_entities():
var mob_mx = int(mx * scale) + offset_x
var mob_my = int(my * scale) + offset_y
if mob_mx >= 0 and mob_mx < MINIMAP_SIZE and mob_my >= 0 and mob_my < MINIMAP_SIZE:
minimap_image.set_pixel(mob_mx, mob_my, Color.RED)
var mob_color = Color.RED if mob.get("_visible", true) else Color(0.5, 0.15, 0.15)
minimap_image.set_pixel(mob_mx, mob_my, mob_color)
minimap_tex.update(minimap_image)
@@ -320,7 +321,16 @@ func _update_resources():
if tier_label:
tier_label.text = "Tier %d" % GameState.dungeon.tier
if mobs_label:
mobs_label.text = "Mobs: %d" % GameState.mobs.size()
# Show nearby (visible) mob count vs total known for spatial tuning debug
var total = GameState.mobs.size()
var nearby = 0
for mid in GameState.mobs:
if GameState.mobs[mid].get("_visible", true):
nearby += 1
if nearby != total:
mobs_label.text = "Mobs: %d/%d" % [nearby, total]
else:
mobs_label.text = "Mobs: %d" % total
func _update_hotbar():
if not GameState: