Files
tbd-station-14/Content.Server/GameObjects/Components/PA/ParticleAcceleratorPartComponent.cs
Acruid ca4fd649fe Massive Namespace Cleanup (#3120)
* Engine namespace changes.

* Automated remove redundant using statements.

* Simplified Graphics namespace.

* Apparently the container system stores full type names in the map file.😞 This updates those names.

* API Changes to LocalizationManager.LoadCulture.

* Update submodule to v0.3.2
2021-02-11 01:13:03 -08:00

58 lines
1.4 KiB
C#

#nullable enable
using Robust.Shared.GameObjects;
using Robust.Shared.Log;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.PA
{
public abstract class ParticleAcceleratorPartComponent : Component
{
[ViewVariables] public ParticleAcceleratorControlBoxComponent? Master;
[ViewVariables] protected SnapGridComponent? SnapGrid;
public override void Initialize()
{
base.Initialize();
// FIXME: this has to be an entity system, full stop.
if (!Owner.TryGetComponent(out SnapGrid))
{
Logger.Error("ParticleAcceleratorControlBox was created without SnapGridComponent");
}
}
public override void HandleMessage(ComponentMessage message, IComponent? component)
{
base.HandleMessage(message, component);
switch (message)
{
case AnchoredChangedMessage:
OnAnchorChanged();
break;
}
}
public void OnAnchorChanged()
{
RescanIfPossible();
}
public override void OnRemove()
{
base.OnRemove();
RescanIfPossible();
}
private void RescanIfPossible()
{
Master?.RescanParts();
}
public virtual void Rotated()
{
RescanIfPossible();
}
}
}