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?
|
||||
Flash(entity, user, source, duration, slowTo, displayPopup);
|
||||
|
||||
var distance = (mapPosition.Position - _transform.GetMapCoordinates(entity).Position).Length();
|
||||
|
||||
if (forceStun) // WD
|
||||
_flashSoundSuppressionSystem.Stun(entity, duration);
|
||||
_flashSoundSuppressionSystem.Stun(entity, duration, distance, range);
|
||||
}
|
||||
|
||||
_audio.PlayPvs(sound, source, AudioParams.Default.WithVolume(1f).WithMaxDistance(3f));
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace Content.Shared.Standing
|
||||
|
||||
// WD EDIT
|
||||
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool CanLieDown = false;
|
||||
public bool CanLieDown;
|
||||
|
||||
// WD EDIT
|
||||
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool AutoGetUp = false;
|
||||
public bool AutoGetUp = true;
|
||||
|
||||
/// <summary>
|
||||
/// 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]
|
||||
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,
|
||||
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))
|
||||
return;
|
||||
if (TryComp<FlashSoundSuppressionComponent>(target, out var suppression))
|
||||
range = MathF.Min(range, suppression.MaxRange);
|
||||
|
||||
var ev = new GetFlashbangedEvent();
|
||||
ev.MaxRange = range;
|
||||
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;
|
||||
|
||||
_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 bool Protected;
|
||||
public float MaxRange = 7f;
|
||||
|
||||
public SlotFlags TargetSlots => SlotFlags.EARS | SlotFlags.HEAD;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
state: icon_alt
|
||||
- type: Clothing
|
||||
equippedPrefix: alt
|
||||
- type: FlashSoundSuppression # WD
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
- type: entity
|
||||
parent: ClothingHeadsetAlt
|
||||
|
||||
@@ -185,7 +185,7 @@
|
||||
Piercing: 0.9
|
||||
Heat: 0.9
|
||||
- type: FlashImmunity # WD edit
|
||||
- type: FlashSoundSuppression # WD edit
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
#Brigmedic Hardsuit
|
||||
- type: entity
|
||||
@@ -214,7 +214,7 @@
|
||||
highPressureMultiplier: 0.6
|
||||
lowPressureMultiplier: 1000
|
||||
- type: FlashImmunity # WD edit
|
||||
- type: FlashSoundSuppression # WD edit
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
#Warden's Hardsuit
|
||||
- type: entity
|
||||
@@ -241,7 +241,7 @@
|
||||
Piercing: 0.9
|
||||
Heat: 0.9
|
||||
- type: FlashImmunity # WD edit
|
||||
- type: FlashSoundSuppression # WD edit
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
#Captain's Hardsuit
|
||||
- type: entity
|
||||
@@ -259,7 +259,7 @@
|
||||
highPressureMultiplier: 0.3
|
||||
lowPressureMultiplier: 1000
|
||||
- type: FlashImmunity # WD edit
|
||||
- type: FlashSoundSuppression # WD edit
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
#Inspector's Hardsuit
|
||||
- type: entity
|
||||
@@ -423,6 +423,7 @@
|
||||
Heat: 0.9
|
||||
- type: EyeProtection # WD edit
|
||||
- type: FlashImmunity # WD
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
#Blood-red Medic Hardsuit
|
||||
- type: entity
|
||||
@@ -450,6 +451,7 @@
|
||||
Heat: 0.9
|
||||
- type: EyeProtection # WD edit
|
||||
- type: FlashImmunity # WD
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
#Syndicate Elite Hardsuit
|
||||
- type: entity
|
||||
@@ -479,6 +481,7 @@
|
||||
Heat: 0.9
|
||||
- type: EyeProtection # WD edit
|
||||
- type: FlashImmunity # WD
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
#Syndicate Commander Hardsuit
|
||||
- type: entity
|
||||
@@ -506,6 +509,7 @@
|
||||
Heat: 0.9
|
||||
- type: EyeProtection # WD edit
|
||||
- type: FlashImmunity # WD
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
#Cybersun Juggernaut Hardsuit
|
||||
- type: entity
|
||||
@@ -531,6 +535,7 @@
|
||||
Heat: 0.9
|
||||
- type: EyeProtection # WD edit
|
||||
- type: FlashImmunity # WD
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
#Wizard Hardsuit
|
||||
- type: entity
|
||||
@@ -557,6 +562,9 @@
|
||||
Piercing: 0.9
|
||||
Heat: 0.9
|
||||
- type: WizardClothes
|
||||
- type: EyeProtection
|
||||
- type: FlashImmunity
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
#Organic Space Suit
|
||||
- type: entity
|
||||
@@ -632,6 +640,7 @@
|
||||
Heat: 0.9
|
||||
- type: EyeProtection # WD edit
|
||||
- type: FlashImmunity # WD
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
#ERT Chaplain Hardsuit
|
||||
- type: entity
|
||||
@@ -672,6 +681,7 @@
|
||||
- type: EyeProtection # WD edit
|
||||
- type: FlashImmunity # WD
|
||||
|
||||
- type: FlashSoundSuppression
|
||||
#ERT Medical Hardsuit
|
||||
- type: entity
|
||||
parent: ClothingHeadHelmetHardsuitSyndieElite
|
||||
@@ -688,6 +698,7 @@
|
||||
color: "#adffec"
|
||||
- type: EyeProtection # WD edit
|
||||
- type: FlashImmunity # WD
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
#ERT Security Hardsuit
|
||||
- type: entity
|
||||
@@ -712,6 +723,7 @@
|
||||
Heat: 0.9
|
||||
- type: EyeProtection # WD edit
|
||||
- type: FlashImmunity # WD
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
#ERT Janitor Hardsuit
|
||||
- type: entity
|
||||
@@ -729,6 +741,7 @@
|
||||
color: "#cbadff"
|
||||
- type: EyeProtection # WD edit
|
||||
- type: FlashImmunity # WD
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
#CBURN Hardsuit
|
||||
- type: entity
|
||||
@@ -770,6 +783,7 @@
|
||||
Heat: 0.9
|
||||
- type: EyeProtection # WD edit
|
||||
- type: FlashImmunity # WD
|
||||
- type: FlashSoundSuppression
|
||||
|
||||
#Deathsquad Hardsuit
|
||||
- type: entity
|
||||
@@ -797,6 +811,8 @@
|
||||
Caustic: 0.95
|
||||
- type: EyeProtection # WD edit
|
||||
- type: FlashImmunity # WD
|
||||
- type: FlashSoundSuppression
|
||||
maxRange: 0
|
||||
- type: ShowHealthBars
|
||||
damageContainers:
|
||||
- Biological
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
- type: DeleteOnChangelingRefund
|
||||
- type: FlashImmunity
|
||||
- type: EyeProtection
|
||||
- type: FlashSoundSuppression
|
||||
- type: HiveHead
|
||||
|
||||
- type: entity
|
||||
|
||||
Reference in New Issue
Block a user