Remove mech component references (#15246)
This commit is contained in:
@@ -26,7 +26,7 @@ using Robust.Shared.Timing;
|
||||
namespace Content.Shared.Mech.EntitySystems;
|
||||
|
||||
/// <summary>
|
||||
/// Handles all of the interactions, UI handling, and items shennanigans for <see cref="SharedMechComponent"/>
|
||||
/// Handles all of the interactions, UI handling, and items shennanigans for <see cref="MechComponent"/>
|
||||
/// </summary>
|
||||
public abstract class SharedMechSystem : EntitySystem
|
||||
{
|
||||
@@ -44,17 +44,17 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<SharedMechComponent, ComponentGetState>(OnGetState);
|
||||
SubscribeLocalEvent<SharedMechComponent, ComponentHandleState>(OnHandleState);
|
||||
SubscribeLocalEvent<MechComponent, ComponentGetState>(OnGetState);
|
||||
SubscribeLocalEvent<MechComponent, ComponentHandleState>(OnHandleState);
|
||||
SubscribeLocalEvent<MechPilotComponent, ComponentGetState>(OnPilotGetState);
|
||||
SubscribeLocalEvent<MechPilotComponent, ComponentHandleState>(OnPilotHandleState);
|
||||
|
||||
SubscribeLocalEvent<SharedMechComponent, MechToggleEquipmentEvent>(OnToggleEquipmentAction);
|
||||
SubscribeLocalEvent<SharedMechComponent, MechEjectPilotEvent>(OnEjectPilotEvent);
|
||||
SubscribeLocalEvent<SharedMechComponent, InteractNoHandEvent>(RelayInteractionEvent);
|
||||
SubscribeLocalEvent<SharedMechComponent, ComponentStartup>(OnStartup);
|
||||
SubscribeLocalEvent<SharedMechComponent, DestructionEventArgs>(OnDestruction);
|
||||
SubscribeLocalEvent<SharedMechComponent, GetAdditionalAccessEvent>(OnGetAdditionalAccess);
|
||||
SubscribeLocalEvent<MechComponent, MechToggleEquipmentEvent>(OnToggleEquipmentAction);
|
||||
SubscribeLocalEvent<MechComponent, MechEjectPilotEvent>(OnEjectPilotEvent);
|
||||
SubscribeLocalEvent<MechComponent, InteractNoHandEvent>(RelayInteractionEvent);
|
||||
SubscribeLocalEvent<MechComponent, ComponentStartup>(OnStartup);
|
||||
SubscribeLocalEvent<MechComponent, DestructionEventArgs>(OnDestruction);
|
||||
SubscribeLocalEvent<MechComponent, GetAdditionalAccessEvent>(OnGetAdditionalAccess);
|
||||
|
||||
SubscribeLocalEvent<MechPilotComponent, GetMeleeWeaponEvent>(OnGetMeleeWeapon);
|
||||
SubscribeLocalEvent<MechPilotComponent, CanAttackFromContainerEvent>(OnCanAttackFromContainer);
|
||||
@@ -63,7 +63,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
|
||||
#region State Handling
|
||||
|
||||
private void OnGetState(EntityUid uid, SharedMechComponent component, ref ComponentGetState args)
|
||||
private void OnGetState(EntityUid uid, MechComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new MechComponentState
|
||||
{
|
||||
@@ -76,7 +76,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
};
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, SharedMechComponent component, ref ComponentHandleState args)
|
||||
private void OnHandleState(EntityUid uid, MechComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not MechComponentState state)
|
||||
return;
|
||||
@@ -107,7 +107,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
|
||||
#endregion
|
||||
|
||||
private void OnToggleEquipmentAction(EntityUid uid, SharedMechComponent component, MechToggleEquipmentEvent args)
|
||||
private void OnToggleEquipmentAction(EntityUid uid, MechComponent component, MechToggleEquipmentEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
@@ -115,7 +115,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
CycleEquipment(uid);
|
||||
}
|
||||
|
||||
private void OnEjectPilotEvent(EntityUid uid, SharedMechComponent component, MechEjectPilotEvent args)
|
||||
private void OnEjectPilotEvent(EntityUid uid, MechComponent component, MechEjectPilotEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
@@ -123,7 +123,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
TryEject(uid, component);
|
||||
}
|
||||
|
||||
private void RelayInteractionEvent(EntityUid uid, SharedMechComponent component, InteractNoHandEvent args)
|
||||
private void RelayInteractionEvent(EntityUid uid, MechComponent component, InteractNoHandEvent args)
|
||||
{
|
||||
var pilot = component.PilotSlot.ContainedEntity;
|
||||
if (pilot == null)
|
||||
@@ -139,7 +139,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private void OnStartup(EntityUid uid, SharedMechComponent component, ComponentStartup args)
|
||||
private void OnStartup(EntityUid uid, MechComponent component, ComponentStartup args)
|
||||
{
|
||||
component.PilotSlot = _container.EnsureContainer<ContainerSlot>(uid, component.PilotSlotId);
|
||||
component.EquipmentContainer = _container.EnsureContainer<Container>(uid, component.EquipmentContainerId);
|
||||
@@ -147,12 +147,12 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
UpdateAppearance(uid, component);
|
||||
}
|
||||
|
||||
private void OnDestruction(EntityUid uid, SharedMechComponent component, DestructionEventArgs args)
|
||||
private void OnDestruction(EntityUid uid, MechComponent component, DestructionEventArgs args)
|
||||
{
|
||||
BreakMech(uid, component);
|
||||
}
|
||||
|
||||
private void OnGetAdditionalAccess(EntityUid uid, SharedMechComponent component, ref GetAdditionalAccessEvent args)
|
||||
private void OnGetAdditionalAccess(EntityUid uid, MechComponent component, ref GetAdditionalAccessEvent args)
|
||||
{
|
||||
var pilot = component.PilotSlot.ContainedEntity;
|
||||
if (pilot == null)
|
||||
@@ -163,7 +163,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
args.Entities.UnionWith(items);
|
||||
}
|
||||
|
||||
private void SetupUser(EntityUid mech, EntityUid pilot, SharedMechComponent? component = null)
|
||||
private void SetupUser(EntityUid mech, EntityUid pilot, MechComponent? component = null)
|
||||
{
|
||||
if (!Resolve(mech, ref component))
|
||||
return;
|
||||
@@ -202,7 +202,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
/// </summary>
|
||||
/// <param name="uid"></param>
|
||||
/// <param name="component"></param>
|
||||
public virtual void BreakMech(EntityUid uid, SharedMechComponent? component = null)
|
||||
public virtual void BreakMech(EntityUid uid, MechComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
return;
|
||||
@@ -223,7 +223,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
/// </summary>
|
||||
/// <param name="uid"></param>
|
||||
/// <param name="component"></param>
|
||||
public void CycleEquipment(EntityUid uid, SharedMechComponent? component = null)
|
||||
public void CycleEquipment(EntityUid uid, MechComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
return;
|
||||
@@ -259,7 +259,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
/// <param name="toInsert"></param>
|
||||
/// <param name="component"></param>
|
||||
/// <param name="equipmentComponent"></param>
|
||||
public void InsertEquipment(EntityUid uid, EntityUid toInsert, SharedMechComponent? component = null,
|
||||
public void InsertEquipment(EntityUid uid, EntityUid toInsert, MechComponent? component = null,
|
||||
MechEquipmentComponent? equipmentComponent = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
@@ -289,7 +289,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
/// <param name="component"></param>
|
||||
/// <param name="equipmentComponent"></param>
|
||||
/// <param name="forced">Whether or not the removal can be cancelled</param>
|
||||
public void RemoveEquipment(EntityUid uid, EntityUid toRemove, SharedMechComponent? component = null,
|
||||
public void RemoveEquipment(EntityUid uid, EntityUid toRemove, MechComponent? component = null,
|
||||
MechEquipmentComponent? equipmentComponent = null, bool forced = false)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
@@ -324,7 +324,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
/// <param name="delta">The change in energy</param>
|
||||
/// <param name="component"></param>
|
||||
/// <returns>If the energy was successfully changed.</returns>
|
||||
public virtual bool TryChangeEnergy(EntityUid uid, FixedPoint2 delta, SharedMechComponent? component = null)
|
||||
public virtual bool TryChangeEnergy(EntityUid uid, FixedPoint2 delta, MechComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
return false;
|
||||
@@ -344,7 +344,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
/// <param name="uid">The mech itself</param>
|
||||
/// <param name="value">The value the integrity will be set at</param>
|
||||
/// <param name="component"></param>
|
||||
public void SetIntegrity(EntityUid uid, FixedPoint2 value, SharedMechComponent? component = null)
|
||||
public void SetIntegrity(EntityUid uid, FixedPoint2 value, MechComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
return;
|
||||
@@ -370,7 +370,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
/// </summary>
|
||||
/// <param name="component"></param>
|
||||
/// <returns>Whether or not the pilot is present</returns>
|
||||
public bool IsEmpty(SharedMechComponent component)
|
||||
public bool IsEmpty(MechComponent component)
|
||||
{
|
||||
return component.PilotSlot.ContainedEntity == null;
|
||||
}
|
||||
@@ -382,7 +382,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
/// <param name="toInsert"></param>
|
||||
/// <param name="component"></param>
|
||||
/// <returns></returns>
|
||||
public bool CanInsert(EntityUid uid, EntityUid toInsert, SharedMechComponent? component = null)
|
||||
public bool CanInsert(EntityUid uid, EntityUid toInsert, MechComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
return false;
|
||||
@@ -396,7 +396,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
/// <remarks>
|
||||
/// This is defined here so that UI updates can be accessed from shared.
|
||||
/// </remarks>
|
||||
public virtual void UpdateUserInterface(EntityUid uid, SharedMechComponent? component = null)
|
||||
public virtual void UpdateUserInterface(EntityUid uid, MechComponent? component = null)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
/// <param name="toInsert"></param>
|
||||
/// <param name="component"></param>
|
||||
/// <returns>Whether or not the entity was inserted</returns>
|
||||
public virtual bool TryInsert(EntityUid uid, EntityUid? toInsert, SharedMechComponent? component = null)
|
||||
public virtual bool TryInsert(EntityUid uid, EntityUid? toInsert, MechComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
return false;
|
||||
@@ -430,7 +430,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
/// <param name="uid"></param>
|
||||
/// <param name="component"></param>
|
||||
/// <returns>Whether or not the pilot was ejected.</returns>
|
||||
public virtual bool TryEject(EntityUid uid, SharedMechComponent? component = null)
|
||||
public virtual bool TryEject(EntityUid uid, MechComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
return false;
|
||||
@@ -451,7 +451,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
if (!TryComp<SharedMechComponent>(component.Mech, out var mech))
|
||||
if (!TryComp<MechComponent>(component.Mech, out var mech))
|
||||
return;
|
||||
|
||||
var weapon = mech.CurrentSelectedEquipment ?? component.Mech;
|
||||
@@ -470,7 +470,7 @@ public abstract class SharedMechSystem : EntitySystem
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
private void UpdateAppearance(EntityUid uid, SharedMechComponent? component = null,
|
||||
private void UpdateAppearance(EntityUid uid, MechComponent? component = null,
|
||||
AppearanceComponent? appearance = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component, ref appearance, false))
|
||||
|
||||
Reference in New Issue
Block a user