Remove atmos method events (#26402)

* Remove HasAtmosphereMethodEvent

* Remove GetTileMixturesMethodEvent

* Remove GetTileMixtureMethodEvent

* Remove GetAdjacentTilesMethodEvent

* Add TileMixtureEnumerator

* Remove GetAdjacentTileMixturesMethodEvent

* Remove IsTileSpaceMethodEvent

* Remove HotspotExposeMethodEvent

* Remove pipe net method events

* Remove device method events

* Use Entity<T>

* Misc fixes

* A

* Theres probably a few more of these

* Fix other resolve errors
This commit is contained in:
Leon Friedrich
2024-03-28 15:22:19 +13:00
committed by GitHub
parent 29fb3ca4a9
commit 77e029d4ca
17 changed files with 170 additions and 358 deletions

View File

@@ -1,7 +1,9 @@
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Components;
using JetBrains.Annotations;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
namespace Content.Server.Atmos.Piping.EntitySystems
{
@@ -32,6 +34,14 @@ namespace Content.Server.Atmos.Piping.EntitySystems
public void JoinAtmosphere(Entity<AtmosDeviceComponent> ent)
{
if (ent.Comp.JoinedGrid != null)
{
DebugTools.Assert(HasComp<GridAtmosphereComponent>(ent.Comp.JoinedGrid));
DebugTools.Assert(Transform(ent).GridUid == ent.Comp.JoinedGrid);
DebugTools.Assert(ent.Comp.RequireAnchored == Transform(ent).Anchored);
return;
}
var component = ent.Comp;
var transform = Transform(ent);
@@ -39,7 +49,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
return;
// Attempt to add device to a grid atmosphere.
bool onGrid = (transform.GridUid != null) && _atmosphereSystem.AddAtmosDevice(transform.GridUid!.Value, component);
bool onGrid = (transform.GridUid != null) && _atmosphereSystem.AddAtmosDevice(transform.GridUid!.Value, ent);
if (!onGrid && component.JoinSystem)
{
@@ -55,7 +65,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
{
var component = ent.Comp;
// Try to remove the component from an atmosphere, and if not
if (component.JoinedGrid != null && !_atmosphereSystem.RemoveAtmosDevice(component.JoinedGrid.Value, component))
if (component.JoinedGrid != null && !_atmosphereSystem.RemoveAtmosDevice(component.JoinedGrid.Value, ent))
{
// The grid might have been removed but not us... This usually shouldn't happen.
component.JoinedGrid = null;