Status effect refactor (#4868)
* Oops! All Changes In One Commit * try desperately to fix prediction issues and fail * oops * test * actually fixes prediction issues * port jittering to status effect * default merge behavior + alert cooldown stuff * silly test issue * zabloing * address reviews
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Server.Act;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.StatusEffect;
|
||||
using Content.Shared.Stunnable;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -21,28 +22,30 @@ namespace Content.Server.Stunnable
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<StunnableComponent, DisarmedActEvent>(OnDisarmed);
|
||||
SubscribeLocalEvent<StatusEffectsComponent, DisarmedActEvent>(OnDisarmed);
|
||||
}
|
||||
|
||||
private void OnDisarmed(EntityUid uid, StunnableComponent stunnable, DisarmedActEvent args)
|
||||
private void OnDisarmed(EntityUid uid, StatusEffectsComponent status, DisarmedActEvent args)
|
||||
{
|
||||
if (args.Handled || !_random.Prob(args.PushProbability))
|
||||
return;
|
||||
|
||||
Paralyze(uid, TimeSpan.FromSeconds(4f), stunnable);
|
||||
if (!TryParalyze(uid, TimeSpan.FromSeconds(4f), status))
|
||||
return;
|
||||
|
||||
var source = args.Source;
|
||||
var target = args.Target;
|
||||
|
||||
if (source != null)
|
||||
{
|
||||
SoundSystem.Play(Filter.Pvs(source), stunnable.StunAttemptSound.GetSound(), source, AudioHelpers.WithVariation(0.025f));
|
||||
var knock = EntityManager.GetComponent<KnockedDownComponent>(uid);
|
||||
SoundSystem.Play(Filter.Pvs(source), knock.StunAttemptSound.GetSound(), source, AudioHelpers.WithVariation(0.025f));
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
// TODO: Use PopupSystem
|
||||
source.PopupMessageOtherClients(Loc.GetString("stunnable-component-disarm-success-others", ("source", source.Name), ("target", target.Name)));
|
||||
source.PopupMessageCursor(Loc.GetString("stunnable-component-disarm-success", ("target", target.Name)));
|
||||
source.PopupMessageOtherClients(Loc.GetString("stunned-component-disarm-success-others", ("source", source.Name), ("target", target.Name)));
|
||||
source.PopupMessageCursor(Loc.GetString("stunned-component-disarm-success", ("target", target.Name)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user