Atmos optimizations (#1944)

* Adds IFireAct, ITemperatureExpose

* Use AtmosDirection instead of Direction for Atmos

* Refactor atmos to heavily rely on arrays and bitflags.
Adds F A S T M O S and reduces atmos tech debt heavily.

* Optimize and fix more stuff

* Kinda improve superconduction

* Pipenet is a word

* T U R B O M O S

* Address reviews

* Small optimization

* Superconduct is also a word

* Remove check

* Cleanup tile atmosphere

* Correct a comment
This commit is contained in:
Víctor Aguilera Puerto
2020-08-28 14:32:56 +02:00
committed by GitHub
parent 3758eb1b60
commit fb0ac3d70e
16 changed files with 619 additions and 275 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Content.Server.Interfaces;
using Content.Shared.Atmos;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using YamlDotNet.RepresentationModel;
@@ -64,13 +65,13 @@ namespace Content.Server.Atmos.Reactions
serializer.DataField(ref _effects, "effects", new List<IGasReactionEffect>());
}
public ReactionResult React(GasMixture mixture, IGasMixtureHolder holder)
public ReactionResult React(GasMixture mixture, IGasMixtureHolder holder, IEventBus eventBus)
{
var result = ReactionResult.NoReaction;
foreach (var effect in _effects)
{
result |= effect.React(mixture, holder);
result |= effect.React(mixture, holder, eventBus);
}
return result;

View File

@@ -1,8 +1,12 @@
#nullable enable
using System;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Atmos;
using Content.Shared.Maps;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
namespace Content.Server.Atmos.Reactions
@@ -10,7 +14,7 @@ namespace Content.Server.Atmos.Reactions
[UsedImplicitly]
public class PhoronFireReaction : IGasReactionEffect
{
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder)
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, IEventBus eventBus)
{
var energyReleased = 0f;
var oldHeatCapacity = mixture.HeatCapacity;
@@ -71,9 +75,7 @@ namespace Content.Server.Atmos.Reactions
{
location.HotspotExpose(temperature, mixture.Volume);
// TODO ATMOS Expose temperature all items on cell
location.TemperatureExpose(mixture, temperature, mixture.Volume);
eventBus.QueueEvent(EventSource.Local, new TemperatureExposeEvent(location.GridIndices, location.GridIndex, mixture, temperature, mixture.Volume));
}
}

View File

@@ -1,7 +1,10 @@
#nullable enable
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Atmos;
using Content.Shared.Maps;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.Atmos.Reactions
@@ -13,7 +16,7 @@ namespace Content.Server.Atmos.Reactions
{
}
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder)
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, IEventBus eventBus)
{
var energyReleased = 0f;
var oldHeatCapacity = mixture.HeatCapacity;
@@ -66,9 +69,7 @@ namespace Content.Server.Atmos.Reactions
{
location.HotspotExpose(temperature, mixture.Volume);
// TODO ATMOS Expose temperature all items on cell
location.TemperatureExpose(mixture, temperature, mixture.Volume);
eventBus.QueueEvent(EventSource.Local, new TemperatureExposeEvent(location.GridIndices, location.GridIndex, mixture, temperature, mixture.Volume));
}
}