Adds new different reaction types. (#2114)
* Adds new different reaction types. - Adds touch, injection and ingestion reactions for entities. - Adds tile reactions. - Removes GasSprayerComponent in favor of SprayComponent. - Gives fire extinguishers a safety. - Gives spray puffs a sprite. - Improved spray and fire extinguisher in general. - Fire extinguisher now ACTUALLY puts out fires. Amazing, eh? - Fire extinguisher sprays three 'clouds' at once. - Spraying flammable chemicals at fire makes them worse. Whoops! - Gives spray and fire extinguisher their classic sounds. - Most chemicals now don't make puddles. Too bad! - Space lube now makes a very slippery puddle. Honk. - Spraying water (or using a fire extinguisher) on existing puddles makes them bigger. * Fix solution tests * food base now has solution container with noexamine caps
This commit is contained in:
committed by
GitHub
parent
37d6ca556f
commit
69059eac80
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Interfaces.Chemistry;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.Chemistry.TileReactions
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class ExtinguishTileReaction : ITileReaction
|
||||
{
|
||||
private float _coolingTemperature = 2f;
|
||||
|
||||
public void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(ref _coolingTemperature, "coolingTemperature", 2f);
|
||||
}
|
||||
|
||||
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||
{
|
||||
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty) return ReagentUnit.Zero;
|
||||
var tileAtmos = tile.GridIndices.GetTileAtmosphere(tile.GridIndex);
|
||||
if (tileAtmos == null || !tileAtmos.Hotspot.Valid) return ReagentUnit.Zero;
|
||||
tileAtmos.Air.Temperature =
|
||||
MathF.Max(MathF.Min(tileAtmos.Air.Temperature - (_coolingTemperature * 1000f),
|
||||
tileAtmos.Air.Temperature / _coolingTemperature),
|
||||
Atmospherics.TCMB);
|
||||
tileAtmos.Air.React(tileAtmos);
|
||||
tileAtmos.Hotspot = new Hotspot();
|
||||
tileAtmos.UpdateVisuals();
|
||||
return ReagentUnit.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Interfaces.Chemistry;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.Chemistry.TileReactions
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class FlammableTileReaction : ITileReaction
|
||||
{
|
||||
private float _temperatureMultiplier = 1.25f;
|
||||
|
||||
public void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(ref _temperatureMultiplier, "temperatureMultiplier", 1.15f);
|
||||
}
|
||||
|
||||
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||
{
|
||||
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty) return ReagentUnit.Zero;
|
||||
var tileAtmos = tile.GridIndices.GetTileAtmosphere(tile.GridIndex);
|
||||
if (tileAtmos == null || !tileAtmos.Hotspot.Valid) return ReagentUnit.Zero;
|
||||
tileAtmos.Air.Temperature *= MathF.Max(_temperatureMultiplier * reactVolume.Float(), 1f);
|
||||
tileAtmos.Air.React(tileAtmos);
|
||||
return reactVolume;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using Content.Server.GameObjects.Components.Fluids;
|
||||
using Content.Server.GameObjects.Components.Movement;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Interfaces.Chemistry;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.Chemistry.TileReactions
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class SpillIfPuddlePresentTileReaction : ITileReaction
|
||||
{
|
||||
public void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
}
|
||||
|
||||
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||
{
|
||||
if (reactVolume < 5 || !tile.TryGetPuddle(null, out _)) return ReagentUnit.Zero;
|
||||
|
||||
return tile.SpillAt(new Solution(reagent.ID, reactVolume), "PuddleSmear", true, false) != null ? reactVolume : ReagentUnit.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
49
Content.Server/Chemistry/TileReactions/SpillTileReaction.cs
Normal file
49
Content.Server/Chemistry/TileReactions/SpillTileReaction.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using Content.Server.GameObjects.Components.Fluids;
|
||||
using Content.Server.GameObjects.Components.Movement;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Interfaces.Chemistry;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.Chemistry.TileReactions
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class SpillTileReaction : ITileReaction
|
||||
{
|
||||
private float _launchForwardsMultiplier = 1f;
|
||||
private float _requiredSlipSpeed = 6f;
|
||||
private float _paralyzeTime = 1f;
|
||||
private bool _overflow;
|
||||
|
||||
public void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
// If you want to modify more puddle/slippery values, add them here.
|
||||
serializer.DataField(ref _paralyzeTime, "paralyzeTime", 1f);
|
||||
serializer.DataField(ref _launchForwardsMultiplier, "launchForwardsMultiplier", 1f);
|
||||
serializer.DataField(ref _requiredSlipSpeed, "requiredSlipSpeed", 6f);
|
||||
serializer.DataField(ref _overflow, "overflow", false);
|
||||
}
|
||||
|
||||
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||
{
|
||||
if (reactVolume < 5) return ReagentUnit.Zero;
|
||||
|
||||
// TODO Make this not puddle smear.
|
||||
var puddle = tile.SpillAt(new Solution(reagent.ID, reactVolume), "PuddleSmear", _overflow, false);
|
||||
|
||||
if (puddle != null)
|
||||
{
|
||||
var slippery = puddle.Owner.GetComponent<SlipperyComponent>();
|
||||
slippery.LaunchForwardsMultiplier = _launchForwardsMultiplier;
|
||||
slippery.RequiredSlipSpeed = _requiredSlipSpeed;
|
||||
slippery.ParalyzeTime = _paralyzeTime;
|
||||
|
||||
return reactVolume;
|
||||
}
|
||||
|
||||
return ReagentUnit.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user