OverlayManager 2 Electric Boogaloo (#1410)

This commit is contained in:
R. Neuser
2020-07-19 10:32:26 -05:00
committed by GitHub
parent 0d03aeff37
commit 86c318cc74
10 changed files with 264 additions and 97 deletions

View File

@@ -31,7 +31,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
public override string Name => "Flash";
[ViewVariables(VVAccess.ReadWrite)] private int _flashDuration = 5000;
[ViewVariables(VVAccess.ReadWrite)] private float _flashFalloffExp = 8f;
[ViewVariables(VVAccess.ReadWrite)] private int _uses = 5;
[ViewVariables(VVAccess.ReadWrite)] private float _range = 3f;
[ViewVariables(VVAccess.ReadWrite)] private int _aoeFlashDuration = 5000 / 3;
@@ -55,9 +54,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
base.ExposeData(serializer);
serializer.DataField(ref _flashDuration, "duration", 5000);
serializer.DataField(ref _flashFalloffExp, "flashFalloffExp", 8f);
serializer.DataField(ref _uses, "uses", 5);
serializer.DataField(ref _range, "range", 3f);
serializer.DataField(ref _range, "range", 7f);
serializer.DataField(ref _aoeFlashDuration, "aoeFlashDuration", _flashDuration / 3);
serializer.DataField(ref _slowTo, "slowTo", 0.75f);
}
@@ -139,9 +137,18 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
{
if (entity.TryGetComponent(out ServerOverlayEffectsComponent overlayEffectsComponent))
{
var container = new TimedOverlayContainer(nameof(OverlayType.FlashOverlay), flashDuration);
overlayEffectsComponent.AddOverlay(container);
container.StartTimer(() => overlayEffectsComponent.RemoveOverlay(container));
if (!overlayEffectsComponent.TryModifyOverlay(nameof(SharedOverlayID.FlashOverlay),
overlay =>
{
if (overlay.TryGetOverlayParameter<TimedOverlayParameter>(out var timed))
{
timed.Length += flashDuration;
}
}))
{
var container = new OverlayContainer(SharedOverlayID.FlashOverlay, new TimedOverlayParameter(flashDuration));
overlayEffectsComponent.AddOverlay(container);
}
}
if (entity.TryGetComponent(out StunnableComponent stunnableComponent))
@@ -165,8 +172,13 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
if (inDetailsRange)
{
message.AddMarkup(_localizationManager.GetString(
"The flash has [color=green]{0}[/color] uses remaining.", Uses));
message.AddMarkup(
_localizationManager.GetString(
"The flash has [color=green]{0}[/color] {1} remaining.",
Uses,
_localizationManager.GetPluralString("use", "uses", Uses)
)
);
}
}
}