* added generic Entity Effects status effect component * added Magic Vision Statuseffect component * renamed visionmask to Visibilitymask and added StatusEffectComponent notice comment * added two event listeners on MagicVisonStatusEffect applied and removed * moved changes to server side * moved Component serverside * removed Overlay Property * Added magic vison status effect prototype and applying * cleaned upnew lines * added new prototype * moved Magic vision status effect component to shared again * fixed applying mask * cleaned new lines * Moved to components folder * marked MagicVisionComponent obsolete and changed protoid name * Added parent MobStatusEffectBase * added mana cost to Magical vision spell * removed unneeded constructor * Added the system * added statuseffect eventlistners for applied and removed also removed old event listners * removed old magic vision component check * Removed Data field attribute * added back Data field attribute * added access atribute * moved Status effect update to server * removed shared System moved all to server side * Update Content.Shared/_CP14/StatusEffect/Components/CP14EntityEffectsStatusEffectComponent.cs Co-authored-by: Red <96445749+TheShuEd@users.noreply.github.com> * Fix typo in DataField attribute for Effects list * Obliterated CP14MagicVisionComponent from existence * Fix comment capitalization in CP14EntityEffectsStatusEffectComponent * Fix summary capitalization in CP14EntityEffectsStatusEffectComponent * Refactor CP14MagicVisionSystem.cs by removing blank lines Removed unnecessary blank lines for cleaner code. * Remove status effect event handlers Removed event subscription and related methods for status effects. * Remove empty line in OnExamined method * Added a Spell toggle status effect * fixed datfields shouldnt be static * imlpemented status applying in yml * cleaned white space :3 * changed toggle to has status effect * fix leftover * added check for firsttime predict so it doesnt get applied twice * added getvismaskevent to statuseffect relay * changed event lisnter to use CP14MagicVisionStatusEffectComponent to prevent future conflicts * removed unneeded _status property * added check for if its the last status effect on remove * added check if Status effect is already present if applied * changed check to component instead of entity * changed ent target to player.localEntity * fix: removed has effect check as it already has the effect when first apllied * changed event to on player attached * removed first time predicted check * changed cooldown to 0.5 seconds * made Spell mana change effect not save * added status efect applied event listner back and moved apply and remove overlay to separete methods * removed replaced action event * added fix to let nextupdate catch up to CurTime * fix: status effect not beeing removed when crit or dead * fix: Action beeing able to be used while dead * fix: added prediction check to applied back for double apply and remove bug --------- Co-authored-by: Red <96445749+TheShuEd@users.noreply.github.com>
78 lines
3.3 KiB
C#
78 lines
3.3 KiB
C#
using Content.Shared.Movement.Events;
|
|
using Content.Shared.Movement.Systems;
|
|
using Content.Shared.Rejuvenate;
|
|
using Content.Shared.Damage;
|
|
using Content.Shared.Damage.Events;
|
|
using Content.Shared.Speech;
|
|
using Content.Shared.StatusEffectNew.Components;
|
|
using Content.Shared.Stunnable;
|
|
using Robust.Shared.Player;
|
|
using Content.Shared.Mobs;
|
|
|
|
namespace Content.Shared.StatusEffectNew;
|
|
|
|
public sealed partial class StatusEffectsSystem
|
|
{
|
|
private void InitializeRelay()
|
|
{
|
|
//CP14 Zone
|
|
SubscribeLocalEvent<StatusEffectContainerComponent, DamageModifyEvent>(RelayStatusEffectEvent);
|
|
SubscribeLocalEvent<StatusEffectContainerComponent, GetVisMaskEvent>(RefRelayStatusEffectEvent);
|
|
SubscribeLocalEvent<StatusEffectContainerComponent, MobStateChangedEvent>(RefRelayStatusEffectEvent);
|
|
//CP14 Zone end
|
|
|
|
SubscribeLocalEvent<StatusEffectContainerComponent, LocalPlayerAttachedEvent>(RelayStatusEffectEvent);
|
|
SubscribeLocalEvent<StatusEffectContainerComponent, LocalPlayerDetachedEvent>(RelayStatusEffectEvent);
|
|
SubscribeLocalEvent<StatusEffectContainerComponent, RejuvenateEvent>(RelayStatusEffectEvent);
|
|
|
|
SubscribeLocalEvent<StatusEffectContainerComponent, RefreshMovementSpeedModifiersEvent>(RelayStatusEffectEvent);
|
|
SubscribeLocalEvent<StatusEffectContainerComponent, UpdateCanMoveEvent>(RelayStatusEffectEvent);
|
|
|
|
SubscribeLocalEvent<StatusEffectContainerComponent, RefreshFrictionModifiersEvent>(RefRelayStatusEffectEvent);
|
|
SubscribeLocalEvent<StatusEffectContainerComponent, TileFrictionEvent>(RefRelayStatusEffectEvent);
|
|
|
|
SubscribeLocalEvent<StatusEffectContainerComponent, StandUpAttemptEvent>(RefRelayStatusEffectEvent);
|
|
SubscribeLocalEvent<StatusEffectContainerComponent, StunEndAttemptEvent>(RefRelayStatusEffectEvent);
|
|
|
|
SubscribeLocalEvent<StatusEffectContainerComponent, AccentGetEvent>(RelayStatusEffectEvent);
|
|
}
|
|
|
|
private void RefRelayStatusEffectEvent<T>(EntityUid uid, StatusEffectContainerComponent component, ref T args) where T : struct
|
|
{
|
|
RelayEvent((uid, component), ref args);
|
|
}
|
|
|
|
private void RelayStatusEffectEvent<T>(EntityUid uid, StatusEffectContainerComponent component, T args) where T : class
|
|
{
|
|
RelayEvent((uid, component), args);
|
|
}
|
|
|
|
public void RelayEvent<T>(Entity<StatusEffectContainerComponent> statusEffect, ref T args) where T : struct
|
|
{
|
|
// this copies the by-ref event if it is a struct
|
|
var ev = new StatusEffectRelayedEvent<T>(args);
|
|
foreach (var activeEffect in statusEffect.Comp.ActiveStatusEffects?.ContainedEntities ?? [])
|
|
{
|
|
RaiseLocalEvent(activeEffect, ref ev);
|
|
}
|
|
// and now we copy it back
|
|
args = ev.Args;
|
|
}
|
|
|
|
public void RelayEvent<T>(Entity<StatusEffectContainerComponent> statusEffect, T args) where T : class
|
|
{
|
|
// this copies the by-ref event if it is a struct
|
|
var ev = new StatusEffectRelayedEvent<T>(args);
|
|
foreach (var activeEffect in statusEffect.Comp.ActiveStatusEffects?.ContainedEntities ?? [])
|
|
{
|
|
RaiseLocalEvent(activeEffect, ref ev);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Event wrapper for relayed events.
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public record struct StatusEffectRelayedEvent<TEvent>(TEvent Args);
|