Merge branch 'master' into replace-sounds-with-sound-specifier

# Conflicts:
#	Content.Server/Actions/Actions/DisarmAction.cs
#	Content.Server/Actions/Actions/ScreamAction.cs
#	Content.Server/Arcade/Components/SpaceVillainArcadeComponent.cs
#	Content.Server/Damage/Components/DamageOnHighSpeedImpactComponent.cs
#	Content.Server/Explosion/Components/FlashExplosiveComponent.cs
#	Content.Server/Physics/Controllers/MoverController.cs
#	Content.Server/Portal/Components/PortalComponent.cs
#	Content.Server/Portal/Components/TeleporterComponent.cs
#	Content.Server/Projectiles/Components/ProjectileComponent.cs
#	Content.Server/Singularity/Components/EmitterComponent.cs
#	Content.Server/Sound/EmitSoundSystem.cs
#	Content.Server/Stunnable/Components/StunbatonComponent.cs
#	Content.Server/Tools/Components/MultitoolComponent.cs
#	Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs
#	Content.Shared/Gravity/GravityComponent.cs
#	Content.Shared/Light/Component/SharedExpendableLightComponent.cs
#	Content.Shared/Maps/ContentTileDefinition.cs
#	Content.Shared/Slippery/SlipperyComponent.cs
#	Content.Shared/Standing/StandingStateComponent.cs
#	Resources/Prototypes/Entities/Objects/Fun/bike_horn.yml
This commit is contained in:
Galactic Chimp
2021-07-25 14:12:00 +02:00
4171 changed files with 15603 additions and 14404 deletions

View File

@@ -1,4 +1,3 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

View File

@@ -1,49 +0,0 @@
using System;
using Content.Server.Body.Circulatory;
using Content.Shared.Chemistry.Reagent;
using Robust.Shared.GameObjects;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.Chemistry.Components
{
[RegisterComponent]
public class ChemicalInjectionProjectileComponent : Component, IStartCollide
{
public override string Name => "ChemicalInjectionProjectile";
[ViewVariables]
private SolutionContainerComponent _solutionContainer = default!;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("transferAmount")]
public ReagentUnit TransferAmount { get; set; } = ReagentUnit.New(1);
[ViewVariables(VVAccess.ReadWrite)]
public float TransferEfficiency { get => _transferEfficiency; set => _transferEfficiency = Math.Clamp(value, 0, 1); }
[DataField("transferEfficiency")]
private float _transferEfficiency = 1f;
protected override void Initialize()
{
base.Initialize();
_solutionContainer = Owner.EnsureComponent<SolutionContainerComponent>();
}
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
if (!otherFixture.Body.Owner.TryGetComponent<BloodstreamComponent>(out var bloodstream))
return;
var solution = _solutionContainer.Solution;
var solRemoved = solution.SplitSolution(TransferAmount);
var solRemovedVol = solRemoved.TotalVolume;
var solToInject = solRemoved.SplitSolution(solRemovedVol * TransferEfficiency);
bloodstream.TryTransferSolution(solToInject);
}
}
}

View File

@@ -1,5 +1,4 @@
#nullable enable
using Content.Server.Body.Circulatory;
using Content.Server.Body.Circulatory;
using Content.Server.Inventory.Components;
using Content.Server.Items;
using Content.Shared.Chemistry.Reagent;

View File

@@ -1,4 +1,3 @@
#nullable enable
using System;
using System.Threading.Tasks;
using Content.Server.Body.Circulatory;

View File

@@ -1,4 +1,3 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;

View File

