Flashbang tweaks. (#478)
* - tweak: Flashbang tweaks. * - add: More flashbang stuff.
This commit is contained in:
@@ -179,8 +179,10 @@ namespace Content.Server.Flash
|
|||||||
// They shouldn't have flash removed in between right?
|
// They shouldn't have flash removed in between right?
|
||||||
Flash(entity, user, source, duration, slowTo, displayPopup);
|
Flash(entity, user, source, duration, slowTo, displayPopup);
|
||||||
|
|
||||||
|
var distance = (mapPosition.Position - _transform.GetMapCoordinates(entity).Position).Length();
|
||||||
|
|
||||||
if (forceStun) // WD
|
if (forceStun) // WD
|
||||||
_flashSoundSuppressionSystem.Stun(entity, duration);
|
_flashSoundSuppressionSystem.Stun(entity, duration, distance, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
_audio.PlayPvs(sound, source, AudioParams.Default.WithVolume(1f).WithMaxDistance(3f));
|
_audio.PlayPvs(sound, source, AudioParams.Default.WithVolume(1f).WithMaxDistance(3f));
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ namespace Content.Shared.Standing
|
|||||||
|
|
||||||
// WD EDIT
|
// WD EDIT
|
||||||
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool CanLieDown = false;
|
public bool CanLieDown;
|
||||||
|
|
||||||
// WD EDIT
|
// WD EDIT
|
||||||
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool AutoGetUp = false;
|
public bool AutoGetUp = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of fixtures that had their collision mask changed when the entity was downed.
|
/// List of fixtures that had their collision mask changed when the entity was downed.
|
||||||
|
|||||||
@@ -5,5 +5,6 @@ namespace Content.Shared._White.BuffedFlashGrenade;
|
|||||||
[RegisterComponent, NetworkedComponent]
|
[RegisterComponent, NetworkedComponent]
|
||||||
public sealed partial class FlashSoundSuppressionComponent : Component
|
public sealed partial class FlashSoundSuppressionComponent : Component
|
||||||
{
|
{
|
||||||
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public float MaxRange = 3f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,26 +18,37 @@ public sealed class FlashSoundSuppressionSystem : EntitySystem
|
|||||||
private void OnGetFlashbanged(Entity<FlashSoundSuppressionComponent> ent,
|
private void OnGetFlashbanged(Entity<FlashSoundSuppressionComponent> ent,
|
||||||
ref InventoryRelayedEvent<GetFlashbangedEvent> args)
|
ref InventoryRelayedEvent<GetFlashbangedEvent> args)
|
||||||
{
|
{
|
||||||
args.Args.Protected = true;
|
args.Args.MaxRange = MathF.Min(args.Args.MaxRange, ent.Comp.MaxRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stun(EntityUid target, float duration)
|
public void Stun(EntityUid target, float duration, float distance, float range)
|
||||||
{
|
{
|
||||||
if (HasComp<FlashSoundSuppressionComponent>(target))
|
if (TryComp<FlashSoundSuppressionComponent>(target, out var suppression))
|
||||||
return;
|
range = MathF.Min(range, suppression.MaxRange);
|
||||||
|
|
||||||
var ev = new GetFlashbangedEvent();
|
var ev = new GetFlashbangedEvent();
|
||||||
|
ev.MaxRange = range;
|
||||||
RaiseLocalEvent(target, ev);
|
RaiseLocalEvent(target, ev);
|
||||||
if (ev.Protected)
|
range = MathF.Min(range, ev.MaxRange);
|
||||||
|
|
||||||
|
if (range <= 0f)
|
||||||
|
return;
|
||||||
|
if (distance < 0f)
|
||||||
|
distance = 0f;
|
||||||
|
if (distance > range)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_stunSystem.TryParalyze(target, TimeSpan.FromSeconds(duration / 1000f), true);
|
var stunTime = float.Lerp(duration, 0f, distance / range);
|
||||||
|
if (stunTime <= 0f)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_stunSystem.TryParalyze(target, TimeSpan.FromSeconds(stunTime / 1000f), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class GetFlashbangedEvent : EntityEventArgs, IInventoryRelayEvent
|
public sealed class GetFlashbangedEvent : EntityEventArgs, IInventoryRelayEvent
|
||||||
{
|
{
|
||||||
public bool Protected;
|
public float MaxRange = 7f;
|
||||||
|
|
||||||
public SlotFlags TargetSlots => SlotFlags.EARS | SlotFlags.HEAD;
|
public SlotFlags TargetSlots => SlotFlags.EARS | SlotFlags.HEAD;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
state: icon_alt
|
state: icon_alt
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
equippedPrefix: alt
|
equippedPrefix: alt
|
||||||
- type: FlashSoundSuppression # WD
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: ClothingHeadsetAlt
|
parent: ClothingHeadsetAlt
|
||||||
|
|||||||
@@ -185,7 +185,7 @@
|
|||||||
Piercing: 0.9
|
Piercing: 0.9
|
||||||
Heat: 0.9
|
Heat: 0.9
|
||||||
- type: FlashImmunity # WD edit
|
- type: FlashImmunity # WD edit
|
||||||
- type: FlashSoundSuppression # WD edit
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
#Brigmedic Hardsuit
|
#Brigmedic Hardsuit
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -214,7 +214,7 @@
|
|||||||
highPressureMultiplier: 0.6
|
highPressureMultiplier: 0.6
|
||||||
lowPressureMultiplier: 1000
|
lowPressureMultiplier: 1000
|
||||||
- type: FlashImmunity # WD edit
|
- type: FlashImmunity # WD edit
|
||||||
- type: FlashSoundSuppression # WD edit
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
#Warden's Hardsuit
|
#Warden's Hardsuit
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -241,7 +241,7 @@
|
|||||||
Piercing: 0.9
|
Piercing: 0.9
|
||||||
Heat: 0.9
|
Heat: 0.9
|
||||||
- type: FlashImmunity # WD edit
|
- type: FlashImmunity # WD edit
|
||||||
- type: FlashSoundSuppression # WD edit
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
#Captain's Hardsuit
|
#Captain's Hardsuit
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -259,7 +259,7 @@
|
|||||||
highPressureMultiplier: 0.3
|
highPressureMultiplier: 0.3
|
||||||
lowPressureMultiplier: 1000
|
lowPressureMultiplier: 1000
|
||||||
- type: FlashImmunity # WD edit
|
- type: FlashImmunity # WD edit
|
||||||
- type: FlashSoundSuppression # WD edit
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
#Inspector's Hardsuit
|
#Inspector's Hardsuit
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -423,6 +423,7 @@
|
|||||||
Heat: 0.9
|
Heat: 0.9
|
||||||
- type: EyeProtection # WD edit
|
- type: EyeProtection # WD edit
|
||||||
- type: FlashImmunity # WD
|
- type: FlashImmunity # WD
|
||||||
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
#Blood-red Medic Hardsuit
|
#Blood-red Medic Hardsuit
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -450,6 +451,7 @@
|
|||||||
Heat: 0.9
|
Heat: 0.9
|
||||||
- type: EyeProtection # WD edit
|
- type: EyeProtection # WD edit
|
||||||
- type: FlashImmunity # WD
|
- type: FlashImmunity # WD
|
||||||
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
#Syndicate Elite Hardsuit
|
#Syndicate Elite Hardsuit
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -479,6 +481,7 @@
|
|||||||
Heat: 0.9
|
Heat: 0.9
|
||||||
- type: EyeProtection # WD edit
|
- type: EyeProtection # WD edit
|
||||||
- type: FlashImmunity # WD
|
- type: FlashImmunity # WD
|
||||||
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
#Syndicate Commander Hardsuit
|
#Syndicate Commander Hardsuit
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -506,6 +509,7 @@
|
|||||||
Heat: 0.9
|
Heat: 0.9
|
||||||
- type: EyeProtection # WD edit
|
- type: EyeProtection # WD edit
|
||||||
- type: FlashImmunity # WD
|
- type: FlashImmunity # WD
|
||||||
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
#Cybersun Juggernaut Hardsuit
|
#Cybersun Juggernaut Hardsuit
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -531,6 +535,7 @@
|
|||||||
Heat: 0.9
|
Heat: 0.9
|
||||||
- type: EyeProtection # WD edit
|
- type: EyeProtection # WD edit
|
||||||
- type: FlashImmunity # WD
|
- type: FlashImmunity # WD
|
||||||
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
#Wizard Hardsuit
|
#Wizard Hardsuit
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -557,6 +562,9 @@
|
|||||||
Piercing: 0.9
|
Piercing: 0.9
|
||||||
Heat: 0.9
|
Heat: 0.9
|
||||||
- type: WizardClothes
|
- type: WizardClothes
|
||||||
|
- type: EyeProtection
|
||||||
|
- type: FlashImmunity
|
||||||
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
#Organic Space Suit
|
#Organic Space Suit
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -632,6 +640,7 @@
|
|||||||
Heat: 0.9
|
Heat: 0.9
|
||||||
- type: EyeProtection # WD edit
|
- type: EyeProtection # WD edit
|
||||||
- type: FlashImmunity # WD
|
- type: FlashImmunity # WD
|
||||||
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
#ERT Chaplain Hardsuit
|
#ERT Chaplain Hardsuit
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -672,6 +681,7 @@
|
|||||||
- type: EyeProtection # WD edit
|
- type: EyeProtection # WD edit
|
||||||
- type: FlashImmunity # WD
|
- type: FlashImmunity # WD
|
||||||
|
|
||||||
|
- type: FlashSoundSuppression
|
||||||
#ERT Medical Hardsuit
|
#ERT Medical Hardsuit
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: ClothingHeadHelmetHardsuitSyndieElite
|
parent: ClothingHeadHelmetHardsuitSyndieElite
|
||||||
@@ -688,6 +698,7 @@
|
|||||||
color: "#adffec"
|
color: "#adffec"
|
||||||
- type: EyeProtection # WD edit
|
- type: EyeProtection # WD edit
|
||||||
- type: FlashImmunity # WD
|
- type: FlashImmunity # WD
|
||||||
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
#ERT Security Hardsuit
|
#ERT Security Hardsuit
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -712,6 +723,7 @@
|
|||||||
Heat: 0.9
|
Heat: 0.9
|
||||||
- type: EyeProtection # WD edit
|
- type: EyeProtection # WD edit
|
||||||
- type: FlashImmunity # WD
|
- type: FlashImmunity # WD
|
||||||
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
#ERT Janitor Hardsuit
|
#ERT Janitor Hardsuit
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -729,6 +741,7 @@
|
|||||||
color: "#cbadff"
|
color: "#cbadff"
|
||||||
- type: EyeProtection # WD edit
|
- type: EyeProtection # WD edit
|
||||||
- type: FlashImmunity # WD
|
- type: FlashImmunity # WD
|
||||||
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
#CBURN Hardsuit
|
#CBURN Hardsuit
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -770,6 +783,7 @@
|
|||||||
Heat: 0.9
|
Heat: 0.9
|
||||||
- type: EyeProtection # WD edit
|
- type: EyeProtection # WD edit
|
||||||
- type: FlashImmunity # WD
|
- type: FlashImmunity # WD
|
||||||
|
- type: FlashSoundSuppression
|
||||||
|
|
||||||
#Deathsquad Hardsuit
|
#Deathsquad Hardsuit
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -797,6 +811,8 @@
|
|||||||
Caustic: 0.95
|
Caustic: 0.95
|
||||||
- type: EyeProtection # WD edit
|
- type: EyeProtection # WD edit
|
||||||
- type: FlashImmunity # WD
|
- type: FlashImmunity # WD
|
||||||
|
- type: FlashSoundSuppression
|
||||||
|
maxRange: 0
|
||||||
- type: ShowHealthBars
|
- type: ShowHealthBars
|
||||||
damageContainers:
|
damageContainers:
|
||||||
- Biological
|
- Biological
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
- type: DeleteOnChangelingRefund
|
- type: DeleteOnChangelingRefund
|
||||||
- type: FlashImmunity
|
- type: FlashImmunity
|
||||||
- type: EyeProtection
|
- type: EyeProtection
|
||||||
|
- type: FlashSoundSuppression
|
||||||
- type: HiveHead
|
- type: HiveHead
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
|
|||||||
Reference in New Issue
Block a user