CatStation/Content.Shared/Vehicle/Components/GenericKeyedVehicleComponent.cs
AndrewFenriz 358ecc1181
Vehicle system: Core systems & Components (#43527)
* Part one of Vehicles

* Also we need this

* Part 1

* Part 1.1

* And we need this

* Part 2

* Part 2.1

* We REALLY need this

* Little fix

* Just fixes

* fixes (i'm tired)

* fix

* Apply suggestions from code review

Co-authored-by: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>

* update

* fixed

* just for cleaner diff

* just in case

* I think this might be cleaner

* fix

* upd

* Update Content.Shared/Vehicle/VehicleSystem.cs

Co-authored-by: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>

* fix vehicle key and unstrap checks

* fix OnBuckleUpdateCanMove

* fixes

* clear vehicle operator relays

* small fix

* fix1

* fix2

* upd

* fix?

* fix??

---------

Co-authored-by: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>
2026-07-18 18:02:50 +00:00

30 lines
1,012 B
C#

using Content.Shared.Whitelist;
using Robust.Shared.GameStates;
namespace Content.Shared.Vehicle.Components;
/// <summary>
/// This is used for a vehicle which can only be operated when a specific key matching a whitelist is inserted.
/// </summary>
[RegisterComponent, NetworkedComponent]
[Access(typeof(VehicleSystem))]
public sealed partial class GenericKeyedVehicleComponent : Component
{
/// <summary>
/// The ID corresponding to the container where the "key" must be inserted.
/// </summary>
[DataField(required: true)]
public string ContainerId;
/// <summary>
/// A whitelist determining what qualifies as a valid key for this vehicle.
/// </summary>
[DataField(required: true)]
public EntityWhitelist KeyWhitelist = new();
/// <summary>
/// If true, prevents keys which do not pass the <see cref="KeyWhitelist"/> from being inserted into <see cref="ContainerId"/>
/// </summary>
[DataField]
public bool PreventInvalidInsertion = true;
}