@@ -3,7 +3,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
#nullable enable
namespace Content.Server.Chemistry.Components
{

View File

@@ -1,4 +1,3 @@
#nullable enable
using Content.Server.Notification;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Reagent;

View File

@@ -1,5 +1,4 @@
#nullable enable
using System.Linq;
using System.Linq;
using Content.Server.Body.Circulatory;
using Content.Server.Body.Respiratory;
using Content.Shared.Chemistry;

View File

@@ -1,4 +1,3 @@
#nullable enable
using System;
using System.Linq;
using Content.Server.Atmos.Components;

View File

@@ -1,5 +1,4 @@
#nullable enable
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Robust.Shared.GameObjects;
using Robust.Shared.ViewVariables;

View File

@@ -1,5 +1,4 @@
#nullable enable
using Content.Shared.Chemistry.Solution.Components;
using Content.Shared.Chemistry.Solution.Components;
using Robust.Shared.GameObjects;
namespace Content.Server.Chemistry.Components

View File

@@ -0,0 +1,27 @@
using System;
using Content.Shared.Chemistry.Reagent;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.Chemistry.Components
{
/// <summary>
/// On colliding with an entity that has a bloodstream will dump its solution onto them.
/// </summary>
[RegisterComponent]
internal sealed class SolutionInjectOnCollideComponent : Component
{
public override string Name => "SolutionInjectOnCollide";
[ViewVariables(VVAccess.ReadWrite)]
[DataField("transferAmount")]
public ReagentUnit TransferAmount { get; set; } = ReagentUnit.New(1);
[ViewVariables(VVAccess.ReadWrite)]
public float TransferEfficiency { get => _transferEfficiency; set => _transferEfficiency = Math.Clamp(value, 0, 1); }
[DataField("transferEfficiency")]
private float _transferEfficiency = 1f;
}
}

View File

@@ -1,10 +1,15 @@
#nullable enable
using System;
using System.Threading.Tasks;
using Content.Server.UserInterface;
using Content.Shared.ActionBlocker;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Chemistry.Solution.Components;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Notification.Managers;
using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
@@ -32,6 +37,35 @@ namespace Content.Server.Chemistry.Components
[ViewVariables(VVAccess.ReadWrite)]
public ReagentUnit TransferAmount { get; set; } = ReagentUnit.New(5);
/// <summary>
/// The minimum amount of solution that can be transferred at once from this solution.
/// </summary>
[DataField("minTransferAmount")]
[ViewVariables(VVAccess.ReadWrite)]
public ReagentUnit MinimumTransferAmount { get; set; } = ReagentUnit.New(5);
/// <summary>
/// The maximum amount of solution that can be transferred at once from this solution.
/// </summary>
[DataField("maxTransferAmount")]
[ViewVariables(VVAccess.ReadWrite)]
public ReagentUnit MaximumTransferAmount { get; set; } = ReagentUnit.New(50);
/// <summary>
/// Subjectively, which transfer amount would be best for most activities given the maximum
/// transfer amount.
/// </summary>
public ReagentUnit SubjectiveBestTransferAmount() =>
MaximumTransferAmount.Int() switch
{
<= 5 => ReagentUnit.New(1),
(> 5) and (<= 25) => ReagentUnit.New(5),
(> 25) and (<= 50) => ReagentUnit.New(10),
(> 50) and (<= 100) => ReagentUnit.New(20),
(> 100) and (<= 500) => ReagentUnit.New(50),
(> 500) => ReagentUnit.New(100)
};
/// <summary>
/// Can this entity take reagent from reagent tanks?
/// </summary>
@@ -46,6 +80,46 @@ namespace Content.Server.Chemistry.Components
[ViewVariables(VVAccess.ReadWrite)]
public bool CanSend { get; set; } = true;
/// <summary>
/// Whether you're allowed to change the transfer amount.
/// </summary>
[DataField("canChangeTransferAmount")]
[ViewVariables(VVAccess.ReadWrite)]
public bool CanChangeTransferAmount { get; set; } = false;
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(TransferAmountUiKey.Key);
protected override void Initialize()
{
base.Initialize();
if (UserInterface != null)
{
UserInterface.OnReceiveMessage += UserInterfaceOnReceiveMessage;
}
}
public void UserInterfaceOnReceiveMessage(ServerBoundUserInterfaceMessage serverMsg)
{
switch (serverMsg.Message)
{
case TransferAmountSetValueMessage svm:
var sval = svm.Value.Float();
var amount = Math.Clamp(sval, MinimumTransferAmount.Float(),
MaximumTransferAmount.Float());
serverMsg.Session.AttachedEntity?.PopupMessage(Loc.GetString("comp-solution-transfer-set-amount", ("amount", amount)));
SetTransferAmount(ReagentUnit.New(amount));
break;
}
}
public void SetTransferAmount(ReagentUnit amount)
{
amount = ReagentUnit.New(Math.Clamp(amount.Int(), MinimumTransferAmount.Int(), MaximumTransferAmount.Int()));
TransferAmount = amount;
}
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
{
if (!eventArgs.InRangeUnobstructed() || eventArgs.Target == null)
@@ -68,8 +142,8 @@ namespace Content.Server.Chemistry.Components
{
var toTheBrim = ownerSolution.RefillSpaceAvailable == 0;
var msg = toTheBrim
? "solution-transfer-component-fill-to-brim-message"
: "solution-transfer-component-fill--message";
? "comp-solution-transfer-fill-fully"
: "comp-solution-transfer-fill-normal";
target.PopupMessage(eventArgs.User, Loc.GetString(msg,("owner", Owner),("amount", transferred),("target", target)));
return true;
@@ -83,7 +157,7 @@ namespace Content.Server.Chemistry.Components
if (transferred > 0)
{
Owner.PopupMessage(eventArgs.User,
Loc.GetString("solution-transfer-component-transfer-success-message",
Loc.GetString("comp-solution-transfer-transfer-solution",
("amount",transferred),
("target",target)));
@@ -103,13 +177,13 @@ namespace Content.Server.Chemistry.Components
{
if (source.DrainAvailable == 0)
{
source.Owner.PopupMessage(user, Loc.GetString("solution-transfer-component-do-transfer-component-is-empty", ("entity",source.Owner)));
source.Owner.PopupMessage(user, Loc.GetString("comp-solution-transfer-is-empty", ("target", source.Owner)));
return ReagentUnit.Zero;
}
if (target.RefillSpaceAvailable == 0)
{
target.Owner.PopupMessage(user, Loc.GetString("solution-transfer-component-do-transfer-component-is-full", ("entity", target.Owner)));
target.Owner.PopupMessage(user, Loc.GetString("comp-solution-transfer-is-full", ("target", target.Owner)));
return ReagentUnit.Zero;
}
@@ -121,5 +195,114 @@ namespace Content.Server.Chemistry.Components
return actualAmount;
}
// TODO refactor when dynamic verbs are a thing
[Verb]
public sealed class MinimumTransferVerb : Verb<SolutionTransferComponent>
{
protected override void GetData(IEntity user, SolutionTransferComponent component, VerbData data)
{
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) || !component.CanChangeTransferAmount)
{
data.Visibility = VerbVisibility.Invisible;
return;
}
data.Visibility = VerbVisibility.Visible;
data.Text = Loc.GetString("comp-solution-transfer-verb-transfer-amount-min",
("amount", component.MinimumTransferAmount.Int()));
data.CategoryData = VerbCategories.SetTransferAmount;
}
protected override void Activate(IEntity user, SolutionTransferComponent component)
{
component.TransferAmount = component.MinimumTransferAmount;
user.PopupMessage(Loc.GetString("comp-solution-transfer-set-amount",
("amount", component.TransferAmount.Int())));
}
}
[Verb]
public sealed class DefaultTransferVerb : Verb<SolutionTransferComponent>
{
protected override void GetData(IEntity user, SolutionTransferComponent component, VerbData data)
{
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) || !component.CanChangeTransferAmount)
{
data.Visibility = VerbVisibility.Invisible;
return;
}
var amt = component.SubjectiveBestTransferAmount();
if (amt > component.MinimumTransferAmount && amt < component.MaximumTransferAmount)
{
data.Visibility = VerbVisibility.Visible;
data.Text = Loc.GetString("comp-solution-transfer-verb-transfer-amount-ideal",
("amount", amt.Int()));
data.CategoryData = VerbCategories.SetTransferAmount;
}
else
{
data.Visibility = VerbVisibility.Invisible;
}
}
protected override void Activate(IEntity user, SolutionTransferComponent component)
{
component.TransferAmount = component.SubjectiveBestTransferAmount();
user.PopupMessage(Loc.GetString("comp-solution-transfer-set-amount", ("amount", component.TransferAmount.Int())));
}
}
[Verb]
public sealed class MaximumTransferVerb : Verb<SolutionTransferComponent>
{
protected override void GetData(IEntity user, SolutionTransferComponent component, VerbData data)
{
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) || !component.CanChangeTransferAmount)
{
data.Visibility = VerbVisibility.Invisible;
return;
}
data.Visibility = VerbVisibility.Visible;
data.Text = Loc.GetString("comp-solution-transfer-verb-transfer-amount-max",
("amount", component.MaximumTransferAmount));
data.CategoryData = VerbCategories.SetTransferAmount;
}
protected override void Activate(IEntity user, SolutionTransferComponent component)
{
component.TransferAmount = component.MaximumTransferAmount;
user.PopupMessage(Loc.GetString("comp-solution-transfer-set-amount", ("amount", component.TransferAmount.Int())));
}
}
[Verb]
public sealed class CustomTransferVerb : Verb<SolutionTransferComponent>
{
protected override void GetData(IEntity user, SolutionTransferComponent component, VerbData data)
{
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) || !component.CanChangeTransferAmount)
{
data.Visibility = VerbVisibility.Invisible;
return;
}
data.Visibility = VerbVisibility.Visible;
data.Text = Loc.GetString("comp-solution-transfer-verb-transfer-amount-custom");
data.CategoryData = VerbCategories.SetTransferAmount;
}
protected override void Activate(IEntity user, SolutionTransferComponent component)
{
if (!user.TryGetComponent<ActorComponent>(out var actor))
{
return;
}
component.UserInterface?.Open(actor.PlayerSession);
}
}
}
}

