Some vehicle bugfixes (#11692)

This commit is contained in:
Leon Friedrich
2022-10-04 15:49:46 +13:00
committed by GitHub
parent 47db233091
commit 4148b252c5
8 changed files with 80 additions and 98 deletions

View File

@@ -6,7 +6,6 @@ using Content.Shared.Movement.Events;
using Content.Shared.Popups;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Serialization;
@@ -22,6 +21,7 @@ public abstract class SharedJetpackSystem : EntitySystem
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
[Dependency] protected readonly SharedContainerSystem Container = default!;
[Dependency] private readonly SharedPopupSystem _popups = default!;
[Dependency] private readonly SharedMoverController _mover = default!;
public override void Initialize()
{
@@ -102,7 +102,7 @@ public abstract class SharedJetpackSystem : EntitySystem
{
var user = EnsureComp<JetpackUserComponent>(uid);
var relay = EnsureComp<RelayInputMoverComponent>(uid);
relay.RelayEntity = component.Owner;
_mover.SetRelay(uid, component.Owner, relay);
user.Jetpack = component.Owner;
}

View File

@@ -13,6 +13,19 @@ public abstract partial class SharedMoverController
SubscribeLocalEvent<RelayInputMoverComponent, ComponentShutdown>(OnRelayShutdown);
}
/// <summary>
/// Sets the relay entity and marks the component as dirty. This only exists because people have previously
/// forgotten to Dirty(), so fuck you, you have to use this method now.
/// </summary>
public void SetRelay(EntityUid uid, EntityUid relayEntity, RelayInputMoverComponent? component = null)
{
if (!Resolve(uid, ref component))
return;
component.RelayEntity = relayEntity;
Dirty(component);
}
private void OnRelayShutdown(EntityUid uid, RelayInputMoverComponent component, ComponentShutdown args)
{
// If relay is removed then cancel all inputs.