Improve surface minimap rendering and add path overlay
This commit is contained in:
1 parent
7e43001d9d
commit
67381655a2
7 files changed
+67
-32
No files matched your search
@@ -226,6 +226,17 @@ def api_minimap():
|
||||
lock.release()
|
||||
|
||||
ready = any(cell is not None for row in cells for cell in row)
|
||||
path_nodes = []
|
||||
for node in (g.get('path') or ())[:512]:
|
||||
try:
|
||||
if all(hasattr(node, key) for key in ('x', 'z')):
|
||||
path_x, path_z = float(node.x), float(node.z)
|
||||
else:
|
||||
path_x, path_z = float(node[0]), float(node[2])
|
||||
except (IndexError, TypeError, ValueError, AttributeError):
|
||||
continue
|
||||
path_nodes.append({'x': path_x, 'z': path_z})
|
||||
|
||||
return jsonify(
|
||||
ready=ready,
|
||||
center={'x': center_x, 'y': center_y, 'z': center_z},
|
||||
@@ -234,6 +245,7 @@ def api_minimap():
|
||||
radius_x=radius_x,
|
||||
radius_z=radius_z,
|
||||
cells=cells if ready else [],
|
||||
path=path_nodes,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user