View File

@@ -1,4 +1,3 @@
#nullable enable
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Chemistry.Solution;

View File

@@ -1,131 +1,24 @@
using System.Linq;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Chemistry.Solution;
using Content.Shared.Physics;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Vapor;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.Chemistry.Components
{
[RegisterComponent]
class VaporComponent : SharedVaporComponent, IStartCollide
internal sealed class VaporComponent : SharedVaporComponent
{
public const float ReactTime = 0.125f;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[ViewVariables]
[DataField("transferAmount")]
private ReagentUnit _transferAmount = ReagentUnit.New(0.5);
internal ReagentUnit TransferAmount = ReagentUnit.New(0.5);
private bool _reached;
private float _reactTimer;
private float _timer;
private EntityCoordinates _target;
private bool _running;
private float _aliveTime;
protected override void Initialize()
{
base.Initialize();
Owner.EnsureComponentWarn(out SolutionContainerComponent _);
}
public void Start(Vector2 dir, float speed, EntityCoordinates target, float aliveTime)
{
_running = true;
_target = target;
_aliveTime = aliveTime;
// Set Move
if (Owner.TryGetComponent(out PhysicsComponent? physics))
{
physics.BodyStatus = BodyStatus.InAir;
physics.ApplyLinearImpulse(dir * speed);
}
}
public void Update(float frameTime)
{
if (!Owner.TryGetComponent(out SolutionContainerComponent? contents))
return;
if (!_running)
return;
_timer += frameTime;
_reactTimer += frameTime;
if (_reactTimer >= ReactTime && Owner.Transform.GridID.IsValid())
{
_reactTimer = 0;
var mapGrid = _mapManager.GetGrid(Owner.Transform.GridID);
var tile = mapGrid.GetTileRef(Owner.Transform.Coordinates.ToVector2i(Owner.EntityManager, _mapManager));
foreach (var reagentQuantity in contents.ReagentList.ToArray())
{
if (reagentQuantity.Quantity == ReagentUnit.Zero) continue;
var reagent = _prototypeManager.Index<ReagentPrototype>(reagentQuantity.ReagentId);
contents.TryRemoveReagent(reagentQuantity.ReagentId, reagent.ReactionTile(tile, (reagentQuantity.Quantity / _transferAmount) * 0.25f));
}
}
// Check if we've reached our target.
if(!_reached && _target.TryDistance(Owner.EntityManager, Owner.Transform.Coordinates, out var distance) && distance <= 0.5f)
{
_reached = true;
}
if (contents.CurrentVolume == 0 || _timer > _aliveTime)
{
// Delete this
Owner.Delete();
}
}
internal bool TryAddSolution(Solution solution)
{
if (solution.TotalVolume == 0)
{
return false;
}
if (!Owner.TryGetComponent(out SolutionContainerComponent? contents))
{
return false;
}
var result = contents.TryAddSolution(solution);
if (!result)
{
return false;
}
return true;
}
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
if (!Owner.TryGetComponent(out SolutionContainerComponent? contents))
return;
contents.Solution.DoEntityReaction(otherFixture.Body.Owner, ReactionMethod.Touch);
// Check for collision with a impassable object (e.g. wall) and stop
if ((otherFixture.CollisionLayer & (int) CollisionGroup.Impassable) != 0 && otherFixture.Hard)
{
Owner.QueueDelete();
}
}
internal bool Reached;
internal float ReactTimer;
internal float Timer;
internal EntityCoordinates Target;
internal bool Active;
internal float AliveTime;
}
}

