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:
SlamBamActionman
2024-04-01 06:50:00 +02:00
committed by GitHub
parent cc35f16839
commit bed9e9ac6a
24 changed files with 217 additions and 23 deletions

View File

@@ -23,4 +23,10 @@ public sealed partial class FTLDestinationComponent : Component
/// </summary>
[DataField, AutoNetworkedField]
public bool BeaconsOnly;
/// <summary>
/// Shuttles must use a corresponding CD to travel to this location.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
public bool RequireCoordinateDisk = false;
}

View File

@@ -9,7 +9,7 @@ namespace Content.Shared.Shuttles.Components
[NetworkedComponent]
public abstract partial class SharedShuttleConsoleComponent : Component
{
public static string DiskSlotName = "disk_slot";
}
[Serializable, NetSerializable]

View File

@@ -0,0 +1,15 @@
namespace Content.Shared.Shuttles.Components;
using Robust.Shared.GameStates;
/// <summary>
/// Enables a shuttle to travel to a destination with an item inserted into its console
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class ShuttleDestinationCoordinatesComponent : Component
{
/// <summary>
/// Uid for entity containing the FTLDestination component
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
public EntityUid? Destination;
}

View File

@@ -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))