Knockdown (#535)
* - add: Better knockdown. * - add: Some stuff. * - add: Ghetto alert.
This commit is contained in:
@@ -153,7 +153,7 @@ namespace Content.Server.Explosion.EntitySystems
|
|||||||
private void HandleFlashTrigger(EntityUid uid, FlashOnTriggerComponent component, TriggerEvent args)
|
private void HandleFlashTrigger(EntityUid uid, FlashOnTriggerComponent component, TriggerEvent args)
|
||||||
{
|
{
|
||||||
// TODO Make flash durations sane ffs.
|
// TODO Make flash durations sane ffs.
|
||||||
_flashSystem.FlashArea(uid, args.User, component.Range, component.Duration * 1000f, probability: component.Probability, forceStun: component.ForceStun); // WD edit
|
_flashSystem.FlashArea(uid, args.User, component.Range, component.Duration * 1000f, probability: component.Probability, stunTime: component.StunTime, knockdownTime: component.KnockdownTime); // WD edit
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ namespace Content.Server.Flash
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WD edit
|
// WD edit
|
||||||
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 forceStun = false)
|
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, float stunTime = 0f, float knockdownTime = 0f)
|
||||||
{
|
{
|
||||||
var transform = Transform(source);
|
var transform = Transform(source);
|
||||||
var mapPosition = _transform.GetMapCoordinates(transform);
|
var mapPosition = _transform.GetMapCoordinates(transform);
|
||||||
@@ -202,8 +202,8 @@ namespace Content.Server.Flash
|
|||||||
|
|
||||||
var distance = (mapPosition.Position - _transform.GetMapCoordinates(entity).Position).Length();
|
var distance = (mapPosition.Position - _transform.GetMapCoordinates(entity).Position).Length();
|
||||||
|
|
||||||
if (forceStun) // WD
|
if (stunTime > 0f || knockdownTime > 0f) // WD
|
||||||
_flashSoundSuppressionSystem.Stun(entity, duration, distance, range);
|
_flashSoundSuppressionSystem.Stun(entity, stunTime, knockdownTime, distance, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
_audio.PlayPvs(sound, source, AudioParams.Default.WithVolume(1f).WithMaxDistance(3f));
|
_audio.PlayPvs(sound, source, AudioParams.Default.WithVolume(1f).WithMaxDistance(3f));
|
||||||
|
|||||||
@@ -38,8 +38,9 @@ namespace Content.Shared.Alert
|
|||||||
VeryGood,
|
VeryGood,
|
||||||
VeryVeryGood,
|
VeryVeryGood,
|
||||||
MoodDead,
|
MoodDead,
|
||||||
//WD end
|
|
||||||
CultBuffed,
|
CultBuffed,
|
||||||
|
Knockdown,
|
||||||
|
//WD end
|
||||||
PilotingShuttle,
|
PilotingShuttle,
|
||||||
Peckish,
|
Peckish,
|
||||||
Starving,
|
Starving,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Shared.Humanoid;
|
|||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using Content.Shared.Projectiles;
|
using Content.Shared.Projectiles;
|
||||||
|
using Content.Shared.Standing;
|
||||||
using Content.Shared.Standing.Systems;
|
using Content.Shared.Standing.Systems;
|
||||||
using Content.Shared.Stunnable;
|
using Content.Shared.Stunnable;
|
||||||
using Content.Shared.Throwing;
|
using Content.Shared.Throwing;
|
||||||
@@ -30,6 +31,7 @@ public abstract class SharedTentacleGun : EntitySystem
|
|||||||
[Dependency] private readonly ITimerManager _timerManager = default!;
|
[Dependency] private readonly ITimerManager _timerManager = default!;
|
||||||
[Dependency] private readonly SharedStandingStateSystem _standing = default!;
|
[Dependency] private readonly SharedStandingStateSystem _standing = default!;
|
||||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||||
|
[Dependency] private readonly SharedStunSystem _stun = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -111,7 +113,7 @@ public abstract class SharedTentacleGun : EntitySystem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HasComp<HumanoidAppearanceComponent>(args.Embedded))
|
if (!TryComp<StandingStateComponent>(args.Embedded, out var standing) || !standing.CanLieDown)
|
||||||
{
|
{
|
||||||
DeleteProjectile(uid);
|
DeleteProjectile(uid);
|
||||||
return;
|
return;
|
||||||
@@ -156,6 +158,7 @@ public abstract class SharedTentacleGun : EntitySystem
|
|||||||
private bool PullMob(ProjectileEmbedEvent args)
|
private bool PullMob(ProjectileEmbedEvent args)
|
||||||
{
|
{
|
||||||
_standing.TryLieDown(args.Embedded);
|
_standing.TryLieDown(args.Embedded);
|
||||||
|
_stun.TryKnockdown(args.Embedded, TimeSpan.FromSeconds(4), true);
|
||||||
|
|
||||||
_throwingSystem.TryThrow(args.Embedded, Transform(args.Shooter!.Value).Coordinates, 5f);
|
_throwingSystem.TryThrow(args.Embedded, Transform(args.Shooter!.Value).Coordinates, 5f);
|
||||||
|
|
||||||
|
|||||||
@@ -10,5 +10,6 @@ public sealed partial class FlashOnTriggerComponent : Component
|
|||||||
[DataField] public float Range = 1.0f;
|
[DataField] public float Range = 1.0f;
|
||||||
[DataField] public float Duration = 8.0f;
|
[DataField] public float Duration = 8.0f;
|
||||||
[DataField] public float Probability = 1.0f;
|
[DataField] public float Probability = 1.0f;
|
||||||
[DataField] public bool ForceStun; // WD
|
[DataField] public float StunTime; // WD
|
||||||
|
[DataField] public float KnockdownTime; // WD
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Content.Shared._White.Wizard.Timestop;
|
|||||||
using Content.Shared.Buckle;
|
using Content.Shared.Buckle;
|
||||||
using Content.Shared.Buckle.Components;
|
using Content.Shared.Buckle.Components;
|
||||||
using Content.Shared.Mobs;
|
using Content.Shared.Mobs;
|
||||||
|
using Content.Shared.Movement.Events;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Input.Binding;
|
using Robust.Shared.Input.Binding;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
@@ -52,6 +53,7 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
|||||||
|
|
||||||
SubscribeLocalEvent<StandingStateComponent, StandingUpDoAfterEvent>(OnStandingUpDoAfter);
|
SubscribeLocalEvent<StandingStateComponent, StandingUpDoAfterEvent>(OnStandingUpDoAfter);
|
||||||
SubscribeLocalEvent<StandingStateComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovementSpeed);
|
SubscribeLocalEvent<StandingStateComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovementSpeed);
|
||||||
|
SubscribeLocalEvent<StandingStateComponent, TileFrictionEvent>(OnTileFriction);
|
||||||
SubscribeLocalEvent<StandingStateComponent, SlipAttemptEvent>(OnSlipAttempt);
|
SubscribeLocalEvent<StandingStateComponent, SlipAttemptEvent>(OnSlipAttempt);
|
||||||
|
|
||||||
InitializeColliding();
|
InitializeColliding();
|
||||||
@@ -98,12 +100,9 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnStandingUpDoAfter(EntityUid uid, StandingStateComponent component, StandingUpDoAfterEvent args)
|
private void OnStandingUpDoAfter(EntityUid uid, StandingStateComponent component, StandingUpDoAfterEvent args)
|
||||||
{
|
{
|
||||||
if (args.Handled || _stun.IsParalyzed(uid)) // WD EDIT
|
if (args.Handled || args.Cancelled || HasComp<KnockedDownComponent>(uid) ||
|
||||||
{
|
_mobState.IsIncapacitated(uid) || !Stand(uid)) // WD EDIT
|
||||||
component.CurrentState = StandingState.Lying;
|
component.CurrentState = StandingState.Lying;
|
||||||
return;
|
|
||||||
}
|
|
||||||
Stand(uid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRefreshMovementSpeed(EntityUid uid, StandingStateComponent component,
|
private void OnRefreshMovementSpeed(EntityUid uid, StandingStateComponent component,
|
||||||
@@ -115,6 +114,12 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
|||||||
args.ModifySpeed(1f, 1f);
|
args.ModifySpeed(1f, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnTileFriction(Entity<StandingStateComponent> ent, ref TileFrictionEvent args)
|
||||||
|
{
|
||||||
|
if (IsDown(ent))
|
||||||
|
args.Modifier *= SharedStunSystem.KnockDownModifier;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnSlipAttempt(EntityUid uid, StandingStateComponent component, SlipAttemptEvent args)
|
private void OnSlipAttempt(EntityUid uid, StandingStateComponent component, SlipAttemptEvent args)
|
||||||
{
|
{
|
||||||
if (IsDown(uid))
|
if (IsDown(uid))
|
||||||
@@ -217,6 +222,9 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
|||||||
if (TryComp(uid, out BuckleComponent? buckle) && buckle.Buckled && !_buckle.TryUnbuckle(uid, uid, buckleComp: buckle)) // WD EDIT
|
if (TryComp(uid, out BuckleComponent? buckle) && buckle.Buckled && !_buckle.TryUnbuckle(uid, uid, buckleComp: buckle)) // WD EDIT
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (standingState.CurrentState is StandingState.Lying or StandingState.GettingUp)
|
||||||
|
return true;
|
||||||
|
|
||||||
// This is just to avoid most callers doing this manually saving boilerplate
|
// This is just to avoid most callers doing this manually saving boilerplate
|
||||||
// 99% of the time you'll want to drop items but in some scenarios (e.g. buckling) you don't want to.
|
// 99% of the time you'll want to drop items but in some scenarios (e.g. buckling) you don't want to.
|
||||||
// We do this BEFORE downing because something like buckle may be blocking downing but we want to drop hand items anyway
|
// We do this BEFORE downing because something like buckle may be blocking downing but we want to drop hand items anyway
|
||||||
@@ -226,9 +234,6 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
|||||||
RaiseLocalEvent(uid, new DropHandItemsEvent());
|
RaiseLocalEvent(uid, new DropHandItemsEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (standingState.CurrentState is StandingState.Lying or StandingState.GettingUp)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
var msg = new DownAttemptEvent();
|
var msg = new DownAttemptEvent();
|
||||||
RaiseLocalEvent(uid, msg);
|
RaiseLocalEvent(uid, msg);
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public abstract class SharedStunSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<KnockedDownComponent, InteractHandEvent>(OnInteractHand);
|
SubscribeLocalEvent<KnockedDownComponent, InteractHandEvent>(OnInteractHand);
|
||||||
SubscribeLocalEvent<SlowedDownComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
|
SubscribeLocalEvent<SlowedDownComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
|
||||||
|
|
||||||
SubscribeLocalEvent<KnockedDownComponent, TileFrictionEvent>(OnKnockedTileFriction);
|
//SubscribeLocalEvent<KnockedDownComponent, TileFrictionEvent>(OnKnockedTileFriction);
|
||||||
|
|
||||||
// Attempt event subscriptions.
|
// Attempt event subscriptions.
|
||||||
SubscribeLocalEvent<StunnedComponent, ChangeDirectionAttemptEvent>(OnAttempt);
|
SubscribeLocalEvent<StunnedComponent, ChangeDirectionAttemptEvent>(OnAttempt);
|
||||||
@@ -260,10 +260,10 @@ public abstract class SharedStunSystem : EntitySystem
|
|||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnKnockedTileFriction(EntityUid uid, KnockedDownComponent component, ref TileFrictionEvent args)
|
/*private void OnKnockedTileFriction(EntityUid uid, KnockedDownComponent component, ref TileFrictionEvent args)
|
||||||
{
|
{
|
||||||
args.Modifier *= KnockDownModifier;
|
args.Modifier *= KnockDownModifier;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
//WD EDIT START
|
//WD EDIT START
|
||||||
public bool IsParalyzed(EntityUid uid)
|
public bool IsParalyzed(EntityUid uid)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public sealed class FlashSoundSuppressionSystem : EntitySystem
|
|||||||
args.Args.MaxRange = MathF.Min(args.Args.MaxRange, ent.Comp.MaxRange);
|
args.Args.MaxRange = MathF.Min(args.Args.MaxRange, ent.Comp.MaxRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stun(EntityUid target, float duration, float distance, float range)
|
public void Stun(EntityUid target, float stunDuration, float knockdownDuration, float distance, float range)
|
||||||
{
|
{
|
||||||
if (TryComp<FlashSoundSuppressionComponent>(target, out var suppression))
|
if (TryComp<FlashSoundSuppressionComponent>(target, out var suppression))
|
||||||
range = MathF.Min(range, suppression.MaxRange);
|
range = MathF.Min(range, suppression.MaxRange);
|
||||||
@@ -38,11 +38,13 @@ public sealed class FlashSoundSuppressionSystem : EntitySystem
|
|||||||
if (distance > range)
|
if (distance > range)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var stunTime = float.Lerp(duration, 0f, distance / range);
|
var knockdownTime = float.Lerp(knockdownDuration, 0f, distance / range);
|
||||||
if (stunTime <= 0f)
|
if (knockdownTime > 0f)
|
||||||
return;
|
_stunSystem.TryKnockdown(target, TimeSpan.FromSeconds(knockdownTime), true);
|
||||||
|
|
||||||
_stunSystem.TryParalyze(target, TimeSpan.FromSeconds(stunTime / 1000f), true);
|
var stunTime = float.Lerp(stunDuration, 0f, distance / range);
|
||||||
|
if (stunTime > 0f)
|
||||||
|
_stunSystem.TryStun(target, TimeSpan.FromSeconds(stunTime), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,3 +14,6 @@ action-name-insert-other = Засунуть внутрь.
|
|||||||
action-start-insert-self = Вы начинаете залазить в {$storage}.
|
action-start-insert-self = Вы начинаете залазить в {$storage}.
|
||||||
action-start-insert-other = {$user} начинает засовывать вас в {$storage}.
|
action-start-insert-other = {$user} начинает засовывать вас в {$storage}.
|
||||||
carry-start = { $carrier } пытается взять вас на руки!
|
carry-start = { $carrier } пытается взять вас на руки!
|
||||||
|
|
||||||
|
alerts-knockdown-name = Лежу
|
||||||
|
alerts-knockdown-desc = Не могу встать.
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
- category: Piloting
|
- category: Piloting
|
||||||
- alertType: Corporeal
|
- alertType: Corporeal
|
||||||
- alertType: Stun
|
- alertType: Stun
|
||||||
|
- alertType: Knockdown
|
||||||
- category: Breathing # Vox gang not calling this oxygen
|
- category: Breathing # Vox gang not calling this oxygen
|
||||||
- category: Pressure
|
- category: Pressure
|
||||||
- alertType: Bleed
|
- alertType: Bleed
|
||||||
@@ -479,12 +480,20 @@
|
|||||||
name: Debug6
|
name: Debug6
|
||||||
description: Debug
|
description: Debug
|
||||||
|
|
||||||
|
# WD-EDIT
|
||||||
- type: alert
|
- type: alert
|
||||||
id: CultBuffed
|
id: CultBuffed
|
||||||
icons: [ /Textures/Interface/Alerts/buff.png ]
|
icons: [ /Textures/Interface/Alerts/buff.png ]
|
||||||
name: alerts-cult-buff-name
|
name: alerts-cult-buff-name
|
||||||
description: alerts-cult-buff-desc
|
description: alerts-cult-buff-desc
|
||||||
|
|
||||||
|
# WD-EDIT
|
||||||
|
- type: alert
|
||||||
|
id: Knockdown
|
||||||
|
icons: [ /Textures/White/Interface/Alerts/knockdown.png ]
|
||||||
|
name: alerts-knockdown-name
|
||||||
|
description: alerts-knockdown-desc
|
||||||
|
|
||||||
# WD-EDIT
|
# WD-EDIT
|
||||||
- type: alert
|
- type: alert
|
||||||
id: Bleeding
|
id: Bleeding
|
||||||
|
|||||||
@@ -756,7 +756,8 @@
|
|||||||
- state: grenade
|
- state: grenade
|
||||||
- type: FlashOnTrigger
|
- type: FlashOnTrigger
|
||||||
range: 7
|
range: 7
|
||||||
forceStun: true # WD EDIT
|
stunTime: 2 # WD
|
||||||
|
knockdownTime: 20 # WD
|
||||||
- type: SpawnOnTrigger
|
- type: SpawnOnTrigger
|
||||||
proto: GrenadeFlashEffect
|
proto: GrenadeFlashEffect
|
||||||
- type: ActiveTimerTrigger
|
- type: ActiveTimerTrigger
|
||||||
|
|||||||
@@ -67,7 +67,8 @@
|
|||||||
sprite: Objects/Weapons/Grenades/flashbang.rsi
|
sprite: Objects/Weapons/Grenades/flashbang.rsi
|
||||||
- type: FlashOnTrigger
|
- type: FlashOnTrigger
|
||||||
range: 7
|
range: 7
|
||||||
forceStun: true # WD
|
stunTime: 2 # WD
|
||||||
|
knockdownTime: 20 # WD
|
||||||
- type: SoundOnTrigger
|
- type: SoundOnTrigger
|
||||||
sound:
|
sound:
|
||||||
path: "/Audio/Effects/flash_bang.ogg"
|
path: "/Audio/Effects/flash_bang.ogg"
|
||||||
|
|||||||
@@ -40,7 +40,8 @@
|
|||||||
- state: grenade
|
- state: grenade
|
||||||
- type: FlashOnTrigger
|
- type: FlashOnTrigger
|
||||||
range: 5
|
range: 5
|
||||||
forceStun: true
|
stunTime: 2 # WD
|
||||||
|
knockdownTime: 20 # WD
|
||||||
- type: SpawnOnTrigger
|
- type: SpawnOnTrigger
|
||||||
proto: GrenadeFlashEffect
|
proto: GrenadeFlashEffect
|
||||||
- type: DeleteOnTrigger
|
- type: DeleteOnTrigger
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
- type: statusEffect
|
- type: statusEffect
|
||||||
id: KnockedDown
|
id: KnockedDown
|
||||||
alert: Stun
|
alert: Knockdown
|
||||||
|
|
||||||
- type: statusEffect
|
- type: statusEffect
|
||||||
id: SlowedDown
|
id: SlowedDown
|
||||||
|
|||||||
BIN
Resources/Textures/White/Interface/Alerts/knockdown.png
Normal file
BIN
Resources/Textures/White/Interface/Alerts/knockdown.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 409 B |
Reference in New Issue
Block a user