fix charged spells vulnerability (#612)
This commit is contained in:
@@ -132,7 +132,7 @@ public sealed class ChargeActionSystem : SharedChargingSystem
|
||||
{
|
||||
if (_chargeLevel > 0 && _charging)
|
||||
{
|
||||
RaiseNetworkEvent(new AddWizardChargeEvent(action.ChargeProto));
|
||||
RaiseNetworkEvent(new AddWizardChargeEvent(GetNetEntity(actionId)));
|
||||
}
|
||||
_prevChargeLevel = _chargeLevel;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Content.Shared._White.Wizard;
|
||||
using Content.Server.Actions;
|
||||
using Content.Shared._White.Wizard;
|
||||
using Content.Shared._White.Wizard.Charging;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Follower;
|
||||
using Content.Shared.Mobs;
|
||||
using Robust.Shared.Audio;
|
||||
@@ -12,6 +14,7 @@ public sealed class ChargingSystem : SharedChargingSystem
|
||||
{
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly FollowerSystem _followerSystem = default!;
|
||||
[Dependency] private readonly ActionsSystem _actionsSystem = default!;
|
||||
|
||||
private readonly Dictionary<EntityUid, List<EntityUid>> _charges = new();
|
||||
|
||||
@@ -132,8 +135,15 @@ public sealed class ChargingSystem : SharedChargingSystem
|
||||
|
||||
private void Add(AddWizardChargeEvent msg, EntitySessionEventArgs args)
|
||||
{
|
||||
var spell = GetEntity(msg.Spell);
|
||||
if (!_actionsSystem.TryGetActionData(spell, out var baseAction) ||
|
||||
baseAction is not BaseTargetActionComponent action || !action.IsChargeEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.SenderSession.AttachedEntity != null)
|
||||
AddCharge(args.SenderSession.AttachedEntity.Value, msg.ChargeProto);
|
||||
AddCharge(args.SenderSession.AttachedEntity.Value, action.ChargeProto);
|
||||
}
|
||||
|
||||
private void Remove(RemoveWizardChargeEvent msg, EntitySessionEventArgs args)
|
||||
|
||||
@@ -31,11 +31,11 @@ public struct BeforeCastSpellEvent
|
||||
[Serializable, NetSerializable]
|
||||
public sealed partial class AddWizardChargeEvent : EntityEventArgs
|
||||
{
|
||||
public string ChargeProto;
|
||||
public NetEntity Spell;
|
||||
|
||||
public AddWizardChargeEvent(string chargeProto)
|
||||
public AddWizardChargeEvent(NetEntity spell)
|
||||
{
|
||||
ChargeProto = chargeProto;
|
||||
Spell = spell;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user