Fix 1 vehicle exploit, increase price of ATV crate (#7761)

This commit is contained in:
Rane
2022-04-24 20:05:54 -04:00
committed by GitHub
parent 4b74a507c6
commit 7057293775
3 changed files with 10 additions and 4 deletions

View File

@@ -46,7 +46,7 @@ namespace Content.Server.Vehicle
} }
} }
private void UnbuckleFromVehicle(EntityUid uid) public void UnbuckleFromVehicle(EntityUid uid)
{ {
if (!TryComp<BuckleComponent>(uid, out var buckle)) if (!TryComp<BuckleComponent>(uid, out var buckle))
return; return;

View File

@@ -23,6 +23,7 @@ namespace Content.Server.Vehicle
[Dependency] private readonly SharedAmbientSoundSystem _ambientSound = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSound = default!;
[Dependency] private readonly TagSystem _tagSystem = default!; [Dependency] private readonly TagSystem _tagSystem = default!;
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!; [Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
[Dependency] private readonly RiderSystem _riderSystem = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -69,6 +70,12 @@ namespace Content.Server.Vehicle
{ {
if (args.Buckling) 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 /// Set up the rider and vehicle with each other
EnsureComp<SharedPlayerInputMoverComponent>(uid); EnsureComp<SharedPlayerInputMoverComponent>(uid);
var rider = EnsureComp<RiderComponent>(args.BuckledEntity); var rider = EnsureComp<RiderComponent>(args.BuckledEntity);
@@ -79,8 +86,7 @@ namespace Content.Server.Vehicle
/// Handle pulling /// Handle pulling
RemComp<SharedPullableComponent>(args.BuckledEntity); RemComp<SharedPullableComponent>(args.BuckledEntity);
RemComp<SharedPullableComponent>(uid); RemComp<SharedPullableComponent>(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 /// Let this open doors if it has the key in it
if (component.HasKey) if (component.HasKey)
{ {

View File

@@ -66,6 +66,6 @@
sprite: Objects/Vehicles/atv.rsi sprite: Objects/Vehicles/atv.rsi
state: vehicle state: vehicle
product: CrateFunATV product: CrateFunATV
cost: 2500 cost: 6000
category: Fun category: Fun
group: market group: market