Move PriceCalculationEvent and EstimatedPriceCalculationEvent to shared (#37782)
* moce PriceCalculationEvent to shared * Update Content.Shared/Cargo/PriceCalculationEvent.cs Co-authored-by: Tayrtahn <tayrtahn@gmail.com> --------- Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
using Content.Server.Cargo.Systems;
|
|
||||||
using Content.Shared.Anomaly.Components;
|
using Content.Shared.Anomaly.Components;
|
||||||
|
using Content.Shared.Cargo;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.Server.Anomaly.Effects;
|
namespace Content.Server.Anomaly.Effects;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using Content.Server.Cargo.Systems;
|
|
||||||
using Content.Shared.Armor;
|
using Content.Shared.Armor;
|
||||||
|
using Content.Shared.Cargo;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Content.Shared.Damage.Prototypes;
|
using Content.Shared.Damage.Prototypes;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using Content.Server.Cargo.Systems;
|
|
||||||
using Content.Server.Explosion.EntitySystems;
|
using Content.Server.Explosion.EntitySystems;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Atmos.Components;
|
using Content.Shared.Atmos.Components;
|
||||||
using Content.Shared.Atmos.EntitySystems;
|
using Content.Shared.Atmos.EntitySystems;
|
||||||
|
using Content.Shared.Cargo;
|
||||||
using Content.Shared.Throwing;
|
using Content.Shared.Throwing;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using Content.Server.Atmos.EntitySystems;
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Atmos.Piping.Components;
|
using Content.Server.Atmos.Piping.Components;
|
||||||
using Content.Server.Cargo.Systems;
|
|
||||||
using Content.Server.NodeContainer.EntitySystems;
|
using Content.Server.NodeContainer.EntitySystems;
|
||||||
using Content.Server.NodeContainer.NodeGroups;
|
using Content.Server.NodeContainer.NodeGroups;
|
||||||
using Content.Server.NodeContainer.Nodes;
|
using Content.Server.NodeContainer.Nodes;
|
||||||
@@ -8,6 +7,7 @@ using Content.Shared.Atmos;
|
|||||||
using Content.Shared.Atmos.Components;
|
using Content.Shared.Atmos.Components;
|
||||||
using Content.Shared.Atmos.Piping.Binary.Components;
|
using Content.Shared.Atmos.Piping.Binary.Components;
|
||||||
using Content.Shared.Atmos.Piping.Unary.Systems;
|
using Content.Shared.Atmos.Piping.Unary.Systems;
|
||||||
|
using Content.Shared.Cargo;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.NodeContainer;
|
using Content.Shared.NodeContainer;
|
||||||
using GasCanisterComponent = Content.Shared.Atmos.Piping.Unary.Components.GasCanisterComponent;
|
using GasCanisterComponent = Content.Shared.Atmos.Piping.Unary.Components.GasCanisterComponent;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Server.Cargo.Components;
|
|||||||
using Content.Shared.Chemistry.EntitySystems;
|
using Content.Shared.Chemistry.EntitySystems;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Body.Components;
|
using Content.Shared.Body.Components;
|
||||||
|
using Content.Shared.Cargo;
|
||||||
using Content.Shared.Chemistry.Components.SolutionManager;
|
using Content.Shared.Chemistry.Components.SolutionManager;
|
||||||
using Content.Shared.Chemistry.Reagent;
|
using Content.Shared.Chemistry.Reagent;
|
||||||
using Content.Shared.Materials;
|
using Content.Shared.Materials;
|
||||||
@@ -183,10 +184,7 @@ public sealed class PricingSystem : EntitySystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double GetEstimatedPrice(EntityPrototype prototype)
|
public double GetEstimatedPrice(EntityPrototype prototype)
|
||||||
{
|
{
|
||||||
var ev = new EstimatedPriceCalculationEvent()
|
var ev = new EstimatedPriceCalculationEvent(prototype);
|
||||||
{
|
|
||||||
Prototype = prototype,
|
|
||||||
};
|
|
||||||
|
|
||||||
RaiseLocalEvent(ref ev);
|
RaiseLocalEvent(ref ev);
|
||||||
|
|
||||||
@@ -399,39 +397,3 @@ public sealed class PricingSystem : EntitySystem
|
|||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A directed by-ref event fired on an entity when something needs to know it's price. This value is not cached.
|
|
||||||
/// </summary>
|
|
||||||
[ByRefEvent]
|
|
||||||
public record struct PriceCalculationEvent()
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The total price of the entity.
|
|
||||||
/// </summary>
|
|
||||||
public double Price = 0;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether this event was already handled.
|
|
||||||
/// </summary>
|
|
||||||
public bool Handled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Raised broadcast for an entity prototype to determine its estimated price.
|
|
||||||
/// </summary>
|
|
||||||
[ByRefEvent]
|
|
||||||
public record struct EstimatedPriceCalculationEvent()
|
|
||||||
{
|
|
||||||
public required EntityPrototype Prototype;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The total price of the entity.
|
|
||||||
/// </summary>
|
|
||||||
public double Price = 0;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether this event was already handled.
|
|
||||||
/// </summary>
|
|
||||||
public bool Handled = false;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
using Content.Server.Cargo.Systems;
|
|
||||||
using Content.Server.Emp;
|
using Content.Server.Emp;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
|
using Content.Shared.Cargo;
|
||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
using Content.Shared.Rejuvenate;
|
using Content.Shared.Rejuvenate;
|
||||||
using Content.Shared.Timing;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.Administration.Logs;
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.Cargo.Systems;
|
using Content.Server.Cargo.Systems;
|
||||||
using Content.Server.Storage.Components;
|
using Content.Server.Storage.Components;
|
||||||
|
using Content.Shared.Cargo;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Hands.EntitySystems;
|
using Content.Shared.Hands.EntitySystems;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Server.Cargo.Systems;
|
|||||||
using Content.Server.Emp;
|
using Content.Server.Emp;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.Power.EntitySystems;
|
using Content.Server.Power.EntitySystems;
|
||||||
|
using Content.Shared.Cargo;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.Destructible;
|
using Content.Shared.Destructible;
|
||||||
using Content.Shared.DoAfter;
|
using Content.Shared.DoAfter;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Content.Server.Cargo.Systems;
|
using Content.Server.Cargo.Systems;
|
||||||
using Content.Server.Power.EntitySystems;
|
|
||||||
using Content.Server.Weapons.Ranged.Components;
|
using Content.Server.Weapons.Ranged.Components;
|
||||||
|
using Content.Shared.Cargo;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.Damage.Systems;
|
using Content.Shared.Damage.Systems;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
@@ -22,7 +22,6 @@ using Robust.Shared.Player;
|
|||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Content.Server.PowerCell;
|
|
||||||
|
|
||||||
namespace Content.Server.Weapons.Ranged.Systems;
|
namespace Content.Server.Weapons.Ranged.Systems;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Content.Server.Cargo.Systems;
|
using Content.Shared.Cargo;
|
||||||
using Content.Shared.Xenoarchaeology.Artifact;
|
using Content.Shared.Xenoarchaeology.Artifact;
|
||||||
using Content.Shared.Xenoarchaeology.Artifact.Components;
|
using Content.Shared.Xenoarchaeology.Artifact.Components;
|
||||||
|
|
||||||
|
|||||||
38
Content.Shared/Cargo/PriceCalculationEvent.cs
Normal file
38
Content.Shared/Cargo/PriceCalculationEvent.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
|
namespace Content.Shared.Cargo;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A directed by-ref event fired on an entity when something needs to know its price. This value is not cached.
|
||||||
|
/// </summary>
|
||||||
|
[ByRefEvent]
|
||||||
|
public record struct PriceCalculationEvent()
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The total price of the entity.
|
||||||
|
/// </summary>
|
||||||
|
public double Price = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this event was already handled.
|
||||||
|
/// </summary>
|
||||||
|
public bool Handled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised broadcast for an entity prototype to determine its estimated price.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Prototype">The prototype to estimate the price for.</param>
|
||||||
|
[ByRefEvent]
|
||||||
|
public record struct EstimatedPriceCalculationEvent(EntityPrototype Prototype)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The total price of the entity.
|
||||||
|
/// </summary>
|
||||||
|
public double Price = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this event was already handled.
|
||||||
|
/// </summary>
|
||||||
|
public bool Handled = false;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user