Skip to content

Commit

Permalink
Flash grenade stun (#1530)
Browse files Browse the repository at this point in the history
* add stun

* payload

* autoformat

* ...
  • Loading branch information
MiraHell authored Aug 6, 2024
1 parent 607d557 commit fe844c6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Content.Server/Explosion/EntitySystems/TriggerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private void HandleExplodeTrigger(EntityUid uid, ExplodeOnTriggerComponent compo
private void HandleFlashTrigger(EntityUid uid, FlashOnTriggerComponent component, TriggerEvent args)
{
// TODO Make flash durations sane ffs.
_flashSystem.FlashArea(uid, args.User, component.Range, component.Duration * 1000f, probability: component.Probability);
_flashSystem.FlashArea(uid, args.User, component.Range, component.Duration * 1000f, probability: component.Probability, stun: component.Stun, stunDuration: component.StunDuration); // 220 flash grenade stun
args.Handled = true;
}

Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Flash/FlashSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void Flash(EntityUid target,
}
}

public void FlashArea(Entity<FlashComponent?> source, EntityUid? user, float range, float duration, float slowTo = 0.8f, bool displayPopup = false, float probability = 1f, SoundSpecifier? sound = null)
public void FlashArea(Entity<FlashComponent?> source, EntityUid? user, float range, float duration, float slowTo = 0.8f, bool displayPopup = false, float probability = 1f, SoundSpecifier? sound = null, bool stun = false, float stunDuration = 1f) // 220 flash grenade stun
{
var transform = Transform(source);
var mapPosition = _transform.GetMapCoordinates(transform);
Expand All @@ -174,7 +174,7 @@ public void FlashArea(Entity<FlashComponent?> source, EntityUid? user, float ran
continue;

// They shouldn't have flash removed in between right?
Flash(entity, user, source, duration, slowTo, displayPopup);
Flash(entity, user, source, duration, slowTo, displayPopup, melee: stun, stunDuration: TimeSpan.FromSeconds(stunDuration)); // 220 flash grenade stun
}

_audio.PlayPvs(sound, source, AudioParams.Default.WithVolume(1f).WithMaxDistance(3f));
Expand Down
4 changes: 4 additions & 0 deletions Content.Shared/Flash/Components/FlashOnTriggerComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ public sealed partial class FlashOnTriggerComponent : Component
[DataField] public float Range = 1.0f;
[DataField] public float Duration = 8.0f;
[DataField] public float Probability = 1.0f;
// start 220 flash grenade stun
[DataField] public bool Stun = false;
[DataField] public float StunDuration = 3.0f;
// end 220 flash grenade stun
}
1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Objects/Devices/payload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
- type: DeleteOnTrigger
- type: FlashOnTrigger
range: 6
stun: true # 220 flash grenade stun
- type: EmitSoundOnTrigger
sound:
path: "/Audio/Effects/flash_bang.ogg"
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
sprite: Objects/Weapons/Grenades/flashbang.rsi
- type: FlashOnTrigger
range: 7
stun: true # 220 flash grenade stun
- type: SoundOnTrigger
sound:
path: "/Audio/Effects/flash_bang.ogg"
Expand Down Expand Up @@ -386,7 +387,7 @@
- Scientist
- Borg
# Corvax-HiddenDesc-End

- type: entity
parent: GrenadeBase
id: SmokeGrenade
Expand Down

0 comments on commit fe844c6

Please sign in to comment.