diff --git a/Content.Server/Power/Components/BatteryComponent.cs b/Content.Server/Power/Components/BatteryComponent.cs
index 42d56b1d2b..55202e1e70 100644
--- a/Content.Server/Power/Components/BatteryComponent.cs
+++ b/Content.Server/Power/Components/BatteryComponent.cs
@@ -29,6 +29,13 @@ namespace Content.Server.Power.Components
///
[ViewVariables] public bool IsFullyCharged => MathHelper.CloseToPercent(CurrentCharge, MaxCharge);
+ ///
+ /// The price per one joule. Default is 1 credit for 10kJ.
+ ///
+ [DataField("pricePerJoule")]
+ [ViewVariables(VVAccess.ReadWrite)]
+ public float PricePerJoule = 0.0001f;
+
///
/// If sufficient charge is avaiable on the battery, use it. Otherwise, don't.
///
diff --git a/Content.Server/Power/EntitySystems/BatterySystem.cs b/Content.Server/Power/EntitySystems/BatterySystem.cs
index 80d2998511..7de97444e4 100644
--- a/Content.Server/Power/EntitySystems/BatterySystem.cs
+++ b/Content.Server/Power/EntitySystems/BatterySystem.cs
@@ -1,3 +1,4 @@
+using Content.Server.Cargo.Systems;
using Content.Server.Power.Components;
using Content.Shared.Examine;
using JetBrains.Annotations;
@@ -12,6 +13,7 @@ namespace Content.Server.Power.EntitySystems
base.Initialize();
SubscribeLocalEvent(OnExamine);
+ SubscribeLocalEvent(CalculateBatteryPrice);
SubscribeLocalEvent(PreSync);
SubscribeLocalEvent(PostSync);
@@ -64,5 +66,13 @@ namespace Content.Server.Power.EntitySystems
batt.CurrentCharge += comp.AutoRechargeRate * frameTime;
}
}
+
+ ///
+ /// Gets the price for the power contained in an entity's battery.
+ ///
+ private void CalculateBatteryPrice(EntityUid uid, BatteryComponent component, ref PriceCalculationEvent args)
+ {
+ args.Price += component.CurrentCharge * component.PricePerJoule;
+ }
}
}
diff --git a/Resources/Prototypes/Entities/Objects/Power/powercells.yml b/Resources/Prototypes/Entities/Objects/Power/powercells.yml
index 5a5147c03d..e12bfeb20d 100644
--- a/Resources/Prototypes/Entities/Objects/Power/powercells.yml
+++ b/Resources/Prototypes/Entities/Objects/Power/powercells.yml
@@ -4,6 +4,7 @@
parent: BaseItem
components:
- type: Battery
+ pricePerJoule: 0.15
- type: PowerCell
- type: Explosive
explosionType: Default
@@ -28,8 +29,6 @@
- DroneUsable
- type: Appearance
- type: PowerCellVisuals
- - type: StaticPrice
- price: 100
- type: entity
name: potato battery
diff --git a/Resources/Prototypes/Entities/Objects/Power/powersink.yml b/Resources/Prototypes/Entities/Objects/Power/powersink.yml
index ec023d1921..cf656afbfa 100644
--- a/Resources/Prototypes/Entities/Objects/Power/powersink.yml
+++ b/Resources/Prototypes/Entities/Objects/Power/powersink.yml
@@ -36,6 +36,7 @@
- type: PowerSink
- type: Battery
maxCharge: 7500000
+ pricePerJoule: 0.0003
- type: ExaminableBattery
- type: PowerConsumer
voltage: High
diff --git a/Resources/Prototypes/Entities/Structures/Power/smes.yml b/Resources/Prototypes/Entities/Structures/Power/smes.yml
index 8074059930..e427acaf99 100644
--- a/Resources/Prototypes/Entities/Structures/Power/smes.yml
+++ b/Resources/Prototypes/Entities/Structures/Power/smes.yml
@@ -60,8 +60,6 @@
- type: Machine
board: SMESMachineCircuitboard
- type: StationInfiniteBatteryTarget
- - type: StaticPrice
- price: 750
# SMES' in use