]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Decouple power sink from tickrate (#40789)
authorYotaXP <yotaxp+git@gmail.com>
Fri, 10 Oct 2025 23:01:33 +0000 (19:01 -0400)
committerGitHub <noreply@github.com>
Fri, 10 Oct 2025 23:01:33 +0000 (23:01 +0000)
* Fix typo in `BatterySystem.ChangeCharge`.

* Decouple power sink behavior from tickrate.

* Fix power sink's price per joule

Content.Server/Power/EntitySystems/BatterySystem.cs
Content.Server/PowerSink/PowerSinkSystem.cs
Resources/Prototypes/Entities/Objects/Power/powersink.yml

index 28b14f69258e061d70f2b88cc914aa86dc5d9b91..c49a2f0f6b44ca563cb1ab9a730d0d3f85221c12 100644 (file)
@@ -171,7 +171,7 @@ namespace Content.Server.Power.EntitySystems
             if (!Resolve(uid, ref battery))
                 return 0;
 
-            var newValue = Math.Clamp(0, battery.CurrentCharge + value, battery.MaxCharge);
+            var newValue = Math.Clamp(battery.CurrentCharge + value, 0, battery.MaxCharge);
             var delta = newValue - battery.CurrentCharge;
             battery.CurrentCharge = newValue;
 
index 2bf9046cc3126206c906842027104629ca3a1d16..df0980883d44ed4469baf18924eeb15f05dd890b 100644 (file)
@@ -66,7 +66,7 @@ namespace Content.Server.PowerSink
                 if (!transform.Anchored)
                     continue;
 
-                _battery.SetCharge(entity, battery.CurrentCharge + networkLoad.NetworkLoad.ReceivingPower / 1000, battery);
+                _battery.ChangeCharge(entity, networkLoad.NetworkLoad.ReceivingPower * frameTime, battery);
 
                 var currentBatteryThreshold = battery.CurrentCharge / battery.MaxCharge;
 
index 7385b9a82582113dd523709b8309f87caea54d82..089610883cef0a7707219b1a6a8c1592be2cfe11 100644 (file)
@@ -40,8 +40,8 @@
           acts: [ "Destruction" ]
     - type: PowerSink
     - type: Battery
-      maxCharge: 7500000
-      pricePerJoule: 0.0003
+      maxCharge: 250000000
+      pricePerJoule: 0.000009
     - type: ExaminableBattery
     - type: PowerConsumer
       voltage: High