Fix nodevis on rotated grid (#5101)
This commit is contained in:
@@ -144,7 +144,7 @@ namespace Content.Client.NodeContainer
|
||||
var grid = _mapManager.GetGrid(gridId);
|
||||
foreach (var (pos, list) in gridDict)
|
||||
{
|
||||
var centerPos = grid.GridTileToWorld(pos).Position;
|
||||
var centerPos = (Vector2) pos + grid.TileSize / 2f;
|
||||
list.Sort(NodeDisplayComparer.Instance);
|
||||
|
||||
var offset = -(list.Count - 1) * nodeOffset / 2;
|
||||
@@ -159,11 +159,12 @@ namespace Content.Client.NodeContainer
|
||||
offset += nodeOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handle.SetTransform(grid.WorldMatrix);
|
||||
|
||||
foreach (var nodeRenderData in _nodeIndex.Values)
|
||||
{
|
||||
var pos = nodeRenderData.WorldPos;
|
||||
var pos = nodeRenderData.NodePos;
|
||||
var bounds = Box2.CenteredAround(pos, (nodeSize, nodeSize));
|
||||
|
||||
var groupData = nodeRenderData.GroupData;
|
||||
@@ -182,12 +183,16 @@ namespace Content.Client.NodeContainer
|
||||
{
|
||||
if (_nodeIndex.TryGetValue((groupData.NetId, reachable), out var reachDat))
|
||||
{
|
||||
handle.DrawLine(pos, reachDat.WorldPos, color);
|
||||
handle.DrawLine(pos, reachDat.NodePos, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_nodeIndex.Clear();
|
||||
}
|
||||
|
||||
|
||||
handle.SetTransform(Matrix3.Identity);
|
||||
_gridIndex.Clear();
|
||||
}
|
||||
|
||||
@@ -219,13 +224,13 @@ namespace Content.Client.NodeContainer
|
||||
{
|
||||
public GroupData GroupData;
|
||||
public NodeDatum NodeDatum;
|
||||
public Vector2 WorldPos;
|
||||
public Vector2 NodePos;
|
||||
|
||||
public NodeRenderData(GroupData groupData, NodeDatum nodeDatum, Vector2 worldPos)
|
||||
public NodeRenderData(GroupData groupData, NodeDatum nodeDatum, Vector2 nodePos)
|
||||
{
|
||||
GroupData = groupData;
|
||||
NodeDatum = nodeDatum;
|
||||
WorldPos = worldPos;
|
||||
NodePos = nodePos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user