Coordinates Disks & Shuttle FTL Travel (#23240)
* Adds the CentComm Disk and configures it to work with direct-use shuttles * Added functionality for drone shuttles (i.e. cargo shuttle) * Adds support for pods, and a disk console object for disks to be inserted into. Also sprites. * Added the disk to HoP's locker * Removed leftover logs & comments * Fix for integration test * Apply suggestions from code review (formatting & proper DataField) Co-authored-by: 0x6273 <0x40@keemail.me> * Fix integration test & changes based on code review * Includes Disk Cases to contain Coordinate Disks, which are now CDs instead of Floppy Disks * Check pods & non-evac shuttles for CentCom travel, even in FTL * Import * Remove CentCom travel restrictions & pod disk consoles * Major changes that changes the coordinates disk system to work with salvage expeditions * Missed CC diskcase removal * Fix build * Review suggestions and changes * Major additional changes after merge * Minor tag miss * Integration test fix * review --------- Co-authored-by: 0x6273 <0x40@keemail.me> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Shuttles.BUIStates;
|
||||
using Content.Shared.Shuttles.Components;
|
||||
using Content.Shared.Shuttles.UI.MapObjects;
|
||||
@@ -10,7 +11,8 @@ namespace Content.Shared.Shuttles.Systems;
|
||||
|
||||
public abstract partial class SharedShuttleSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly ItemSlotsSystem _itemSlots = default!;
|
||||
[Dependency] protected readonly SharedMapSystem Maps = default!;
|
||||
[Dependency] protected readonly SharedTransformSystem XformSystem = default!;
|
||||
|
||||
@@ -34,7 +36,7 @@ public abstract partial class SharedShuttleSystem : EntitySystem
|
||||
/// <summary>
|
||||
/// Returns whether an entity can FTL to the specified map.
|
||||
/// </summary>
|
||||
public bool CanFTLTo(EntityUid shuttleUid, MapId targetMap)
|
||||
public bool CanFTLTo(EntityUid shuttleUid, MapId targetMap, EntityUid consoleUid)
|
||||
{
|
||||
var mapUid = _mapManager.GetMapEntityId(targetMap);
|
||||
var shuttleMap = _xformQuery.GetComponent(shuttleUid).MapID;
|
||||
@@ -42,10 +44,40 @@ public abstract partial class SharedShuttleSystem : EntitySystem
|
||||
if (shuttleMap == targetMap)
|
||||
return true;
|
||||
|
||||
if (!TryComp<FTLDestinationComponent>(mapUid, out var destination) ||
|
||||
!destination.Enabled)
|
||||
{
|
||||
if (!TryComp<FTLDestinationComponent>(mapUid, out var destination) || !destination.Enabled)
|
||||
return false;
|
||||
|
||||
if (destination.RequireCoordinateDisk)
|
||||
{
|
||||
if (!TryComp<ItemSlotsComponent>(consoleUid, out var slot))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_itemSlots.TryGetSlot(consoleUid, SharedShuttleConsoleComponent.DiskSlotName, out var itemSlot, component: slot) || !itemSlot.HasItem)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemSlot.Item is { Valid: true } disk)
|
||||
{
|
||||
ShuttleDestinationCoordinatesComponent? diskCoordinates = null;
|
||||
if (!Resolve(disk, ref diskCoordinates))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var diskCoords = diskCoordinates.Destination;
|
||||
|
||||
if (diskCoords == null || !TryComp<FTLDestinationComponent>(diskCoords.Value, out var diskDestination) || diskDestination != destination)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (HasComp<FTLMapComponent>(mapUid))
|
||||
|
||||
Reference in New Issue
Block a user