Action charges refactor (#33993)
* Action charges refactor - Fixes the slight godmoding of baseactioncomponent. - Gets back 1ms of server time. * chorg * Remove FrameUpdate * Fixes * More fixes * Combine * Fixes * Updates * weh * Last fixes * weh * Fix naughty * YAML fixes * This one too * Merge conflicts * This thing * Review * Fix this as well * Icon fix * weh * Review * Review * seamless * Review
This commit is contained in:
@@ -10,7 +10,7 @@ namespace Content.Shared.RCD.Systems;
|
||||
|
||||
public sealed class RCDAmmoSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedChargesSystem _charges = default!;
|
||||
[Dependency] private readonly SharedChargesSystem _sharedCharges = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
|
||||
@@ -41,9 +41,10 @@ public sealed class RCDAmmoSystem : EntitySystem
|
||||
!TryComp<LimitedChargesComponent>(target, out var charges))
|
||||
return;
|
||||
|
||||
var current = _sharedCharges.GetCurrentCharges((target, charges));
|
||||
var user = args.User;
|
||||
args.Handled = true;
|
||||
var count = Math.Min(charges.MaxCharges - charges.Charges, comp.Charges);
|
||||
var count = Math.Min(charges.MaxCharges - current, comp.Charges);
|
||||
if (count <= 0)
|
||||
{
|
||||
_popup.PopupClient(Loc.GetString("rcd-ammo-component-after-interact-full"), target, user);
|
||||
@@ -51,7 +52,7 @@ public sealed class RCDAmmoSystem : EntitySystem
|
||||
}
|
||||
|
||||
_popup.PopupClient(Loc.GetString("rcd-ammo-component-after-interact-refilled"), target, user);
|
||||
_charges.AddCharges(target, count, charges);
|
||||
_sharedCharges.AddCharges(target, count);
|
||||
comp.Charges -= count;
|
||||
Dirty(uid, comp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user