View File

@@ -1,4 +1,3 @@
#nullable enable
using Content.Shared.Chemistry.Reaction;
using Content.Shared.Chemistry.Reagent;
using Robust.Shared.Audio;

View File

@@ -1,4 +1,3 @@
#nullable enable
using System.Linq;
using Content.Server.Chemistry.Components;
using JetBrains.Annotations;

View File

@@ -0,0 +1,38 @@
using Content.Server.Body.Circulatory;
using Content.Server.Chemistry.Components;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.Physics.Dynamics;
namespace Content.Server.Chemistry.EntitySystems
{
[UsedImplicitly]
internal sealed class SolutionInjectOnCollideSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SolutionInjectOnCollideComponent, ComponentInit>(HandleInit);
SubscribeLocalEvent<SolutionInjectOnCollideComponent, StartCollideEvent>(HandleInjection);
}
private void HandleInit(EntityUid uid, SolutionInjectOnCollideComponent component, ComponentInit args)
{
component.Owner.EnsureComponentWarn<SolutionContainerComponent>($"{nameof(SolutionInjectOnCollideComponent)} requires a SolutionContainer on {component.Owner}!");
}
private void HandleInjection(EntityUid uid, SolutionInjectOnCollideComponent component, StartCollideEvent args)
{
if (!args.OtherFixture.Body.Owner.TryGetComponent<BloodstreamComponent>(out var bloodstream) ||
!ComponentManager.TryGetComponent(uid, out SolutionContainerComponent? solutionContainer)) return;
var solution = solutionContainer.Solution;
var solRemoved = solution.SplitSolution(component.TransferAmount);
var solRemovedVol = solRemoved.TotalVolume;
var solToInject = solRemoved.SplitSolution(solRemovedVol * component.TransferEfficiency);
bloodstream.TryTransferSolution(solToInject);
}
}
}

