Фикс пополнения зарядов РЦД используя стаки ресурсов (#699)

* Фиксики

* Спасли Валеру от банкротства
This commit is contained in:
BIGZi0348
2024-09-17 20:41:24 +03:00
committed by GitHub
parent 51ed0bece9
commit 276915fb44
3 changed files with 19 additions and 2 deletions

View File

@@ -63,6 +63,21 @@ public sealed class RCDAmmoSystem : EntitySystem
var user = args.User;
args.Handled = true;
// WD edit start
TryComp<StackComponent>(uid, out var stackComponent);
if (stackComponent != null)
{
var realValue = (int) (stackComponent.Count * comp.ChargeCountModifier);
comp.Charges = realValue;
if (realValue == 0)
{
_popup.PopupClient(Loc.GetString("rcd-ammo-component-after-interact-not-enough"), target, user);
return;
}
}
// WD edit end
var count = Math.Min(charges.MaxCharges - charges.Charges, comp.Charges);
if (count <= 0)
{
@@ -73,7 +88,7 @@ public sealed class RCDAmmoSystem : EntitySystem
_popup.PopupClient(Loc.GetString("rcd-ammo-component-after-interact-refilled"), target, user);
// WD edit start
if (TryComp<StackComponent>(uid, out var stackComponent))
if (stackComponent != null)
{
var spent = (int) (count / comp.ChargeCountModifier) == 0 ? 1 : (int) (count / comp.ChargeCountModifier);
_stack.SetCount(uid, stackComponent.Count - spent);

View File

@@ -1,3 +1,4 @@
rcd-ammo-component-on-examine = It holds {$charges} charges.
rcd-ammo-component-after-interact-full = The RCD is full!
rcd-ammo-component-after-interact-refilled = You refill the RCD.
rcd-ammo-component-after-interact-not-enough = Not enough material for charge.

View File

@@ -1,6 +1,7 @@
rcd-ammo-component-on-examine = Оно содержит { $charges } зарядов.
rcd-ammo-component-after-interact-full = РЦд полностью заряжена!
rcd-ammo-component-after-interact-full = РЦД полностью заряжен!
rcd-ammo-component-after-interact-refilled = Вы перезаряжаете РЦД.
rcd-ammo-component-on-examine-text = Содержит { $ammo } зарядов.
rcd-ammo-component-after-interact-full-text = РЦД полностью заряжен!
rcd-ammo-component-after-interact-refilled-text = Вы перезаряжаете РЦД.
rcd-ammo-component-after-interact-not-enough = Недостаточно материала для заряда.