2022-07-04 16:51:34 +02:00
|
|
|
using Content.Server.Atmos.Components;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Atmos.EntitySystems;
|
|
|
|
|
|
|
|
|
|
public partial class AtmosphereSystem
|
|
|
|
|
{
|
|
|
|
|
private void InitializeMap()
|
|
|
|
|
{
|
|
|
|
|
SubscribeLocalEvent<MapAtmosphereComponent, IsTileSpaceMethodEvent>(MapIsTileSpace);
|
|
|
|
|
SubscribeLocalEvent<MapAtmosphereComponent, GetTileMixtureMethodEvent>(MapGetTileMixture);
|
2022-11-09 08:55:45 +13:00
|
|
|
SubscribeLocalEvent<MapAtmosphereComponent, GetTileMixturesMethodEvent>(MapGetTileMixtures);
|
2022-07-04 16:51:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MapIsTileSpace(EntityUid uid, MapAtmosphereComponent component, ref IsTileSpaceMethodEvent args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Handled)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
args.Result = component.Space;
|
|
|
|
|
args.Handled = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MapGetTileMixture(EntityUid uid, MapAtmosphereComponent component, ref GetTileMixtureMethodEvent args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Handled)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Clone the mixture, if possible.
|
|
|
|
|
args.Mixture = component.Mixture?.Clone();
|
|
|
|
|
args.Handled = true;
|
|
|
|
|
}
|
2022-11-09 08:55:45 +13:00
|
|
|
|
|
|
|
|
private void MapGetTileMixtures(EntityUid uid, MapAtmosphereComponent component, ref GetTileMixturesMethodEvent args)
|
|
|
|
|
{
|
2022-11-11 17:21:01 +13:00
|
|
|
if (args.Handled || component.Mixture == null)
|
2022-11-09 08:55:45 +13:00
|
|
|
return;
|
|
|
|
|
args.Handled = true;
|
2022-11-11 17:21:01 +13:00
|
|
|
args.Mixtures ??= new GasMixture?[args.Tiles.Count];
|
2022-11-09 08:55:45 +13:00
|
|
|
|
|
|
|
|
for (var i = 0; i < args.Tiles.Count; i++)
|
|
|
|
|
{
|
2022-11-11 17:21:01 +13:00
|
|
|
args.Mixtures[i] ??= component.Mixture.Clone();
|
2022-11-09 08:55:45 +13:00
|
|
|
}
|
|
|
|
|
}
|
2022-07-04 16:51:34 +02:00
|
|
|
}
|