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

@@ -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.