Удар по яйцам

This commit is contained in:
BIGZi0348
2025-01-05 21:12:53 +03:00
parent a43a78b9da
commit 1229e3e97e
5 changed files with 141 additions and 9 deletions

View File

@@ -0,0 +1,22 @@
using Content.Shared.Standing.Systems;
namespace Content.Server._White._Engi.DirectBallsHit;
[RegisterComponent]
public sealed partial class DirectBallsHitComponent : Component
{
[DataField]
public TimeSpan KnockdownTime = TimeSpan.FromSeconds(2.0f);
[DataField]
public TimeSpan JitterTime = TimeSpan.FromSeconds(2.0f);
[DataField]
public TimeSpan StutterTime = TimeSpan.FromSeconds(2.0f);
[DataField]
public SharedStandingStateSystem.DropHeldItemsBehavior KnockDownBehavior = SharedStandingStateSystem.DropHeldItemsBehavior.AlwaysDrop;
[DataField]
public bool RequireWield = true;
}

View File

@@ -0,0 +1,68 @@
using Content.Shared.Stunnable;
using Content.Shared.Weapons.Melee.Events;
using Content.Shared.Wieldable.Components;
using Content.Shared.Jittering;
using Content.Shared.Speech.EntitySystems;
using Content.Shared.StatusEffect;
using Content.Shared.Standing;
using Content.Shared.Electrocution;
using Content.Shared.Popups;
using Content.Shared._White.Implants.NeuroControl;
using Robust.Shared.Timing;
using Content.Server.Chat.Systems;
namespace Content.Server._White._Engi.DirectBallsHit;
public sealed class DirectBallsHitSystem : EntitySystem
{
[Dependency] private readonly SharedStunSystem _stun = default!;
[Dependency] private readonly SharedJitteringSystem _jitter = default!;
[Dependency] private readonly SharedStutteringSystem _stutter = default!;
[Dependency] private readonly SharedElectrocutionSystem _electrocution = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly ChatSystem _chat = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<DirectBallsHitComponent, MeleeHitEvent>(OnHit);
}
private void OnHit(Entity<DirectBallsHitComponent> ent, ref MeleeHitEvent args)
{
if (ent.Comp.RequireWield)
{
if (!TryComp<WieldableComponent>(args.Weapon, out var weapon))
return;
if (!weapon.Wielded)
return;
}
foreach (var uid in args.HitEntities)
{
_popupSystem.PopupEntity(
Loc.GetString("direct-balls-hit", ("uid", uid)),
uid,
PopupType.SmallCaution);
Timer.Spawn(TimeSpan.FromSeconds(0.5f), () => _chat.TryEmoteWithChat(uid, "Scream"));
if (HasComp<NeuroStabilizationComponent>(uid))
{
_electrocution.TryDoElectrocution(uid, null, 30, TimeSpan.FromSeconds(1), false, 0.5f, null, true);
continue;
}
if (TryComp(uid, out StandingStateComponent? standingState) && standingState.CanLieDown)
_stun.TryKnockdown(uid, ent.Comp.KnockdownTime, true, behavior: ent.Comp.KnockDownBehavior);
if (TryComp(uid, out StatusEffectsComponent? statusEffects))
{
_jitter.DoJitter(uid, ent.Comp.JitterTime, true, status: statusEffects);
_stutter.DoStutter(uid, ent.Comp.StutterTime, true, statusEffects);
}
}
}
}

View File

@@ -26,17 +26,17 @@ public sealed class KnockDownOnHitSystem : EntitySystem
if (time <= TimeSpan.Zero)
return;
if (ent.Comp.RequireWield)
{
if (!TryComp<WieldableComponent>(args.Weapon, out var weapon))
return;
if (!weapon.Wielded)
return;
}
foreach (var uid in args.HitEntities)
{
if (ent.Comp.RequireWield)
{
if (!TryComp<WieldableComponent>(args.Weapon, out var weapon))
continue;
if (!weapon.Wielded)
continue;
}
_stun.TryKnockdown(uid, time, true, behavior: ent.Comp.KnockDownBehavior);
}
}

View File

@@ -0,0 +1 @@
direct-balls-hit = { CAPITALIZE($uid) } получает точный удар в пах!

View File

@@ -0,0 +1,41 @@
- type: entity
parent: BaseItem
id: OldCane
name: трость старика
description: Изношенная деревянная трость.
components:
- type: Sprite
sprite: Objects/Weapons/Melee/cane.rsi
state: cane
- type: Item
size: Normal
storedRotation: -44
shape:
- 0,0,0,2
sprite: Objects/Weapons/Melee/cane.rsi
- type: Appearance
- type: MeleeWeapon
wideAnimationRotation: 45
damage:
types:
Blunt: 5
- type: StaminaDamageOnHit
damage: 25
- type: Wieldable
- type: IncreaseDamageOnWield
damage:
types:
Blunt: 5
- type: DirectBallsHit
- type: MeleeThrowOnHit
lifetime: 0.1
speed: 3
requireWield: true
- type: UseDelay
delay: 1
- type: Prying
- type: Tool
qualities:
- Prying
useSound:
path: /Audio/Items/crowbar.ogg