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:
@@ -21,7 +21,7 @@ namespace Content.Shared.Emag.Systems;
|
||||
public sealed class EmagSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly SharedChargesSystem _charges = default!;
|
||||
[Dependency] private readonly SharedChargesSystem _sharedCharges = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly TagSystem _tag = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
@@ -61,8 +61,8 @@ public sealed class EmagSystem : EntitySystem
|
||||
if (_tag.HasTag(target, ent.Comp.EmagImmuneTag))
|
||||
return false;
|
||||
|
||||
TryComp<LimitedChargesComponent>(ent, out var charges);
|
||||
if (_charges.IsEmpty(ent, charges))
|
||||
Entity<LimitedChargesComponent?> chargesEnt = ent.Owner;
|
||||
if (_sharedCharges.IsEmpty(chargesEnt))
|
||||
{
|
||||
_popup.PopupClient(Loc.GetString("emag-no-charges"), user, user);
|
||||
return false;
|
||||
@@ -80,8 +80,8 @@ public sealed class EmagSystem : EntitySystem
|
||||
|
||||
_adminLogger.Add(LogType.Emag, LogImpact.High, $"{ToPrettyString(user):player} emagged {ToPrettyString(target):target} with flag(s): {ent.Comp.EmagType}");
|
||||
|
||||
if (charges != null && emaggedEvent.Handled)
|
||||
_charges.UseCharge(ent, charges);
|
||||
if (emaggedEvent.Handled)
|
||||
_sharedCharges.TryUseCharge(chargesEnt);
|
||||
|
||||
if (!emaggedEvent.Repeatable)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user