View File

@@ -1,17 +1,122 @@
using Content.Server.Chemistry.Components;
using System.Linq;
using Content.Server.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Chemistry.Solution;
using Content.Shared.Physics;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Prototypes;
namespace Content.Server.Chemistry.EntitySystems
{
[UsedImplicitly]
public class VaporSystem : EntitySystem
internal sealed class VaporSystem : EntitySystem
{
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IPrototypeManager _protoManager = default!;
private const float ReactTime = 0.125f;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<VaporComponent, StartCollideEvent>(HandleCollide);
}
private void HandleCollide(EntityUid uid, VaporComponent component, StartCollideEvent args)
{
if (!ComponentManager.TryGetComponent(uid, out SolutionContainerComponent? contents)) return;
contents.Solution.DoEntityReaction(args.OtherFixture.Body.Owner, ReactionMethod.Touch);
// Check for collision with a impassable object (e.g. wall) and stop
if ((args.OtherFixture.CollisionLayer & (int) CollisionGroup.Impassable) != 0 && args.OtherFixture.Hard)
{
EntityManager.QueueDeleteEntity(uid);
}
}
public void Start(VaporComponent vapor, Vector2 dir, float speed, EntityCoordinates target, float aliveTime)
{
vapor.Active = true;
vapor.Target = target;
vapor.AliveTime = aliveTime;
// Set Move
if (vapor.Owner.TryGetComponent(out PhysicsComponent? physics))
{
physics.BodyStatus = BodyStatus.InAir;
physics.ApplyLinearImpulse(dir * speed);
}
}
internal bool TryAddSolution(VaporComponent vapor, Solution solution)
{
if (solution.TotalVolume == 0)
{
return false;
}
if (!vapor.Owner.TryGetComponent(out SolutionContainerComponent? contents))
{
return false;
}
var result = contents.TryAddSolution(solution);
if (!result)
{
return false;
}
return true;
}
public override void Update(float frameTime)
{
foreach (var vaporComp in ComponentManager.EntityQuery<VaporComponent>(true))
foreach (var (vaporComp, solution) in ComponentManager.EntityQuery<VaporComponent, SolutionContainerComponent>(true))
{
vaporComp.Update(frameTime);
Update(frameTime, vaporComp, solution);
}
}
private void Update(float frameTime, VaporComponent vapor, SolutionContainerComponent contents)
{
if (!vapor.Active)
return;
var entity = vapor.Owner;
vapor.Timer += frameTime;
vapor.ReactTimer += frameTime;
if (vapor.ReactTimer >= ReactTime && vapor.Owner.Transform.GridID.IsValid())
{
vapor.ReactTimer = 0;
var mapGrid = _mapManager.GetGrid(entity.Transform.GridID);
var tile = mapGrid.GetTileRef(entity.Transform.Coordinates.ToVector2i(EntityManager, _mapManager));
foreach (var reagentQuantity in contents.ReagentList.ToArray())
{
if (reagentQuantity.Quantity == ReagentUnit.Zero) continue;
var reagent = _protoManager.Index<ReagentPrototype>(reagentQuantity.ReagentId);
contents.TryRemoveReagent(reagentQuantity.ReagentId, reagent.ReactionTile(tile, (reagentQuantity.Quantity / vapor.TransferAmount) * 0.25f));
}
}
// Check if we've reached our target.
if(!vapor.Reached && vapor.Target.TryDistance(EntityManager, entity.Transform.Coordinates, out var distance) && distance <= 0.5f)
{
vapor.Reached = true;
}
if (contents.CurrentVolume == 0 || vapor.Timer > vapor.AliveTime)
{
// Delete this
entity.QueueDelete();
}
}
}

