2025-08-23 15:03:33 +03:00
|
|
|
using System.Linq;
|
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.Text;
|
|
|
|
|
using Content.Shared._CP14.AuraDNA;
|
2025-08-23 15:03:33 +03:00
|
|
|
using Content.Shared._CP14.MagicVision.Components;
|
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 Content.Shared.Actions;
|
|
|
|
|
using Content.Shared.Examine;
|
2025-10-31 19:11:15 +01:00
|
|
|
using Content.Shared.Mobs;
|
2025-08-23 15:03:33 +03: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.Shared.Map;
|
2025-06-28 14:04:17 +03:00
|
|
|
using Robust.Shared.Network;
|
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.Shared.Prototypes;
|
|
|
|
|
using Robust.Shared.Timing;
|
|
|
|
|
using Robust.Shared.Utility;
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared._CP14.MagicVision;
|
|
|
|
|
|
|
|
|
|
public abstract class CP14SharedMagicVisionSystem : EntitySystem
|
|
|
|
|
{
|
|
|
|
|
[Dependency] private readonly IGameTiming _timing = default!;
|
|
|
|
|
[Dependency] private readonly MetaDataSystem _meta = default!;
|
2025-06-28 14:04:17 +03:00
|
|
|
[Dependency] private readonly INetManager _net = default!;
|
2025-08-23 15:03:33 +03:00
|
|
|
[Dependency] private readonly StatusEffectsSystem _statusEffects = 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
|
|
|
|
|
|
|
|
public readonly EntProtoId MagicTraceProto = "CP14MagicVisionMarker";
|
|
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
|
|
|
|
SubscribeLocalEvent<CP14MagicVisionMarkerComponent, ExaminedEvent>(OnExamined);
|
2025-10-31 19:11:15 +01:00
|
|
|
SubscribeLocalEvent<CP14MagicVisionStatusEffectComponent, StatusEffectRelayedEvent<MobStateChangedEvent>>(OnMobStateChange);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnMobStateChange(Entity<CP14MagicVisionStatusEffectComponent> ent, ref StatusEffectRelayedEvent<MobStateChangedEvent> args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Args.NewMobState == MobState.Alive) return;
|
|
|
|
|
|
|
|
|
|
//Removes MagicVisionStatusEffect entity when MobState is Crit,Dead or Invalid
|
|
|
|
|
TryQueueDel(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 virtual void OnExamined(Entity<CP14MagicVisionMarkerComponent> ent, ref ExaminedEvent args)
|
|
|
|
|
{
|
|
|
|
|
var sb = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
var timePassed = _timing.CurTime - ent.Comp.SpawnTime;
|
2025-08-23 15:03:33 +03:00
|
|
|
var timeRemaining = ent.Comp.EndTime - _timing.CurTime;
|
|
|
|
|
var totalDuration = ent.Comp.EndTime - ent.Comp.SpawnTime;
|
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
|
|
|
|
2025-08-23 15:03:33 +03:00
|
|
|
sb.Append($"{Loc.GetString("cp14-magic-vision-timed-past")} {timePassed.Minutes}:{timePassed.Seconds:D2}\n");
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(ent.Comp.AuraImprint))
|
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
|
|
|
{
|
2025-08-23 15:03:33 +03:00
|
|
|
args.AddMarkup(sb.ToString());
|
|
|
|
|
return;
|
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
|
|
|
}
|
|
|
|
|
|
2025-08-23 15:03:33 +03:00
|
|
|
var imprint = ent.Comp.AuraImprint;
|
|
|
|
|
|
|
|
|
|
// Try to extract the content between [color=...] and [/color]
|
|
|
|
|
var startTag = imprint.IndexOf(']') + 1;
|
|
|
|
|
var endTag = imprint.LastIndexOf('[');
|
|
|
|
|
if (startTag <= 0 || endTag <= startTag)
|
|
|
|
|
{
|
|
|
|
|
sb.Append($"{Loc.GetString("cp14-magic-vision-aura")} {imprint}");
|
|
|
|
|
args.AddMarkup(sb.ToString());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var content = imprint[startTag..endTag];
|
|
|
|
|
var obscuredContent = new StringBuilder(content.Length);
|
|
|
|
|
|
|
|
|
|
// Progress goes from 0 (fresh) to 1 (completely faded)
|
|
|
|
|
var progress = Math.Clamp(1.0 - (timeRemaining.TotalSeconds / totalDuration.TotalSeconds), 0.0, 1.0);
|
|
|
|
|
|
|
|
|
|
// Number of characters to obscure
|
|
|
|
|
var charsToObscure = (int)Math.Round(content.Length * progress);
|
|
|
|
|
|
|
|
|
|
// Deterministic pseudo-random based on content + entity id
|
|
|
|
|
var hash = (content + ent.Owner.Id).GetHashCode();
|
|
|
|
|
|
|
|
|
|
var obscuredCount = 0;
|
|
|
|
|
for (var i = 0; i < content.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
// Pick bits from hash + index to ensure distribution
|
|
|
|
|
var mask = ((hash >> (i % 32)) ^ i) & 1;
|
|
|
|
|
var shouldObscure = obscuredCount < charsToObscure && mask == 1;
|
|
|
|
|
|
|
|
|
|
obscuredContent.Append(shouldObscure ? '~' : content[i]);
|
|
|
|
|
if (shouldObscure)
|
|
|
|
|
obscuredCount++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If we still didn't obscure enough (due to unlucky bit pattern), obscure remaining from the start
|
|
|
|
|
while (obscuredCount < charsToObscure && obscuredCount < obscuredContent.Length)
|
|
|
|
|
{
|
|
|
|
|
for (var i = 0; i < obscuredContent.Length && obscuredCount < charsToObscure; i++)
|
|
|
|
|
{
|
|
|
|
|
if (obscuredContent[i] != '~')
|
|
|
|
|
{
|
|
|
|
|
obscuredContent[i] = '~';
|
|
|
|
|
obscuredCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var obscuredImprint = imprint.Substring(0, startTag) + obscuredContent + imprint.Substring(endTag);
|
|
|
|
|
sb.Append($"{Loc.GetString("cp14-magic-vision-aura")} {obscuredImprint}");
|
|
|
|
|
|
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
|
|
|
args.AddMarkup(sb.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-23 15:03:33 +03:00
|
|
|
public string? GetAuraImprint(Entity<CP14AuraImprintComponent?> ent)
|
|
|
|
|
{
|
|
|
|
|
if (!Resolve(ent, ref ent.Comp))
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
if (_statusEffects.TryEffectsWithComp<CP14HideMagicAuraStatusEffectComponent>(ent, out var hideComps))
|
|
|
|
|
{
|
|
|
|
|
return hideComps.First().Comp1.Imprint;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ent.Comp.Imprint;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
/// <summary>
|
|
|
|
|
/// Creates an invisible “magical trace” entity that can be seen with magical vision.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="position">Coordinates where the magic trail will be created</param>
|
|
|
|
|
/// <param name="icon">Magic trace icon</param>
|
|
|
|
|
/// <param name="description">Description that can be obtained when examining the magical trace</param>
|
|
|
|
|
/// <param name="duration">Duration of the magical trace</param>
|
|
|
|
|
/// <param name="target">Optional: The direction in which this trace “faces.” When studying the trace,
|
|
|
|
|
/// this direction can be seen in order to understand, for example, in which direction the spell was used.</param>
|
2025-08-23 15:03:33 +03:00
|
|
|
public void SpawnMagicTrace(EntityCoordinates position,
|
|
|
|
|
SpriteSpecifier? icon,
|
|
|
|
|
string description,
|
|
|
|
|
TimeSpan duration,
|
|
|
|
|
EntityUid? aura = null,
|
|
|
|
|
EntityCoordinates? target = null)
|
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
|
|
|
{
|
2025-06-28 14:04:17 +03:00
|
|
|
if (_net.IsClient)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var ent = SpawnAtPosition(MagicTraceProto, position);
|
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
|
|
|
var markerComp = EnsureComp<CP14MagicVisionMarkerComponent>(ent);
|
|
|
|
|
|
|
|
|
|
markerComp.SpawnTime = _timing.CurTime;
|
|
|
|
|
markerComp.EndTime = _timing.CurTime + duration;
|
|
|
|
|
markerComp.TargetCoordinates = target;
|
|
|
|
|
markerComp.Icon = icon;
|
|
|
|
|
|
2025-08-23 15:03:33 +03:00
|
|
|
if (aura is not null)
|
|
|
|
|
markerComp.AuraImprint = GetAuraImprint(aura.Value);
|
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
|
|
|
|
|
|
|
|
_meta.SetEntityDescription(ent, description);
|
|
|
|
|
|
|
|
|
|
Dirty(ent, markerComp);
|
|
|
|
|
}
|
|
|
|
|
}
|