mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-16 22:01:12 +03:00
* add BlockHands * and mechs * move to another place * small fix * TrySpawnUnremoveableVirtualItemInHand * upd * fix docs * VehicleHandBlockerComponent
55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using Content.Shared.Buckle.Components;
|
|
using Content.Shared.Vehicle.Components;
|
|
using Robust.Shared.Containers;
|
|
|
|
namespace Content.Shared.Vehicle.Systems;
|
|
|
|
public sealed partial class VehicleSystem
|
|
{
|
|
[SubscribeLocalEvent]
|
|
private void OnVehicleStrapped(Entity<StrapVehicleComponent> ent, ref StrappedEvent args)
|
|
{
|
|
if (!_vehicleQuery.TryComp(ent, out var vehicle))
|
|
return;
|
|
TrySetOperator((ent, vehicle), args.Buckle);
|
|
}
|
|
|
|
[SubscribeLocalEvent]
|
|
private void OnVehicleUnstrapped(Entity<StrapVehicleComponent> ent, ref UnstrappedEvent args)
|
|
{
|
|
if (!_vehicleQuery.TryComp(ent, out var vehicle))
|
|
return;
|
|
|
|
if (vehicle.Operator != args.Buckle)
|
|
return;
|
|
|
|
TryRemoveOperator((ent, vehicle));
|
|
}
|
|
|
|
[SubscribeLocalEvent]
|
|
private void OnContainerEntInserted(Entity<ContainerVehicleComponent> ent, ref EntInsertedIntoContainerMessage args)
|
|
{
|
|
if (_timing.ApplyingState || args.Container.ID != ent.Comp.ContainerId)
|
|
return;
|
|
|
|
if (!_vehicleQuery.TryComp(ent, out var vehicle))
|
|
return;
|
|
|
|
TrySetOperator((ent, vehicle), args.Entity);
|
|
}
|
|
|
|
[SubscribeLocalEvent]
|
|
private void OnContainerEntRemoved(Entity<ContainerVehicleComponent> ent, ref EntRemovedFromContainerMessage args)
|
|
{
|
|
if (_timing.ApplyingState || args.Container.ID != ent.Comp.ContainerId)
|
|
return;
|
|
|
|
if (!_vehicleQuery.TryComp(ent, out var vehicle))
|
|
return;
|
|
|
|
if (vehicle.Operator != args.Entity)
|
|
return;
|
|
|
|
TryRemoveOperator((ent, vehicle));
|
|
}
|
|
}
|