Adds FlammableComponent, humans can now catch on fire. (#2115)

This commit is contained in:
Víctor Aguilera Puerto
2020-09-22 15:40:04 +02:00
committed by GitHub
parent 4c34a12c67
commit 31e0dfc10c
33 changed files with 457 additions and 54 deletions

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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);
}
}