Generalize ReagentUnit into FixedPoint2 and use it for damage calculations (#5151)
* Damage units * sum ext method
This commit is contained in:
@@ -10,6 +10,7 @@ using Content.Server.UserInterface;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Random.Helpers;
|
||||
@@ -184,7 +185,7 @@ namespace Content.Server.Chemistry.Components
|
||||
if (beaker is null || !beaker.TryGetComponent(out FitsInDispenserComponent? fits) ||
|
||||
!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(beaker.Uid, fits.Solution, out var beakerSolution))
|
||||
{
|
||||
return new ChemMasterBoundUserInterfaceState(Powered, false, ReagentUnit.New(0), ReagentUnit.New(0),
|
||||
return new ChemMasterBoundUserInterfaceState(Powered, false, FixedPoint2.New(0), FixedPoint2.New(0),
|
||||
"", Owner.Name, new List<Solution.ReagentQuantity>(), BufferSolution.Contents, _bufferModeTransfer,
|
||||
BufferSolution.TotalVolume);
|
||||
}
|
||||
@@ -225,7 +226,7 @@ namespace Content.Server.Chemistry.Components
|
||||
hands.PutInHand(item);
|
||||
}
|
||||
|
||||
private void TransferReagent(string id, ReagentUnit amount, bool isBuffer)
|
||||
private void TransferReagent(string id, FixedPoint2 amount, bool isBuffer)
|
||||
{
|
||||
if (!HasBeaker && _bufferModeTransfer) return;
|
||||
var beaker = BeakerContainer.ContainedEntity;
|
||||
@@ -240,16 +241,16 @@ namespace Content.Server.Chemistry.Components
|
||||
{
|
||||
if (reagent.ReagentId == id)
|
||||
{
|
||||
ReagentUnit actualAmount;
|
||||
FixedPoint2 actualAmount;
|
||||
if (
|
||||
amount == ReagentUnit
|
||||
.New(-1)) //amount is ReagentUnit.New(-1) when the client sends a message requesting to remove all solution from the container
|
||||
amount == FixedPoint2
|
||||
.New(-1)) //amount is FixedPoint2.New(-1) when the client sends a message requesting to remove all solution from the container
|
||||
{
|
||||
actualAmount = ReagentUnit.Min(reagent.Quantity, beakerSolution.AvailableVolume);
|
||||
actualAmount = FixedPoint2.Min(reagent.Quantity, beakerSolution.AvailableVolume);
|
||||
}
|
||||
else
|
||||
{
|
||||
actualAmount = ReagentUnit.Min(reagent.Quantity, amount, beakerSolution.AvailableVolume);
|
||||
actualAmount = FixedPoint2.Min(reagent.Quantity, amount, beakerSolution.AvailableVolume);
|
||||
}
|
||||
|
||||
|
||||
@@ -271,14 +272,14 @@ namespace Content.Server.Chemistry.Components
|
||||
{
|
||||
if (reagent.ReagentId == id)
|
||||
{
|
||||
ReagentUnit actualAmount;
|
||||
if (amount == ReagentUnit.New(-1))
|
||||
FixedPoint2 actualAmount;
|
||||
if (amount == FixedPoint2.New(-1))
|
||||
{
|
||||
actualAmount = reagent.Quantity;
|
||||
}
|
||||
else
|
||||
{
|
||||
actualAmount = ReagentUnit.Min(reagent.Quantity, amount);
|
||||
actualAmount = FixedPoint2.Min(reagent.Quantity, amount);
|
||||
}
|
||||
|
||||
EntitySystem.Get<SolutionContainerSystem>().TryRemoveReagent(beaker.Uid, beakerSolution, id, actualAmount);
|
||||
@@ -298,11 +299,11 @@ namespace Content.Server.Chemistry.Components
|
||||
|
||||
if (action == UiAction.CreateBottles)
|
||||
{
|
||||
var individualVolume = BufferSolution.TotalVolume / ReagentUnit.New(bottleAmount);
|
||||
if (individualVolume < ReagentUnit.New(1))
|
||||
var individualVolume = BufferSolution.TotalVolume / FixedPoint2.New(bottleAmount);
|
||||
if (individualVolume < FixedPoint2.New(1))
|
||||
return;
|
||||
|
||||
var actualVolume = ReagentUnit.Min(individualVolume, ReagentUnit.New(30));
|
||||
var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(30));
|
||||
for (int i = 0; i < bottleAmount; i++)
|
||||
{
|
||||
var bottle = Owner.EntityManager.SpawnEntity("ChemistryEmptyBottle01", Owner.Transform.Coordinates);
|
||||
@@ -331,11 +332,11 @@ namespace Content.Server.Chemistry.Components
|
||||
}
|
||||
else //Pills
|
||||
{
|
||||
var individualVolume = BufferSolution.TotalVolume / ReagentUnit.New(pillAmount);
|
||||
if (individualVolume < ReagentUnit.New(1))
|
||||
var individualVolume = BufferSolution.TotalVolume / FixedPoint2.New(pillAmount);
|
||||
if (individualVolume < FixedPoint2.New(1))
|
||||
return;
|
||||
|
||||
var actualVolume = ReagentUnit.Min(individualVolume, ReagentUnit.New(50));
|
||||
var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(50));
|
||||
for (int i = 0; i < pillAmount; i++)
|
||||
{
|
||||
var pill = Owner.EntityManager.SpawnEntity("pill", Owner.Transform.Coordinates);
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Server.Inventory.Components;
|
||||
using Content.Server.Items;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Foam;
|
||||
using Content.Shared.Inventory;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -56,7 +57,7 @@ namespace Content.Server.Chemistry.Components
|
||||
}
|
||||
|
||||
var cloneSolution = solution.Clone();
|
||||
var transferAmount = ReagentUnit.Min(cloneSolution.TotalVolume * solutionFraction * (1 - protection),
|
||||
var transferAmount = FixedPoint2.Min(cloneSolution.TotalVolume * solutionFraction * (1 - protection),
|
||||
bloodstream.EmptyVolume);
|
||||
var transferSolution = cloneSolution.SplitSolution(transferAmount);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Interaction.Components;
|
||||
using Content.Server.Weapon.Melee;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Sound;
|
||||
@@ -27,7 +28,7 @@ namespace Content.Server.Chemistry.Components
|
||||
|
||||
[DataField("TransferAmount")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public ReagentUnit TransferAmount { get; set; } = ReagentUnit.New(5);
|
||||
public FixedPoint2 TransferAmount { get; set; } = FixedPoint2.New(5);
|
||||
|
||||
[DataField("InjectSound")]
|
||||
private SoundSpecifier _injectSound = new SoundPathSpecifier("/Audio/Items/hypospray.ogg");
|
||||
@@ -85,7 +86,7 @@ namespace Content.Server.Chemistry.Components
|
||||
SoundSystem.Play(Filter.Pvs(user), _injectSound.GetSound(), user);
|
||||
|
||||
// Get transfer amount. May be smaller than _transferAmount if not enough room
|
||||
var realTransferAmount = ReagentUnit.Min(TransferAmount, targetSolution.AvailableVolume);
|
||||
var realTransferAmount = FixedPoint2.Min(TransferAmount, targetSolution.AvailableVolume);
|
||||
|
||||
if (realTransferAmount <= 0)
|
||||
{
|
||||
@@ -126,7 +127,7 @@ namespace Content.Server.Chemistry.Components
|
||||
var solutionSys = Owner.EntityManager.EntitySysManager.GetEntitySystem<SolutionContainerSystem>();
|
||||
return solutionSys.TryGetSolution(Owner.Uid, SolutionName, out var solution)
|
||||
? new HyposprayComponentState(solution.CurrentVolume, solution.MaxVolume)
|
||||
: new HyposprayComponentState(ReagentUnit.Zero, ReagentUnit.Zero);
|
||||
: new HyposprayComponentState(FixedPoint2.Zero, FixedPoint2.Zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Shared.Body.Networks;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Popups;
|
||||
@@ -41,14 +42,14 @@ namespace Content.Server.Chemistry.Components
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("transferAmount")]
|
||||
private ReagentUnit _transferAmount = ReagentUnit.New(5);
|
||||
private FixedPoint2 _transferAmount = FixedPoint2.New(5);
|
||||
|
||||
/// <summary>
|
||||
/// Initial storage volume of the injector
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("initialMaxVolume")]
|
||||
private ReagentUnit _initialMaxVolume = ReagentUnit.New(15);
|
||||
private FixedPoint2 _initialMaxVolume = FixedPoint2.New(15);
|
||||
|
||||
private InjectorToggleMode _toggleState;
|
||||
|
||||
@@ -180,7 +181,7 @@ namespace Content.Server.Chemistry.Components
|
||||
return;
|
||||
|
||||
// Get transfer amount. May be smaller than _transferAmount if not enough room
|
||||
var realTransferAmount = ReagentUnit.Min(_transferAmount, targetBloodstream.EmptyVolume);
|
||||
var realTransferAmount = FixedPoint2.Min(_transferAmount, targetBloodstream.EmptyVolume);
|
||||
|
||||
if (realTransferAmount <= 0)
|
||||
{
|
||||
@@ -223,7 +224,7 @@ namespace Content.Server.Chemistry.Components
|
||||
}
|
||||
|
||||
// Get transfer amount. May be smaller than _transferAmount if not enough room
|
||||
var realTransferAmount = ReagentUnit.Min(_transferAmount, targetSolution.AvailableVolume);
|
||||
var realTransferAmount = FixedPoint2.Min(_transferAmount, targetSolution.AvailableVolume);
|
||||
|
||||
if (realTransferAmount <= 0)
|
||||
{
|
||||
@@ -285,7 +286,7 @@ namespace Content.Server.Chemistry.Components
|
||||
}
|
||||
|
||||
// Get transfer amount. May be smaller than _transferAmount if not enough room
|
||||
var realTransferAmount = ReagentUnit.Min(_transferAmount, targetSolution.DrawAvailable);
|
||||
var realTransferAmount = FixedPoint2.Min(_transferAmount, targetSolution.DrawAvailable);
|
||||
|
||||
if (realTransferAmount <= 0)
|
||||
{
|
||||
@@ -317,8 +318,8 @@ namespace Content.Server.Chemistry.Components
|
||||
Owner.EntityManager.EntitySysManager.GetEntitySystem<SolutionContainerSystem>()
|
||||
.TryGetSolution(Owner.Uid, SolutionName, out var solution);
|
||||
|
||||
var currentVolume = solution?.CurrentVolume ?? ReagentUnit.Zero;
|
||||
var maxVolume = solution?.MaxVolume ?? ReagentUnit.Zero;
|
||||
var currentVolume = solution?.CurrentVolume ?? FixedPoint2.Zero;
|
||||
var maxVolume = solution?.MaxVolume ?? FixedPoint2.Zero;
|
||||
|
||||
return new InjectorComponentState(currentVolume, maxVolume, ToggleState);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -13,7 +14,7 @@ namespace Content.Server.Chemistry.Components
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("transferAmount")]
|
||||
public ReagentUnit TransferAmount { get; set; } = ReagentUnit.New(1);
|
||||
public FixedPoint2 TransferAmount { get; set; } = FixedPoint2.New(1);
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float TransferEfficiency { get => _transferEfficiency; set => _transferEfficiency = Math.Clamp(value, 0, 1); }
|
||||
|
||||
@@ -12,6 +12,7 @@ using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Dispenser;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Sound;
|
||||
@@ -53,7 +54,7 @@ namespace Content.Server.Chemistry.Components
|
||||
private SoundSpecifier _clickSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");
|
||||
|
||||
[ViewVariables] public bool HasBeaker => BeakerContainer.ContainedEntity != null;
|
||||
[ViewVariables] private ReagentUnit _dispenseAmount = ReagentUnit.New(10);
|
||||
[ViewVariables] private FixedPoint2 _dispenseAmount = FixedPoint2.New(10);
|
||||
|
||||
[UsedImplicitly]
|
||||
[ViewVariables]
|
||||
@@ -163,31 +164,31 @@ namespace Content.Server.Chemistry.Components
|
||||
TryClear();
|
||||
break;
|
||||
case UiButton.SetDispenseAmount1:
|
||||
_dispenseAmount = ReagentUnit.New(1);
|
||||
_dispenseAmount = FixedPoint2.New(1);
|
||||
break;
|
||||
case UiButton.SetDispenseAmount5:
|
||||
_dispenseAmount = ReagentUnit.New(5);
|
||||
_dispenseAmount = FixedPoint2.New(5);
|
||||
break;
|
||||
case UiButton.SetDispenseAmount10:
|
||||
_dispenseAmount = ReagentUnit.New(10);
|
||||
_dispenseAmount = FixedPoint2.New(10);
|
||||
break;
|
||||
case UiButton.SetDispenseAmount15:
|
||||
_dispenseAmount = ReagentUnit.New(15);
|
||||
_dispenseAmount = FixedPoint2.New(15);
|
||||
break;
|
||||
case UiButton.SetDispenseAmount20:
|
||||
_dispenseAmount = ReagentUnit.New(20);
|
||||
_dispenseAmount = FixedPoint2.New(20);
|
||||
break;
|
||||
case UiButton.SetDispenseAmount25:
|
||||
_dispenseAmount = ReagentUnit.New(25);
|
||||
_dispenseAmount = FixedPoint2.New(25);
|
||||
break;
|
||||
case UiButton.SetDispenseAmount30:
|
||||
_dispenseAmount = ReagentUnit.New(30);
|
||||
_dispenseAmount = FixedPoint2.New(30);
|
||||
break;
|
||||
case UiButton.SetDispenseAmount50:
|
||||
_dispenseAmount = ReagentUnit.New(50);
|
||||
_dispenseAmount = FixedPoint2.New(50);
|
||||
break;
|
||||
case UiButton.SetDispenseAmount100:
|
||||
_dispenseAmount = ReagentUnit.New(100);
|
||||
_dispenseAmount = FixedPoint2.New(100);
|
||||
break;
|
||||
case UiButton.Dispense:
|
||||
if (HasBeaker)
|
||||
@@ -237,8 +238,8 @@ namespace Content.Server.Chemistry.Components
|
||||
if (beaker == null || !beaker.TryGetComponent(out FitsInDispenserComponent? fits) ||
|
||||
!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(beaker.Uid, fits.Solution, out var solution))
|
||||
{
|
||||
return new ReagentDispenserBoundUserInterfaceState(Powered, false, ReagentUnit.New(0),
|
||||
ReagentUnit.New(0),
|
||||
return new ReagentDispenserBoundUserInterfaceState(Powered, false, FixedPoint2.New(0),
|
||||
FixedPoint2.New(0),
|
||||
string.Empty, Inventory, Owner.Name, null, _dispenseAmount);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -13,7 +14,7 @@ namespace Content.Server.Chemistry.Components
|
||||
|
||||
[DataField("transferAmount")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public ReagentUnit TransferAmount { get; set; } = ReagentUnit.New(10);
|
||||
public FixedPoint2 TransferAmount { get; set; } = FixedPoint2.New(10);
|
||||
|
||||
[DataField("tankType")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Body.Respiratory;
|
||||
using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Smoking;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -39,12 +40,12 @@ namespace Content.Server.Chemistry.Components
|
||||
|
||||
var chemistry = EntitySystem.Get<ChemistrySystem>();
|
||||
var cloneSolution = solution.Clone();
|
||||
var transferAmount = ReagentUnit.Min(cloneSolution.TotalVolume * solutionFraction, bloodstream.EmptyVolume);
|
||||
var transferAmount = FixedPoint2.Min(cloneSolution.TotalVolume * solutionFraction, bloodstream.EmptyVolume);
|
||||
var transferSolution = cloneSolution.SplitSolution(transferAmount);
|
||||
|
||||
foreach (var reagentQuantity in transferSolution.Contents.ToArray())
|
||||
{
|
||||
if (reagentQuantity.Quantity == ReagentUnit.Zero) continue;
|
||||
if (reagentQuantity.Quantity == FixedPoint2.Zero) continue;
|
||||
chemistry.ReactionEntity(entity, ReactionMethod.Ingestion, reagentQuantity.ReagentId, reagentQuantity.Quantity, transferSolution);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Server.Coordinates.Helpers;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
@@ -133,7 +134,7 @@ namespace Content.Server.Chemistry.Components
|
||||
|
||||
foreach (var reagentQuantity in solution.Contents)
|
||||
{
|
||||
if (reagentQuantity.Quantity == ReagentUnit.Zero) continue;
|
||||
if (reagentQuantity.Quantity == FixedPoint2.Zero) continue;
|
||||
var reagent = PrototypeManager.Index<ReagentPrototype>(reagentQuantity.ReagentId);
|
||||
|
||||
// React with the tile the effect is on
|
||||
@@ -164,7 +165,7 @@ namespace Content.Server.Chemistry.Components
|
||||
return;
|
||||
|
||||
var addSolution =
|
||||
solution.SplitSolution(ReagentUnit.Min(solution.TotalVolume, solutionArea.AvailableVolume));
|
||||
solution.SplitSolution(FixedPoint2.Min(solution.TotalVolume, solutionArea.AvailableVolume));
|
||||
|
||||
EntitySystem.Get<SolutionContainerSystem>().TryAddSolution(Owner.Uid, solutionArea, addSolution);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -16,7 +17,7 @@ namespace Content.Server.Chemistry.Components
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("transferAmount")]
|
||||
public ReagentUnit TransferAmount { get; set; } = ReagentUnit.New(1);
|
||||
public FixedPoint2 TransferAmount { get; set; } = FixedPoint2.New(1);
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float TransferEfficiency { get => _transferEfficiency; set => _transferEfficiency = Math.Clamp(value, 0, 1); }
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Server.UserInterface;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Popups;
|
||||
@@ -35,21 +36,21 @@ namespace Content.Server.Chemistry.Components
|
||||
/// </summary>
|
||||
[DataField("transferAmount")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public ReagentUnit TransferAmount { get; set; } = ReagentUnit.New(5);
|
||||
public FixedPoint2 TransferAmount { get; set; } = FixedPoint2.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);
|
||||
public FixedPoint2 MinimumTransferAmount { get; set; } = FixedPoint2.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);
|
||||
public FixedPoint2 MaximumTransferAmount { get; set; } = FixedPoint2.New(50);
|
||||
|
||||
/// <summary>
|
||||
/// Can this entity take reagent from reagent tanks?
|
||||
@@ -95,14 +96,14 @@ namespace Content.Server.Chemistry.Components
|
||||
|
||||
serverMsg.Session.AttachedEntity?.PopupMessage(Loc.GetString("comp-solution-transfer-set-amount",
|
||||
("amount", amount)));
|
||||
SetTransferAmount(ReagentUnit.New(amount));
|
||||
SetTransferAmount(FixedPoint2.New(amount));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetTransferAmount(ReagentUnit amount)
|
||||
public void SetTransferAmount(FixedPoint2 amount)
|
||||
{
|
||||
amount = ReagentUnit.New(Math.Clamp(amount.Int(), MinimumTransferAmount.Int(),
|
||||
amount = FixedPoint2.New(Math.Clamp(amount.Int(), MinimumTransferAmount.Int(),
|
||||
MaximumTransferAmount.Int()));
|
||||
TransferAmount = amount;
|
||||
}
|
||||
@@ -162,30 +163,30 @@ namespace Content.Server.Chemistry.Components
|
||||
}
|
||||
|
||||
/// <returns>The actual amount transferred.</returns>
|
||||
private static ReagentUnit DoTransfer(IEntity user,
|
||||
private static FixedPoint2 DoTransfer(IEntity user,
|
||||
IEntity sourceEntity,
|
||||
Solution source,
|
||||
IEntity targetEntity,
|
||||
Solution target,
|
||||
ReagentUnit amount)
|
||||
FixedPoint2 amount)
|
||||
{
|
||||
|
||||
if (source.DrainAvailable == 0)
|
||||
{
|
||||
sourceEntity.PopupMessage(user,
|
||||
Loc.GetString("comp-solution-transfer-is-empty", ("target", sourceEntity)));
|
||||
return ReagentUnit.Zero;
|
||||
return FixedPoint2.Zero;
|
||||
}
|
||||
|
||||
if (target.AvailableVolume == 0)
|
||||
{
|
||||
targetEntity.PopupMessage(user,
|
||||
Loc.GetString("comp-solution-transfer-is-full", ("target", targetEntity)));
|
||||
return ReagentUnit.Zero;
|
||||
return FixedPoint2.Zero;
|
||||
}
|
||||
|
||||
var actualAmount =
|
||||
ReagentUnit.Min(amount, ReagentUnit.Min(source.DrainAvailable, target.AvailableVolume));
|
||||
FixedPoint2.Min(amount, FixedPoint2.Min(source.DrainAvailable, target.AvailableVolume));
|
||||
|
||||
var solution = EntitySystem.Get<SolutionContainerSystem>().Drain(sourceEntity.Uid, source, actualAmount);
|
||||
EntitySystem.Get<SolutionContainerSystem>().Refill(targetEntity.Uid, target, solution);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Vapor;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
@@ -12,7 +13,7 @@ namespace Content.Server.Chemistry.Components
|
||||
{
|
||||
[ViewVariables]
|
||||
[DataField("transferAmount")]
|
||||
internal ReagentUnit TransferAmount = ReagentUnit.New(0.5);
|
||||
internal FixedPoint2 TransferAmount = FixedPoint2.New(0.5);
|
||||
|
||||
internal bool Reached;
|
||||
internal float ReactTimer;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Player;
|
||||
@@ -9,7 +10,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
{
|
||||
public class ChemicalReactionSystem : SharedChemicalReactionSystem
|
||||
{
|
||||
protected override void OnReaction(Solution solution, ReactionPrototype reaction, IEntity owner, ReagentUnit unitReactions)
|
||||
protected override void OnReaction(Solution solution, ReactionPrototype reaction, IEntity owner, FixedPoint2 unitReactions)
|
||||
{
|
||||
base.OnReaction(solution, reaction, owner, unitReactions);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -21,7 +22,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
|
||||
private void OnSolutionChange(EntityUid uid, RehydratableComponent component, SolutionChangedEvent args)
|
||||
{
|
||||
if (_solutionsSystem.GetReagentQuantity(uid, component.CatalystPrototype) > ReagentUnit.Zero)
|
||||
if (_solutionsSystem.GetReagentQuantity(uid, component.CatalystPrototype) > FixedPoint2.Zero)
|
||||
{
|
||||
Expand(component, component.Owner);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Content.Server.Chemistry.Components.SolutionManager;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.Chemistry.EntitySystems
|
||||
@@ -26,7 +27,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
TryAddSolution(targetUid, targetSolution, addedSolution);
|
||||
}
|
||||
|
||||
public Solution Draw(EntityUid targetUid, Solution solution, ReagentUnit amount,
|
||||
public Solution Draw(EntityUid targetUid, Solution solution, FixedPoint2 amount,
|
||||
DrawableSolutionComponent? drawableSolution = null)
|
||||
{
|
||||
if (!Resolve(targetUid, ref drawableSolution, false))
|
||||
@@ -35,7 +36,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
return SplitSolution(targetUid, solution, amount);
|
||||
}
|
||||
|
||||
public Solution Drain(EntityUid targetUid, Solution targetSolution, ReagentUnit amount,
|
||||
public Solution Drain(EntityUid targetUid, Solution targetSolution, FixedPoint2 amount,
|
||||
DrainableSolutionComponent? drainableSolution = null)
|
||||
{
|
||||
if (!Resolve(targetUid, ref drainableSolution, false))
|
||||
@@ -106,10 +107,10 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
return true;
|
||||
}
|
||||
|
||||
public ReagentUnit DrainAvailable(EntityUid uid)
|
||||
public FixedPoint2 DrainAvailable(EntityUid uid)
|
||||
{
|
||||
return !TryGetDrainableSolution(uid, out var solution)
|
||||
? ReagentUnit.Zero
|
||||
? FixedPoint2.Zero
|
||||
: solution.CurrentVolume;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.FixedPoint;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -51,7 +52,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
foreach (var keyValue in component.Solutions)
|
||||
{
|
||||
var solutionHolder = keyValue.Value;
|
||||
if (solutionHolder.MaxVolume == ReagentUnit.Zero)
|
||||
if (solutionHolder.MaxVolume == FixedPoint2.Zero)
|
||||
{
|
||||
solutionHolder.MaxVolume = solutionHolder.TotalVolume > solutionHolder.InitialMaxVolume
|
||||
? solutionHolder.TotalVolume
|
||||
@@ -115,7 +116,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
/// <param name="solutionHolder"></param>
|
||||
/// <param name="quantity">the volume of solution to remove.</param>
|
||||
/// <returns>The solution that was removed.</returns>
|
||||
public Solution SplitSolution(EntityUid targetUid, Solution solutionHolder, ReagentUnit quantity)
|
||||
public Solution SplitSolution(EntityUid targetUid, Solution solutionHolder, FixedPoint2 quantity)
|
||||
{
|
||||
var splitSol = solutionHolder.SplitSolution(quantity);
|
||||
UpdateChemicals(targetUid, solutionHolder);
|
||||
@@ -164,8 +165,8 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
/// <param name="quantity">The amount of reagent to add.</param>
|
||||
/// <param name="acceptedQuantity">The amount of reagent successfully added.</param>
|
||||
/// <returns>If all the reagent could be added.</returns>
|
||||
public bool TryAddReagent(EntityUid targetUid, Solution targetSolution, string reagentId, ReagentUnit quantity,
|
||||
out ReagentUnit acceptedQuantity)
|
||||
public bool TryAddReagent(EntityUid targetUid, Solution targetSolution, string reagentId, FixedPoint2 quantity,
|
||||
out FixedPoint2 acceptedQuantity)
|
||||
{
|
||||
acceptedQuantity = targetSolution.AvailableVolume > quantity ? quantity : targetSolution.AvailableVolume;
|
||||
targetSolution.AddReagent(reagentId, acceptedQuantity);
|
||||
@@ -184,7 +185,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
/// <param name="reagentId">The Id of the reagent to remove.</param>
|
||||
/// <param name="quantity">The amount of reagent to remove.</param>
|
||||
/// <returns>If the reagent to remove was found in the container.</returns>
|
||||
public bool TryRemoveReagent(EntityUid targetUid, Solution? container, string reagentId, ReagentUnit quantity)
|
||||
public bool TryRemoveReagent(EntityUid targetUid, Solution? container, string reagentId, FixedPoint2 quantity)
|
||||
{
|
||||
if (container == null || !container.ContainsReagent(reagentId))
|
||||
return false;
|
||||
@@ -248,7 +249,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
return solutionsMgr.Solutions[name];
|
||||
}
|
||||
|
||||
public string[] RemoveEachReagent(Solution solution, ReagentUnit quantity)
|
||||
public string[] RemoveEachReagent(Solution solution, FixedPoint2 quantity)
|
||||
{
|
||||
var removedReagent = new string[solution.Contents.Count];
|
||||
if (quantity <= 0)
|
||||
@@ -284,9 +285,9 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
}
|
||||
}
|
||||
|
||||
public ReagentUnit GetReagentQuantity(EntityUid ownerUid, string reagentId)
|
||||
public FixedPoint2 GetReagentQuantity(EntityUid ownerUid, string reagentId)
|
||||
{
|
||||
var reagentQuantity = ReagentUnit.New(0);
|
||||
var reagentQuantity = FixedPoint2.New(0);
|
||||
if (EntityManager.TryGetEntity(ownerUid, out var owner)
|
||||
&& owner.TryGetComponent(out SolutionContainerManagerComponent? managerComponent))
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using Robust.Shared.Localization;
|
||||
using Robust.Server.GameObjects;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Popups;
|
||||
|
||||
namespace Content.Server.Chemistry.EntitySystems
|
||||
@@ -53,7 +54,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
verb.Category = VerbCategory.SetTransferAmount;
|
||||
verb.Act = () =>
|
||||
{
|
||||
component.TransferAmount = ReagentUnit.New(amount);
|
||||
component.TransferAmount = FixedPoint2.New(amount);
|
||||
args.User.PopupMessage(Loc.GetString("comp-solution-transfer-set-amount", ("amount", amount)));
|
||||
};
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Content.Server.Chemistry.Components.SolutionManager;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Vapor;
|
||||
using JetBrains.Annotations;
|
||||
@@ -104,7 +105,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
var tile = mapGrid.GetTileRef(entity.Transform.Coordinates.ToVector2i(EntityManager, _mapManager));
|
||||
foreach (var reagentQuantity in contents.Contents.ToArray())
|
||||
{
|
||||
if (reagentQuantity.Quantity == ReagentUnit.Zero) continue;
|
||||
if (reagentQuantity.Quantity == FixedPoint2.Zero) continue;
|
||||
var reagent = _protoManager.Index<ReagentPrototype>(reagentQuantity.ReagentId);
|
||||
_solutionContainerSystem.TryRemoveReagent(vapor.Owner.Uid, contents, reagentQuantity.ReagentId,
|
||||
reagent.ReactionTile(tile, (reagentQuantity.Quantity / vapor.TransferAmount) * 0.25f));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
@@ -12,10 +13,10 @@ namespace Content.Server.Chemistry.ReagentEffectConditions
|
||||
public class ReagentThreshold : ReagentEffectCondition
|
||||
{
|
||||
[DataField("min")]
|
||||
public ReagentUnit Min = ReagentUnit.Zero;
|
||||
public FixedPoint2 Min = FixedPoint2.Zero;
|
||||
|
||||
[DataField("max")]
|
||||
public ReagentUnit Max = ReagentUnit.MaxValue;
|
||||
public FixedPoint2 Max = FixedPoint2.MaxValue;
|
||||
|
||||
public override bool Condition(IEntity solutionEntity, Solution.ReagentQuantity reagent)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
||||
using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
@@ -19,7 +20,7 @@ namespace Content.Server.Chemistry.ReagentEntityReactions
|
||||
// ReSharper disable once CollectionNeverUpdated.Local
|
||||
private readonly HashSet<string> _reagents = new();
|
||||
|
||||
protected override void React(IEntity entity, ReagentPrototype reagent, ReagentUnit volume, Solution? source)
|
||||
protected override void React(IEntity entity, ReagentPrototype reagent, FixedPoint2 volume, Solution? source)
|
||||
{
|
||||
// TODO see if this is correct
|
||||
if (!EntitySystem.Get<SolutionContainerSystem>()
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
@@ -17,7 +18,7 @@ namespace Content.Server.Chemistry.ReagentEntityReactions
|
||||
// ReSharper disable once CollectionNeverUpdated.Local
|
||||
private readonly HashSet<string> _reagents = new ();
|
||||
|
||||
protected override void React(IEntity entity, ReagentPrototype reagent, ReagentUnit volume, Solution? source)
|
||||
protected override void React(IEntity entity, ReagentPrototype reagent, FixedPoint2 volume, Solution? source)
|
||||
{
|
||||
if (!entity.TryGetComponent(out FlammableComponent? flammable) || !_reagents.Contains(reagent.ID)) return;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
@@ -17,7 +18,7 @@ namespace Content.Server.Chemistry.ReagentEntityReactions
|
||||
// ReSharper disable once CollectionNeverUpdated.Local
|
||||
private readonly HashSet<string> _reagents = new ();
|
||||
|
||||
protected override void React(IEntity entity, ReagentPrototype reagent, ReagentUnit volume, Solution? source)
|
||||
protected override void React(IEntity entity, ReagentPrototype reagent, FixedPoint2 volume, Solution? source)
|
||||
{
|
||||
if (!entity.TryGetComponent(out FlammableComponent? flammable) || !_reagents.Contains(reagent.ID)) return;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
||||
using Content.Server.Nutrition.EntitySystems;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -17,7 +18,7 @@ namespace Content.Server.Chemistry.ReagentEntityReactions
|
||||
// ReSharper disable once CollectionNeverUpdated.Local
|
||||
private readonly HashSet<string> _reagents = new ();
|
||||
|
||||
protected override void React(IEntity entity, ReagentPrototype reagent, ReagentUnit volume, Solution? source)
|
||||
protected override void React(IEntity entity, ReagentPrototype reagent, FixedPoint2 volume, Solution? source)
|
||||
{
|
||||
if (!entity.TryGetComponent(out CreamPiedComponent? creamPied) || !_reagents.Contains(reagent.ID)) return;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Server.GameObjects.Components;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
@@ -13,10 +14,10 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
[DataDefinition]
|
||||
public class CleanTileReaction : ITileReaction
|
||||
{
|
||||
ReagentUnit ITileReaction.TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||
FixedPoint2 ITileReaction.TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
{
|
||||
var entities = tile.GetEntitiesInTileFast().ToArray();
|
||||
var amount = ReagentUnit.Zero;
|
||||
var amount = FixedPoint2.Zero;
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
if (entity.TryGetComponent(out CleanableComponent? cleanable))
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Shared.Atmos;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -19,17 +20,17 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
{
|
||||
[DataField("coolingTemperature")] private float _coolingTemperature = 2f;
|
||||
|
||||
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||
public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
{
|
||||
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty)
|
||||
return ReagentUnit.Zero;
|
||||
if (reactVolume <= FixedPoint2.Zero || tile.Tile.IsEmpty)
|
||||
return FixedPoint2.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;
|
||||
return FixedPoint2.Zero;
|
||||
|
||||
environment.Temperature =
|
||||
MathF.Max(MathF.Min(environment.Temperature - (_coolingTemperature * 1000f),
|
||||
@@ -38,7 +39,7 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
atmosphereSystem.React(tile.GridIndex, tile.GridIndices);
|
||||
atmosphereSystem.HotspotExtinguish(tile.GridIndex, tile.GridIndices);
|
||||
|
||||
return ReagentUnit.Zero;
|
||||
return FixedPoint2.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -18,16 +19,16 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
{
|
||||
[DataField("temperatureMultiplier")] private float _temperatureMultiplier = 1.15f;
|
||||
|
||||
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||
public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
{
|
||||
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty)
|
||||
return ReagentUnit.Zero;
|
||||
if (reactVolume <= FixedPoint2.Zero || tile.Tile.IsEmpty)
|
||||
return FixedPoint2.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;
|
||||
return FixedPoint2.Zero;
|
||||
|
||||
environment.Temperature *= MathF.Max(_temperatureMultiplier * reactVolume.Float(), 1f);
|
||||
atmosphereSystem.React(tile.GridIndex, tile.GridIndices);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
@@ -12,11 +13,11 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
[DataDefinition]
|
||||
public class SpillIfPuddlePresentTileReaction : ITileReaction
|
||||
{
|
||||
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||
public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
{
|
||||
if (reactVolume < 5 || !tile.TryGetPuddle(null, out _)) return ReagentUnit.Zero;
|
||||
if (reactVolume < 5 || !tile.TryGetPuddle(null, out _)) return FixedPoint2.Zero;
|
||||
|
||||
return tile.SpillAt(new Solution(reagent.ID, reactVolume), "PuddleSmear", true, false) != null ? reactVolume : ReagentUnit.Zero;
|
||||
return tile.SpillAt(new Solution(reagent.ID, reactVolume), "PuddleSmear", true, false) != null ? reactVolume : FixedPoint2.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Slippery;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Map;
|
||||
@@ -18,9 +19,9 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
[DataField("paralyzeTime")] private float _paralyzeTime = 1;
|
||||
[DataField("overflow")] private bool _overflow;
|
||||
|
||||
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||
public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
{
|
||||
if (reactVolume < 5) return ReagentUnit.Zero;
|
||||
if (reactVolume < 5) return FixedPoint2.Zero;
|
||||
|
||||
// TODO Make this not puddle smear.
|
||||
var puddle = tile.SpillAt(new Solution(reagent.ID, reactVolume), "PuddleSmear", _overflow, false);
|
||||
@@ -35,7 +36,7 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
return reactVolume;
|
||||
}
|
||||
|
||||
return ReagentUnit.Zero;
|
||||
return FixedPoint2.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user