private void DispatchJpsDebug(SharedAiDebug.JpsRouteDebug routeDebug) { var mapManager = IoCManager.Resolve <IMapManager>(); var route = new List <Vector2>(); foreach (var tile in routeDebug.Route) { var tileGrid = mapManager.GetGrid(tile.GridIndex).GridTileToLocal(tile.GridIndices); route.Add(tileGrid.ToMapPos(EntityManager)); } var jumpNodes = new List <Vector2>(); foreach (var tile in routeDebug.JumpNodes) { var tileGrid = mapManager.GetGrid(tile.GridIndex).GridTileToLocal(tile.GridIndices); jumpNodes.Add(tileGrid.ToMapPos(EntityManager)); } var systemMessage = new SharedAiDebug.JpsRouteMessage( routeDebug.EntityUid, route, jumpNodes, routeDebug.TimeTaken ); RaiseNetworkEvent(systemMessage); }
private void DispatchJpsDebug(SharedAiDebug.JpsRouteDebug routeDebug) { var mapManager = IoCManager.Resolve <IMapManager>(); var route = new List <Vector2>(); foreach (var tile in routeDebug.Route) { var tileGrid = mapManager.GetGrid(tile.GridIndex).GridTileToLocal(tile.GridIndices); route.Add(mapManager.GetGrid(tile.GridIndex).LocalToWorld(tileGrid).Position); } var jumpNodes = new List <Vector2>(); foreach (var tile in routeDebug.JumpNodes) { var tileGrid = mapManager.GetGrid(tile.GridIndex).GridTileToLocal(tile.GridIndices); jumpNodes.Add(mapManager.GetGrid(tile.GridIndex).LocalToWorld(tileGrid).Position); } var systemMessage = new SharedAiDebug.JpsRouteMessage( routeDebug.EntityUid, route, jumpNodes, routeDebug.TimeTaken ); EntityManager.EntityNetManager.SendSystemNetworkMessage(systemMessage); }
private void HandleJpsRouteMessage(SharedAiDebug.JpsRouteMessage message) { if ((_tooltips & AiDebugMode.Paths) != 0) { var entityManager = IoCManager.Resolve <IEntityManager>(); var entity = entityManager.GetEntity(message.EntityUid); TryCreatePanel(entity); var label = (Label)_aiBoxes[entity].GetChild(0).GetChild(1); label.Text = $"Pathfinding time (ms): {message.TimeTaken * 1000:0.0000}\n" + $"Jump Nodes: {message.JumpNodes.Count}\n" + $"Jump Nodes per ms: {message.JumpNodes.Count / (message.TimeTaken * 1000)}"; } }
private void HandleJpsRouteMessage(SharedAiDebug.JpsRouteMessage message) { if ((_modes & PathfindingDebugMode.Nodes) != 0 || (_modes & PathfindingDebugMode.Route) != 0) { _overlay.JpsRoutes.Add(message); Timer.Spawn(TimeSpan.FromSeconds(_routeDuration), () => { if (_overlay == null) { return; } _overlay.JpsRoutes.Remove(message); }); } }