extends Node

func get_marker_data() -> Array:
  var out: Array = []
  for p in get_tree().get_nodes_in_group("player"):
    if not (p is Node3D):
      continue
    out.append({"pos": (p as Node3D).global_position, "color": Color(0.3, 0.6, 1.0), "label": Net.player_names.get(p.peer_id if p.has_method("get") else 1, "P")})
  for e in get_tree().get_nodes_in_group("enemies"):
    if e is Node3D:
      out.append({"pos": (e as Node3D).global_position, "color": Color(0.9, 0.2, 0.2), "label": ""})
  for g in get_tree().get_nodes_in_group("gates"):
    if g is Node3D:
      var c: Color = Color(0.95, 0.2, 0.15) if g.is_in_group("red_gate") else Color(0.85, 0.55, 0.2)
      out.append({"pos": (g as Node3D).global_position, "color": c, "label": "Gate"})
  for portal in get_tree().get_nodes_in_group("portals"):
    if portal is Node3D:
      var c2: Color = Color(0.95, 0.2, 0.15) if portal.is_in_group("red_portal") else Color(0.3, 0.6, 1.0)
      out.append({"pos": (portal as Node3D).global_position, "color": c2, "label": "Portal"})
  for n in get_tree().get_nodes_in_group("npc"):
    if n is Node3D:
      out.append({"pos": (n as Node3D).global_position, "color": Color(0.9, 0.85, 0.5), "label": ""})
  for v in get_tree().get_nodes_in_group("village"):
    if v is Node3D:
      out.append({"pos": (v as Node3D).global_position, "color": Color(0.4, 0.85, 0.4), "label": "Village"})
  return out
