From 70572937756aebcb86d6c0bf8dca6c0ae001f79f Mon Sep 17 00:00:00 2001 From: Rane <60792108+Elijahrane@users.noreply.github.com> Date: Sun, 24 Apr 2022 20:05:54 -0400 Subject: [PATCH] Fix 1 vehicle exploit, increase price of ATV crate (#7761) --- Content.Server/Vehicle/RiderSystem.cs | 2 +- Content.Server/Vehicle/VehicleSystem.cs | 10 ++++++++-- Resources/Prototypes/Catalog/Cargo/cargo_fun.yml | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Content.Server/Vehicle/RiderSystem.cs b/Content.Server/Vehicle/RiderSystem.cs index 961dfe61d7..fe4aa0b2e2 100644 --- a/Content.Server/Vehicle/RiderSystem.cs +++ b/Content.Server/Vehicle/RiderSystem.cs @@ -46,7 +46,7 @@ namespace Content.Server.Vehicle } } - private void UnbuckleFromVehicle(EntityUid uid) + public void UnbuckleFromVehicle(EntityUid uid) { if (!TryComp(uid, out var buckle)) return; diff --git a/Content.Server/Vehicle/VehicleSystem.cs b/Content.Server/Vehicle/VehicleSystem.cs index a073bea802..c4512b6eac 100644 --- a/Content.Server/Vehicle/VehicleSystem.cs +++ b/Content.Server/Vehicle/VehicleSystem.cs @@ -23,6 +23,7 @@ namespace Content.Server.Vehicle [Dependency] private readonly SharedAmbientSoundSystem _ambientSound = default!; [Dependency] private readonly TagSystem _tagSystem = default!; [Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!; + [Dependency] private readonly RiderSystem _riderSystem = default!; public override void Initialize() { @@ -69,6 +70,12 @@ namespace Content.Server.Vehicle { if (args.Buckling) { + /// Add a virtual item to rider's hand, unbuckle if we can't. + if (!_virtualItemSystem.TrySpawnVirtualItemInHand(uid, args.BuckledEntity)) + { + _riderSystem.UnbuckleFromVehicle(args.BuckledEntity); + return; + } /// Set up the rider and vehicle with each other EnsureComp(uid); var rider = EnsureComp(args.BuckledEntity); @@ -79,8 +86,7 @@ namespace Content.Server.Vehicle /// Handle pulling RemComp(args.BuckledEntity); RemComp(uid); - /// Add a virtual item to rider's hand - _virtualItemSystem.TrySpawnVirtualItemInHand(uid, args.BuckledEntity); + /// Let this open doors if it has the key in it if (component.HasKey) { diff --git a/Resources/Prototypes/Catalog/Cargo/cargo_fun.yml b/Resources/Prototypes/Catalog/Cargo/cargo_fun.yml index ddefa9cef3..aefcb7d17e 100644 --- a/Resources/Prototypes/Catalog/Cargo/cargo_fun.yml +++ b/Resources/Prototypes/Catalog/Cargo/cargo_fun.yml @@ -66,6 +66,6 @@ sprite: Objects/Vehicles/atv.rsi state: vehicle product: CrateFunATV - cost: 2500 + cost: 6000 category: Fun group: market