@@ -19,19 +19,19 @@ public abstract partial class CP14SharedMagicSystem
|
||||
SubscribeLocalEvent<CP14MagicEffectComponent, CP14DelayedEntityTargetActionDoAfterEvent>(OnDelayedEntityTargetDoAfter);
|
||||
}
|
||||
|
||||
private bool TryStartDelayedAction(ICP14DelayedMagicEffect delayedEffect, DoAfterEvent doAfter, Entity<CP14MagicEffectComponent> action, EntityUid performer)
|
||||
private bool TryStartDelayedAction(ICP14DelayedMagicEffect delayedEffect, DoAfterEvent doAfter, Entity<CP14MagicEffectComponent> action, EntityUid? target, EntityUid performer)
|
||||
{
|
||||
if (_doAfter.IsRunning(action.Comp.ActiveDoAfter))
|
||||
return false;
|
||||
|
||||
var fromItem = action.Comp.SpellStorage is not null;
|
||||
|
||||
var doAfterEventArgs = new DoAfterArgs(EntityManager, performer, MathF.Max(delayedEffect.CastDelay, 0.3f), doAfter, action, used: action.Comp.SpellStorage)
|
||||
var doAfterEventArgs = new DoAfterArgs(EntityManager, performer, MathF.Max(delayedEffect.CastDelay, 0.3f), doAfter, action, used: action.Comp.SpellStorage, target: target)
|
||||
{
|
||||
BreakOnMove = delayedEffect.BreakOnMove,
|
||||
BreakOnDamage = delayedEffect.BreakOnDamage,
|
||||
Hidden = delayedEffect.Hidden,
|
||||
DistanceThreshold = 100f,
|
||||
DistanceThreshold = delayedEffect.DistanceThreshold,
|
||||
CancelDuplicate = true,
|
||||
BlockDuplicate = true,
|
||||
BreakOnDropItem = fromItem,
|
||||
@@ -65,7 +65,7 @@ public abstract partial class CP14SharedMagicSystem
|
||||
_doAfter.Cancel(action.Comp.ActiveDoAfter);
|
||||
else
|
||||
{
|
||||
if (TryStartDelayedAction(delayedEffect, doAfter, action, performer))
|
||||
if (TryStartDelayedAction(delayedEffect, doAfter, action, target, performer))
|
||||
{
|
||||
var evStart = new CP14StartCastMagicEffectEvent(performer);
|
||||
RaiseLocalEvent(action, ref evStart);
|
||||
|
||||
@@ -72,12 +72,12 @@ public abstract partial class CP14SharedMagicSystem
|
||||
|
||||
var fromItem = action.Comp.SpellStorage is not null;
|
||||
|
||||
var doAfterEventArgs = new DoAfterArgs(EntityManager, performer, toggleable.CastTime, doAfter, action, used: action.Comp.SpellStorage)
|
||||
var doAfterEventArgs = new DoAfterArgs(EntityManager, performer, toggleable.CastTime, doAfter, action, used: action.Comp.SpellStorage, target: entityTarget)
|
||||
{
|
||||
BreakOnMove = toggleable.BreakOnMove,
|
||||
BreakOnDamage = toggleable.BreakOnDamage,
|
||||
Hidden = toggleable.Hidden,
|
||||
DistanceThreshold = 100f,
|
||||
DistanceThreshold = toggleable.DistanceThreshold,
|
||||
CancelDuplicate = true,
|
||||
BlockDuplicate = true,
|
||||
BreakOnDropItem = fromItem,
|
||||
|
||||
@@ -15,9 +15,9 @@ public interface ICP14DelayedMagicEffect
|
||||
|
||||
public bool BreakOnDamage { get; }
|
||||
|
||||
public bool Hidden{ get; }
|
||||
public float DistanceThreshold { get; }
|
||||
|
||||
public float EntityDistance { get; }
|
||||
public bool Hidden{ get; }
|
||||
}
|
||||
|
||||
public sealed partial class CP14DelayedEntityWorldTargetActionEvent : EntityWorldTargetActionEvent,
|
||||
@@ -36,10 +36,10 @@ public sealed partial class CP14DelayedEntityWorldTargetActionEvent : EntityWorl
|
||||
public bool BreakOnDamage { get; private set; } = true;
|
||||
|
||||
[DataField]
|
||||
public bool Hidden { get; private set; } = false;
|
||||
public float DistanceThreshold { get; private set; } = 100f;
|
||||
|
||||
[DataField]
|
||||
public float EntityDistance { get; private set; } = 100f;
|
||||
public bool Hidden { get; private set; } = false;
|
||||
}
|
||||
|
||||
//Entity Target
|
||||
@@ -59,10 +59,10 @@ public sealed partial class CP14DelayedEntityTargetActionEvent : EntityTargetAct
|
||||
public bool BreakOnDamage { get; private set; } = true;
|
||||
|
||||
[DataField]
|
||||
public bool Hidden { get; private set; } = false;
|
||||
public float DistanceThreshold { get; private set; } = 100f;
|
||||
|
||||
[DataField]
|
||||
public float EntityDistance { get; private set; } = 100f;
|
||||
public bool Hidden { get; private set; } = false;
|
||||
}
|
||||
|
||||
public sealed partial class CP14DelayedInstantActionEvent : InstantActionEvent, ICP14DelayedMagicEffect
|
||||
@@ -80,10 +80,10 @@ public sealed partial class CP14DelayedInstantActionEvent : InstantActionEvent,
|
||||
public bool BreakOnDamage { get; private set; } = true;
|
||||
|
||||
[DataField]
|
||||
public bool Hidden { get; private set; } = false;
|
||||
public float DistanceThreshold { get; private set; } = 100f;
|
||||
|
||||
[DataField]
|
||||
public float EntityDistance { get; private set; } = 100f;
|
||||
public bool Hidden { get; private set; } = false;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
@@ -17,9 +17,9 @@ public interface ICP14ToggleableMagicEffect
|
||||
|
||||
public bool BreakOnDamage { get; }
|
||||
|
||||
public bool Hidden{ get; }
|
||||
public float DistanceThreshold { get; }
|
||||
|
||||
public float EntityDistance { get; }
|
||||
public bool Hidden{ get; }
|
||||
}
|
||||
|
||||
public sealed partial class CP14ToggleableInstantActionEvent : InstantActionEvent, ICP14ToggleableMagicEffect
|
||||
@@ -40,10 +40,10 @@ public sealed partial class CP14ToggleableInstantActionEvent : InstantActionEven
|
||||
public bool BreakOnDamage { get; private set; } = true;
|
||||
|
||||
[DataField]
|
||||
public bool Hidden { get; private set; } = false;
|
||||
public float DistanceThreshold { get; private set; } = 100f;
|
||||
|
||||
[DataField]
|
||||
public float EntityDistance { get; private set; } = 100f;
|
||||
public bool Hidden { get; private set; } = false;
|
||||
}
|
||||
|
||||
public sealed partial class CP14ToggleableEntityWorldTargetActionEvent : EntityWorldTargetActionEvent, ICP14ToggleableMagicEffect
|
||||
@@ -64,10 +64,10 @@ public sealed partial class CP14ToggleableEntityWorldTargetActionEvent : EntityW
|
||||
public bool BreakOnDamage { get; private set; } = true;
|
||||
|
||||
[DataField]
|
||||
public bool Hidden { get; private set; } = false;
|
||||
public float DistanceThreshold { get; private set; } = 100f;
|
||||
|
||||
[DataField]
|
||||
public float EntityDistance { get; private set; } = 100f;
|
||||
public bool Hidden { get; private set; } = false;
|
||||
}
|
||||
|
||||
public sealed partial class CP14ToggleableEntityTargetActionEvent : EntityTargetActionEvent, ICP14ToggleableMagicEffect
|
||||
@@ -88,10 +88,10 @@ public sealed partial class CP14ToggleableEntityTargetActionEvent : EntityTarget
|
||||
public bool BreakOnDamage { get; private set; } = true;
|
||||
|
||||
[DataField]
|
||||
public bool Hidden { get; private set; } = false;
|
||||
public float DistanceThreshold { get; private set; } = 100f;
|
||||
|
||||
[DataField]
|
||||
public float EntityDistance { get; private set; } = 100f;
|
||||
public bool Hidden { get; private set; } = false;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
Reference in New Issue
Block a user