示例#1
0
    /// <summary>
    /// Gets the largest member grid from a station.
    /// </summary>
    private EntityUid?GetLargestGrid(StationDataComponent component)
    {
        EntityUid?largestGrid   = null;
        Box2      largestBounds = new Box2();

        foreach (var gridUid in component.Grids)
        {
            if (!TryComp <IMapGridComponent>(gridUid, out var grid))
            {
                continue;
            }

            if (grid.Grid.LocalAABB.Size.LengthSquared < largestBounds.Size.LengthSquared)
            {
                continue;
            }

            largestBounds = grid.Grid.LocalAABB;
            largestGrid   = gridUid;
        }

        return(largestGrid);
    }
示例#2
0
    private void AddEmergencyShuttle(StationDataComponent component)
    {
        if (!_emergencyShuttleEnabled || _centComMap == null || component.EmergencyShuttle != null)
        {
            return;
        }

        // Load escape shuttle
        var(_, shuttle) = _loader.LoadBlueprint(_centComMap.Value, component.EmergencyShuttlePath.ToString(), new MapLoadOptions()
        {
            // Should be far enough... right? I'm too lazy to bounds check CentCom rn.
            Offset = new Vector2(500f + _shuttleIndex, 0f)
        });

        if (shuttle == null)
        {
            _sawmill.Error($"Unable to spawn emergency shuttle {component.EmergencyShuttlePath} for {ToPrettyString(component.Owner)}");
            return;
        }

        _shuttleIndex += _mapManager.GetGrid(shuttle.Value).LocalAABB.Width + ShuttleSpawnBuffer;
        component.EmergencyShuttle = shuttle;
    }
示例#3
0
 private void OnStationStartup(EntityUid uid, StationDataComponent component, ComponentStartup args)
 {
     AddEmergencyShuttle(component);
 }