View File

@@ -1,5 +1,4 @@
#nullable enable
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using Content.Server.Botany.Components;
using Content.Shared.Botany;
using Robust.Shared.GameObjects;

View File

@@ -1,5 +1,4 @@
#nullable enable
using JetBrains.Annotations;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
namespace Content.Server.Chemistry.PlantMetabolism

View File

@@ -1,5 +1,4 @@
#nullable enable
using JetBrains.Annotations;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
namespace Content.Server.Chemistry.PlantMetabolism

View File

@@ -1,5 +1,4 @@
#nullable enable
using JetBrains.Annotations;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
namespace Content.Server.Chemistry.PlantMetabolism

View File

@@ -1,5 +1,4 @@
#nullable enable
using JetBrains.Annotations;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
namespace Content.Server.Chemistry.PlantMetabolism

View File

@@ -1,5 +1,4 @@
#nullable enable
using JetBrains.Annotations;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
namespace Content.Server.Chemistry.PlantMetabolism

View File

@@ -1,5 +1,4 @@
#nullable enable
using JetBrains.Annotations;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
namespace Content.Server.Chemistry.PlantMetabolism

View File

@@ -1,5 +1,4 @@
#nullable enable
using JetBrains.Annotations;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
namespace Content.Server.Chemistry.PlantMetabolism

