Better melee combat (#542)
* - add: NextMobAttack, EquipCooldown. * - fix: Some combat fixes. * - add: Telebaton. * - add: Stun baton rework. * - tweak: Reduce melee range. * - add: Rework melee block system. * - add: ExaminedEvent.
This commit is contained in:
@@ -31,7 +31,7 @@ public sealed class ReturnItemOnThrowSystem : EntitySystem
|
||||
if (!HasComp<MobStateComponent>(args.Target))
|
||||
return;
|
||||
|
||||
if (!_stun.IsParalyzed(args.Target) && !isCultist && !_holyWeapon.IsHoldingHolyWeapon(args.Target))
|
||||
if (!isCultist && !_holyWeapon.IsHoldingHolyWeapon(args.Target))
|
||||
{
|
||||
_stun.TryParalyze(args.Target, TimeSpan.FromSeconds(component.StunTime), true);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using Content.Shared._White.Blocking;
|
||||
using Content.Shared._White.Cult.Components;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Mind.Components;
|
||||
@@ -22,7 +23,7 @@ public partial class CultSystem
|
||||
SubscribeLocalEvent<ConstructShellComponent, ComponentInit>(OnShellInit);
|
||||
SubscribeLocalEvent<ConstructShellComponent, ComponentRemove>(OnShellRemove);
|
||||
SubscribeLocalEvent<ConstructShellComponent, ConstructFormSelectedEvent>(OnShellSelected);
|
||||
SubscribeLocalEvent<ConstructComponent, MeleeHitEvent>(OnMeleeHit);
|
||||
SubscribeLocalEvent<ConstructComponent, MeleeHitEvent>(OnMeleeHit, before: new []{typeof(MeleeBlockSystem)});
|
||||
}
|
||||
|
||||
private void OnMeleeHit(Entity<ConstructComponent> ent, ref MeleeHitEvent args)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared._White.Blocking;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.Examine;
|
||||
@@ -25,7 +26,7 @@ public sealed class CritSystem : EntitySystem
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CritComponent, ExaminedEvent>(OnExamine);
|
||||
SubscribeLocalEvent<CritComponent, MeleeHitEvent>(HandleHit);
|
||||
SubscribeLocalEvent<CritComponent, MeleeHitEvent>(HandleHit, before: new [] {typeof(MeleeBlockSystem)});
|
||||
SubscribeLocalEvent<CritComponent, GetMeleeAttackRateEvent>(GetMeleeAttackRate);
|
||||
SubscribeLocalEvent<BloodLustComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMoveSpeed);
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace Content.Server._White.Other.MeleeBlockSystem;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class MeleeBlockComponent : Component
|
||||
{
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public float BlockChance = 0.4f;
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server._White.Other.MeleeBlockSystem;
|
||||
|
||||
public sealed class MeleeBlockSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<HandsComponent, MeleeBlockAttemptEvent>(OnBlockAttempt);
|
||||
}
|
||||
|
||||
private void OnBlockAttempt(Entity<HandsComponent> ent, ref MeleeBlockAttemptEvent args)
|
||||
{
|
||||
if (ent.Owner == args.Attacker ||
|
||||
!TryComp(ent.Comp.ActiveHandEntity, out MeleeBlockComponent? blockComponent) ||
|
||||
!_random.Prob(blockComponent.BlockChance))
|
||||
return;
|
||||
|
||||
args.Blocked = true;
|
||||
|
||||
_popupSystem.PopupEntity("заблокировал!", ent);
|
||||
|
||||
_audio.PlayPvs(new SoundPathSpecifier("/Audio/Weapons/block_metal1.ogg"), ent,
|
||||
AudioParams.Default.WithVariation(0.25f));
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared._White.Blocking;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
@@ -15,7 +16,7 @@ public sealed class RandomDamageSystem : EntitySystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<RandomDamageComponent, MeleeHitEvent>(HandleHit);
|
||||
SubscribeLocalEvent<RandomDamageComponent, MeleeHitEvent>(HandleHit, before: new [] {typeof(MeleeBlockSystem)});
|
||||
}
|
||||
|
||||
private void HandleHit(Entity<RandomDamageComponent> ent, ref MeleeHitEvent args)
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Content.Server._White.Stunprod;
|
||||
public sealed partial class StunprodComponent : Component
|
||||
{
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public float EnergyPerUse { get; set; } = 72;
|
||||
public float EnergyPerUse { get; set; } = 144;
|
||||
|
||||
[DataField]
|
||||
public bool HasHeldPrefix = true;
|
||||
|
||||
Reference in New Issue
Block a user