Also fixed some other stuff I noticed.
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Map;
+using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components;
namespace Content.Client.Shuttles.Systems;
return GetCoordinates(exclusion.Coordinates).ToMap(EntityManager, XformSystem);
case GridMapObject grid:
var gridXform = Transform(grid.Entity);
+
+ if (HasComp<MapComponent>(grid.Entity))
+ {
+ return new MapCoordinates(gridXform.LocalPosition, gridXform.MapID);
+ }
+
Entity<PhysicsComponent?, TransformComponent?> gridEnt = (grid.Entity, null, gridXform);
return new MapCoordinates(Maps.GetGridPosition(gridEnt), gridXform.MapID);
default:
_ftlStyle.BackgroundColor = Color.FromHex("#B02E26");
MapRadar.InFtl = false;
break;
+ // Fallback in case no FTL state or the likes.
default:
- throw new NotImplementedException();
+ SetFTLAllowed(false);
+ _ftlStyle.BackgroundColor = Color.FromHex("#B02E26");
+ MapRadar.InFtl = false;
+ break;
}
if (IsFTLBlocked())
foreach (var mapObj in mapObjects)
{
+ // If it's a grid-map skip it.
+ if (mapObj is GridMapObject gridObj && EntManager.HasComponent<MapComponent>(gridObj.Entity))
+ continue;
+
var mapCoords = _shuttles.GetMapCoordinates(mapObj);
var relativePos = matty.Transform(mapCoords.Position);
using Content.Shared.Salvage;
using Content.Shared.Salvage.Expeditions;
using Content.Shared.Salvage.Expeditions.Modifiers;
+using Content.Shared.Shuttles.Components;
using Content.Shared.Storage;
using Robust.Shared.Collections;
using Robust.Shared.Map;
MetaDataComponent? metadata = null;
var grid = _entManager.EnsureComponent<MapGridComponent>(mapUid);
var random = new Random(_missionParams.Seed);
+ var destComp = _entManager.AddComponent<FTLDestinationComponent>(mapUid);
+ destComp.BeaconsOnly = true;
// Setup mission configs
// As we go through the config the rating will deplete so we'll go for most important to least important.
var angle = args.Angle.Reduced();
var targetCoordinates = new EntityCoordinates(targetXform.MapUid!.Value, _transform.GetWorldPosition(targetXform));
- ConsoleFTL(ent, true, targetCoordinates, angle, targetXform.MapID);
+ ConsoleFTL(ent, targetCoordinates, angle, targetXform.MapID);
}
private void OnPositionFTLMessage(Entity<ShuttleConsoleComponent> entity, ref ShuttleConsoleFTLPositionMessage args)
var targetCoordinates = new EntityCoordinates(mapUid, args.Coordinates.Position);
var angle = args.Angle.Reduced();
- ConsoleFTL(entity, false, targetCoordinates, angle, args.Coordinates.MapId);
+ ConsoleFTL(entity, targetCoordinates, angle, args.Coordinates.MapId);
}
private void GetBeacons(ref List<ShuttleBeaconObject>? beacons)
{
var query = AllEntityQuery<FTLExclusionComponent, TransformComponent>();
- while (query.MoveNext(out var uid, out var comp, out var xform))
+ while (query.MoveNext(out var comp, out var xform))
{
if (!comp.Enabled)
continue;
/// <summary>
/// Handles shuttle console FTLs.
/// </summary>
- private void ConsoleFTL(Entity<ShuttleConsoleComponent> ent, bool beacon, EntityCoordinates targetCoordinates, Angle targetAngle, MapId targetMap)
+ private void ConsoleFTL(Entity<ShuttleConsoleComponent> ent, EntityCoordinates targetCoordinates, Angle targetAngle, MapId targetMap)
{
var consoleUid = GetDroneConsole(ent.Owner);
List<ShuttleExclusionObject>? exclusions = null;
GetExclusions(ref exclusions);
- if (!beacon && !_shuttle.FTLFree(shuttleUid.Value, targetCoordinates, targetAngle, exclusions))
+ if (!_shuttle.FTLFree(shuttleUid.Value, targetCoordinates, targetAngle, exclusions))
{
return;
}
public const float DefaultTravelTime = 20f;
public const float DefaultArrivalTime = 5f;
private const float FTLCooldown = 10f;
- public const float FTLMassLimit = 100000f;
+ public const float FTLMassLimit = 300f;
// I'm too lazy to make CVars.
private const int FTLProximityIterations = 3;
private readonly HashSet<EntityUid> _lookupEnts = new();
+ private readonly HashSet<EntityUid> _immuneEnts = new();
private EntityQuery<BodyComponent> _bodyQuery;
private EntityQuery<BuckleComponent> _buckleQuery;
+ private EntityQuery<FTLBeaconComponent> _beaconQuery;
private EntityQuery<GhostComponent> _ghostQuery;
private EntityQuery<PhysicsComponent> _physicsQuery;
private EntityQuery<StatusEffectsComponent> _statusQuery;
SubscribeLocalEvent<StationPostInitEvent>(OnStationPostInit);
_bodyQuery = GetEntityQuery<BodyComponent>();
_buckleQuery = GetEntityQuery<BuckleComponent>();
+ _beaconQuery = GetEntityQuery<FTLBeaconComponent>();
_ghostQuery = GetEntityQuery<GhostComponent>();
_physicsQuery = GetEntityQuery<PhysicsComponent>();
_statusQuery = GetEntityQuery<StatusEffectsComponent>();
return false;
}
- if (TryComp(shuttleUid, out PhysicsComponent? shuttlePhysics) && shuttlePhysics.Mass > 300f)
+ if (TryComp(shuttleUid, out PhysicsComponent? shuttlePhysics) && shuttlePhysics.Mass > FTLMassLimit)
{
reason = Loc.GetString("shuttle-console-mass");
return false;
// Flatten anything not parented to a grid.
var transform = _physics.GetPhysicsTransform(uid, xform);
var aabbs = new List<Box2>(manager.Fixtures.Count);
- var immune = new HashSet<EntityUid>();
var tileSet = new List<(Vector2i, Tile)>();
foreach (var fixture in manager.Fixtures.Values)
tileSet.Clear();
_biomes.ReserveTiles(xform.MapUid.Value, aabb, tileSet);
_lookupEnts.Clear();
+ _immuneEnts.Clear();
_lookup.GetEntitiesIntersecting(xform.MapUid.Value, aabb, _lookupEnts, LookupFlags.Uncontained);
foreach (var ent in _lookupEnts)
{
- if (ent == uid || immune.Contains(ent))
+ if (ent == uid || _immuneEnts.Contains(ent))
{
continue;
}
- if (_ghostQuery.HasComponent(ent))
+ if (_ghostQuery.HasComponent(ent) || _beaconQuery.HasComponent(ent))
{
continue;
}
if (_bodyQuery.TryGetComponent(ent, out var mob))
{
var gibs = _bobby.GibBody(ent, body: mob);
- immune.UnionWith(gibs);
+ _immuneEnts.UnionWith(gibs);
continue;
}