View File

@@ -1,5 +1,4 @@
#nullable enable
using JetBrains.Annotations;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
namespace Content.Server.Chemistry.PlantMetabolism

View File

@@ -1,5 +1,4 @@
#nullable enable
using JetBrains.Annotations;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
namespace Content.Server.Chemistry.PlantMetabolism

View File

@@ -1,5 +1,4 @@
#nullable enable
using System;
using System;
using Content.Server.Botany.Components;
using Content.Shared.Botany;
using JetBrains.Annotations;

View File

@@ -1,5 +1,4 @@
#nullable enable
using Content.Server.Botany.Components;
using Content.Server.Botany.Components;
using Content.Shared.Botany;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;

View File

@@ -1,5 +1,4 @@
#nullable enable
using Content.Server.Botany.Components;
using Content.Server.Botany.Components;
using Content.Shared.Botany;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;

View File

@@ -1,4 +1,3 @@
#nullable enable
using System;
using Content.Server.Chemistry.Components;
using Content.Server.Coordinates.Helpers;

View File

@@ -1,5 +1,4 @@
#nullable enable
using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.Components;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;

View File

@@ -1,5 +1,4 @@
#nullable enable
using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.Components;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;

View File

@@ -21,16 +21,23 @@ namespace Content.Server.Chemistry.TileReactions
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
{
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty) return ReagentUnit.Zero;
var tileAtmos = tile.GridPosition().GetTileAtmosphere();
if (tileAtmos == null || !tileAtmos.Hotspot.Valid || tileAtmos.Air == null) return ReagentUnit.Zero;
tileAtmos.Air.Temperature =
MathF.Max(MathF.Min(tileAtmos.Air.Temperature - (_coolingTemperature * 1000f),
tileAtmos.Air.Temperature / _coolingTemperature),
Atmospherics.TCMB);
EntitySystem.Get<AtmosphereSystem>().React(tileAtmos.Air, tileAtmos);
tileAtmos.Hotspot = new Hotspot();
tileAtmos.UpdateVisuals();
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty)
return ReagentUnit.Zero;
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
var environment = atmosphereSystem.GetTileMixture(tile.GridIndex, tile.GridIndices, true);
if (environment == null || !atmosphereSystem.IsHotspotActive(tile.GridIndex, tile.GridIndices))
return ReagentUnit.Zero;
environment.Temperature =
MathF.Max(MathF.Min(environment.Temperature - (_coolingTemperature * 1000f),
environment.Temperature / _coolingTemperature), Atmospherics.TCMB);
atmosphereSystem.React(tile.GridIndex, tile.GridIndices);
atmosphereSystem.HotspotExtinguish(tile.GridIndex, tile.GridIndices);
return ReagentUnit.Zero;
}
}

View File

@@ -20,11 +20,18 @@ namespace Content.Server.Chemistry.TileReactions
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
{
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty) return ReagentUnit.Zero;
var tileAtmos = tile.GridPosition().GetTileAtmosphere();
if (tileAtmos?.Air == null || !tileAtmos.Hotspot.Valid) return ReagentUnit.Zero;
tileAtmos.Air.Temperature *= MathF.Max(_temperatureMultiplier * reactVolume.Float(), 1f);
EntitySystem.Get<AtmosphereSystem>().React(tileAtmos.Air, tileAtmos);
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty)
return ReagentUnit.Zero;
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
var environment = atmosphereSystem.GetTileMixture(tile.GridIndex, tile.GridIndices, true);
if (environment == null || !atmosphereSystem.IsHotspotActive(tile.GridIndex, tile.GridIndices))
return ReagentUnit.Zero;
environment.Temperature *= MathF.Max(_temperatureMultiplier * reactVolume.Float(), 1f);
atmosphereSystem.React(tile.GridIndex, tile.GridIndices);
return reactVolume;
}
}