Adds FlammableComponent, humans can now catch on fire. (#2115)
This commit is contained in:
committed by
GitHub
parent
4c34a12c67
commit
31e0dfc10c
@@ -2,15 +2,8 @@
|
||||
|
||||
namespace Content.Server.Atmos
|
||||
{
|
||||
public class FireActEvent : EntitySystemMessage
|
||||
public interface IFireAct
|
||||
{
|
||||
public float Temperature { get; }
|
||||
public float Volume { get; }
|
||||
|
||||
public FireActEvent(float temperature, float volume)
|
||||
{
|
||||
Temperature = temperature;
|
||||
Volume = volume;
|
||||
}
|
||||
void FireAct(float temperature, float volume);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,7 +509,7 @@ namespace Content.Server.Atmos
|
||||
if (!doReaction)
|
||||
continue;
|
||||
|
||||
reaction = prototype.React(this, holder, _atmosphereSystem.EventBus);
|
||||
reaction = prototype.React(this, holder, _atmosphereSystem.GridTileLookupSystem);
|
||||
if(reaction.HasFlag(ReactionResult.StopReactions))
|
||||
break;
|
||||
}
|
||||
|
||||
10
Content.Server/Atmos/ITemperatureExpose.cs
Normal file
10
Content.Server/Atmos/ITemperatureExpose.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Atmos
|
||||
{
|
||||
public interface ITemperatureExpose
|
||||
{
|
||||
void TemperatureExpose(GasMixture air, float exposedTemperature, float exposedVolume);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Server.GameObjects.EntitySystems.TileLookup;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -65,13 +66,13 @@ namespace Content.Server.Atmos.Reactions
|
||||
serializer.DataField(ref _effects, "effects", new List<IGasReactionEffect>());
|
||||
}
|
||||
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder holder, IEventBus eventBus)
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder holder, GridTileLookupSystem gridLookup)
|
||||
{
|
||||
var result = ReactionResult.NoReaction;
|
||||
|
||||
foreach (var effect in _effects)
|
||||
{
|
||||
result |= effect.React(mixture, holder, eventBus);
|
||||
result |= effect.React(mixture, holder, gridLookup);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects.EntitySystems.TileLookup;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -11,7 +13,7 @@ namespace Content.Server.Atmos.Reactions
|
||||
[UsedImplicitly]
|
||||
public class PhoronFireReaction : IGasReactionEffect
|
||||
{
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, IEventBus eventBus)
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, GridTileLookupSystem gridTileLookup)
|
||||
{
|
||||
var energyReleased = 0f;
|
||||
var oldHeatCapacity = mixture.HeatCapacity;
|
||||
@@ -72,7 +74,15 @@ namespace Content.Server.Atmos.Reactions
|
||||
{
|
||||
location.HotspotExpose(temperature, mixture.Volume);
|
||||
|
||||
eventBus.QueueEvent(EventSource.Local, new TemperatureExposeEvent(location.GridIndices, location.GridIndex, mixture, temperature, mixture.Volume));
|
||||
foreach (var entity in location.GridIndices.GetEntitiesInTileFast(location.GridIndex, gridTileLookup))
|
||||
{
|
||||
foreach (var temperatureExpose in entity.GetAllComponents<ITemperatureExpose>())
|
||||
{
|
||||
temperatureExpose.TemperatureExpose(mixture, temperature, mixture.Volume);
|
||||
}
|
||||
}
|
||||
|
||||
location.TemperatureExpose(mixture, temperature, mixture.Volume);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#nullable enable
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects.EntitySystems.TileLookup;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -14,7 +16,7 @@ namespace Content.Server.Atmos.Reactions
|
||||
{
|
||||
}
|
||||
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, IEventBus eventBus)
|
||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, GridTileLookupSystem gridTileLookup)
|
||||
{
|
||||
var energyReleased = 0f;
|
||||
var oldHeatCapacity = mixture.HeatCapacity;
|
||||
@@ -67,7 +69,15 @@ namespace Content.Server.Atmos.Reactions
|
||||
{
|
||||
location.HotspotExpose(temperature, mixture.Volume);
|
||||
|
||||
eventBus.QueueEvent(EventSource.Local, new TemperatureExposeEvent(location.GridIndices, location.GridIndex, mixture, temperature, mixture.Volume));
|
||||
foreach (var entity in location.GridIndices.GetEntitiesInTileFast(location.GridIndex, gridTileLookup))
|
||||
{
|
||||
foreach (var temperatureExpose in entity.GetAllComponents<ITemperatureExpose>())
|
||||
{
|
||||
temperatureExpose.TemperatureExpose(mixture, temperature, mixture.Volume);
|
||||
}
|
||||
}
|
||||
|
||||
location.TemperatureExpose(mixture, temperature, mixture.Volume);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Atmos
|
||||
{
|
||||
public class TemperatureExposeEvent : EntitySystemMessage
|
||||
{
|
||||
public MapIndices Indices { get; }
|
||||
public GridId Grid { get; }
|
||||
public GasMixture Air { get; }
|
||||
public float Temperature { get; }
|
||||
public float Volume { get; }
|
||||
|
||||
public TemperatureExposeEvent(MapIndices indices, GridId gridId, GasMixture air, float temperature, float volume)
|
||||
{
|
||||
Indices = indices;
|
||||
Grid = gridId;
|
||||
Air = air;
|
||||
Temperature = temperature;
|
||||
Volume = volume;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -821,8 +821,14 @@ namespace Content.Server.Atmos
|
||||
|
||||
if (tileRef == null) return;
|
||||
|
||||
_gridAtmosphereComponent.Owner.EntityManager.
|
||||
EventBus.QueueEvent(EventSource.Local, new FireActEvent(Hotspot.Temperature, Hotspot.Volume));
|
||||
foreach (var entity in tileRef?.GetEntitiesInTileFast(_gridTileLookupSystem))
|
||||
{
|
||||
foreach (var fireAct in entity.GetAllComponents<IFireAct>())
|
||||
{
|
||||
|
||||
fireAct.FireAct(Hotspot.Temperature, Hotspot.Volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ConsiderSuperconductivity()
|
||||
|
||||
Reference in New Issue
Block a user