Files
crystall-punk-14/Content.Client/_CP14/MagicVision/CP14ClientMagicVisionSystem.cs

176 lines
6.2 KiB
C#
Raw Normal View History

Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
using System.Numerics;
using Content.Shared._CP14.MagicVision;
using Content.Shared.Examine;
Make magical vision drain Mana (#1832) * 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>
2025-10-31 19:11:15 +01:00
using Content.Shared.StatusEffectNew;
Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Client.Timing;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Utility;
namespace Content.Client._CP14.MagicVision;
public sealed class CP14ClientMagicVisionSystem : CP14SharedMagicVisionSystem
{
[Dependency] private readonly IClientGameTiming _timing = default!;
[Dependency] private readonly SpriteSystem _sprite = default!;
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly IOverlayManager _overlayMan = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
Make magical vision drain Mana (#1832) * 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>
2025-10-31 19:11:15 +01:00
[Dependency] private readonly StatusEffectsSystem _status = default!;
Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
private CP14MagicVisionOverlay? _overlay;
private CP14MagicVisionNoirOverlay? _overlay2;
private TimeSpan _nextUpdate = TimeSpan.Zero;
private readonly SoundSpecifier _startSound = new SoundPathSpecifier(new ResPath("/Audio/Effects/eye_open.ogg"));
private readonly SoundSpecifier _endSound = new SoundPathSpecifier(new ResPath("/Audio/Effects/eye_close.ogg"));
Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CP14MagicVisionMarkerComponent, AfterAutoHandleStateEvent>(OnHandleStateMarker);
Make magical vision drain Mana (#1832) * 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>
2025-10-31 19:11:15 +01:00
SubscribeLocalEvent<CP14MagicVisionStatusEffectComponent, StatusEffectRelayedEvent<LocalPlayerAttachedEvent>>(OnPlayerAttached);
SubscribeLocalEvent<CP14MagicVisionStatusEffectComponent, StatusEffectRelayedEvent<LocalPlayerDetachedEvent>>(OnPlayerDetached);
SubscribeLocalEvent<CP14MagicVisionStatusEffectComponent, StatusEffectAppliedEvent>(OnStatusEffectApplied);
SubscribeLocalEvent<CP14MagicVisionStatusEffectComponent, StatusEffectRemovedEvent>(OnStatusEffectRemoved);
Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
}
Make magical vision drain Mana (#1832) * 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>
2025-10-31 19:11:15 +01:00
private void OnPlayerAttached(Entity<CP14MagicVisionStatusEffectComponent> ent, ref StatusEffectRelayedEvent<LocalPlayerAttachedEvent> args)
Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
{
if (args.Args.Entity != _player.LocalEntity)
return;
Make magical vision drain Mana (#1832) * 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>
2025-10-31 19:11:15 +01:00
ApplyOverlay(ent);
Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
}
Make magical vision drain Mana (#1832) * 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>
2025-10-31 19:11:15 +01:00
private void OnStatusEffectApplied(Entity<CP14MagicVisionStatusEffectComponent> ent, ref StatusEffectAppliedEvent args)
Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
{
if (args.Target != _player.LocalEntity)
return;
//Prevents it from being applied twice
if (_timing.IsFirstTimePredicted)
Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
return;
Make magical vision drain Mana (#1832) * 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>
2025-10-31 19:11:15 +01:00
ApplyOverlay(ent);
Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
}
Make magical vision drain Mana (#1832) * 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>
2025-10-31 19:11:15 +01:00
private void OnPlayerDetached(Entity<CP14MagicVisionStatusEffectComponent> ent, ref StatusEffectRelayedEvent<LocalPlayerDetachedEvent> args)
Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
{
if (args.Args.Entity != _player.LocalEntity)
return;
Make magical vision drain Mana (#1832) * 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>
2025-10-31 19:11:15 +01:00
RemoveOverlay(ent);
Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
}
Make magical vision drain Mana (#1832) * 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>
2025-10-31 19:11:15 +01:00
private void OnStatusEffectRemoved(Entity<CP14MagicVisionStatusEffectComponent> ent, ref StatusEffectRemovedEvent args)
Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
{
if (args.Target != _player.LocalEntity)
return;
Make magical vision drain Mana (#1832) * 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>
2025-10-31 19:11:15 +01:00
//Prevents it from beeing removed twice
if (_timing.IsFirstTimePredicted)
Make magical vision drain Mana (#1832) * 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>
2025-10-31 19:11:15 +01:00
return;
RemoveOverlay(ent);
Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
}
protected override void OnExamined(Entity<CP14MagicVisionMarkerComponent> ent, ref ExaminedEvent args)
{
base.OnExamined(ent, ref args);
if (ent.Comp.TargetCoordinates is null)
return;
var originPosition = _transform.GetWorldPosition(ent);
var targetPosition = _transform.ToWorldPosition(ent.Comp.TargetCoordinates.Value);
if ((targetPosition - originPosition).Length() < 0.5f)
return;
Angle angle = new(targetPosition - originPosition);
var pointer = Spawn(ent.Comp.PointerProto, new MapCoordinates(originPosition, _transform.GetMapId(Transform(ent).Coordinates)));
_transform.SetWorldRotation(pointer, angle + Angle.FromDegrees(90));
}
private void OnHandleStateMarker(Entity<CP14MagicVisionMarkerComponent> ent, ref AfterAutoHandleStateEvent args)
{
if (!TryComp<SpriteComponent>(ent, out var sprite))
return;
if (ent.Comp.Icon is null)
return;
var layer = _sprite.AddLayer(ent.Owner, ent.Comp.Icon);
sprite.LayerSetShader(layer, "unshaded");
_sprite.LayerSetScale(ent.Owner, layer, new Vector2(0.5f, 0.5f));
}
public override void Update(float frameTime)
{
base.Update(frameTime);
if (_timing.CurTime < _nextUpdate)
return;
_nextUpdate = _timing.CurTime + TimeSpan.FromSeconds(0.5f);
var queryFade = EntityQueryEnumerator<CP14MagicVisionMarkerComponent, SpriteComponent>();
while (queryFade.MoveNext(out var uid, out var fade, out var sprite))
{
UpdateOpaque((uid, fade), sprite);
}
}
private void UpdateOpaque(Entity<CP14MagicVisionMarkerComponent> ent, SpriteComponent sprite)
{
var progress = Math.Clamp((_timing.CurTime.TotalSeconds - ent.Comp.SpawnTime.TotalSeconds) / (ent.Comp.EndTime.TotalSeconds - ent.Comp.SpawnTime.TotalSeconds), 0, 1);
var alpha = 1 - progress;
_sprite.SetColor((ent.Owner, sprite), Color.White.WithAlpha((float)alpha));
Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
}
Make magical vision drain Mana (#1832) * 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>
2025-10-31 19:11:15 +01:00
private void ApplyOverlay(Entity<CP14MagicVisionStatusEffectComponent> ent)
{
_overlay = new CP14MagicVisionOverlay();
_overlayMan.AddOverlay(_overlay);
_overlay.StartOverlay = _timing.CurTime;
_overlay2 = new CP14MagicVisionNoirOverlay();
_overlayMan.AddOverlay(_overlay2);
_audio.PlayGlobal(_startSound, ent);
}
private void RemoveOverlay(Entity<CP14MagicVisionStatusEffectComponent> ent)
{
// Check if it is the last Magic Vision Status Effect
if (_status.HasEffectComp<CP14MagicVisionStatusEffectComponent>(_player.LocalEntity))
return;
if (_overlay != null)
{
_overlayMan.RemoveOverlay(_overlay);
_overlay = null;
}
if (_overlay2 != null)
{
_overlayMan.RemoveOverlay(_overlay2);
_overlay2 = null;
}
_audio.PlayGlobal(_endSound, ent);
}
Magical vision skill (#1467) * fix firewave error spamming * basic magic traces entities * Add magical vision system and mana trace entities Introduces the magical vision mechanic, including the CP14MagicVisionComponent, marker entities, and related systems for tracking and displaying magical traces. Adds new actions, skill integration, localization strings, and icons for magical vision and trace markers. Magic traces are now spawned on spell use and mob state changes, with directional pointers and localized descriptions. * Show time passed for magic vision markers Adds a display of the time elapsed since a magic vision marker was spawned, using a localized string. Updates English and Russian locale files with the new 'cp14-magic-vision-timed-past' entry. * aura imprints * Update critical and death messages for inclusivity Revised the 'critical' and 'dead' messages in both English and Russian locale files to use more inclusive language, replacing references to 'magical creature' with 'someone'. * Move magic vision spawn on mob state change to server Transferred the logic for spawning magic vision markers on mob state changes (Critical/Dead) from CP14SharedMagicVisionSystem to CP14AuraImprintSystem. This centralizes the event handling on the server side. Also increased the duration of magic vision markers for spell usage from 20 to 50 seconds. * Integrate magic vision with visibility mask system Added a CP14MagicVision flag to VisibilityFlags and updated the magic vision and religion systems to use the visibility mask system. Magic vision markers now use the Visibility component, and visibility is refreshed when relevant components are added or removed. Removed client-side toggling logic in favor of server-driven visibility. * drowsiness overlay * noir shader * sfx design
2025-06-26 13:49:53 +03:00
}