Crawling Fixes 1: Dragons and Borgs can't do the worm. (#39084)
* Init Commit * Remove unused code, fix stun visuals bug * Update Content.Shared/Stunnable/SharedStunSystem.cs * Some initial changes * first batch of changes * Commit * One line cleanup * KnockdownStatusEffect ain't worth it. * Fix 2 bugs * Fixes * Remove that actually, * Commit * Better solution * Alright final commit I think * Add better remarks * How the fuck did this not get pushed??? * Wait no why was my ryder trying to push that??? I didn't make that change! DON'T DO THAT!!! * Review * Don't log that --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
4e29107c89
commit
55335cce0f
@@ -249,7 +249,7 @@ public sealed partial class ShuttleSystem
|
||||
|
||||
if (direction.LengthSquared() > minsq)
|
||||
{
|
||||
_stuns.TryUpdateKnockdownDuration(uid, knockdownTime);
|
||||
_stuns.TryCrawling(uid, knockdownTime);
|
||||
_throwing.TryThrow(uid, direction, physics, Transform(uid), _projQuery, direction.Length(), playSound: false);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,58 +1,66 @@
|
||||
namespace Content.Server.Stunnable.Components
|
||||
using Content.Server.Stunnable.Systems;
|
||||
|
||||
namespace Content.Server.Stunnable.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Adds stun when it collides with an entity
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(StunOnCollideSystem))]
|
||||
public sealed partial class StunOnCollideComponent : Component
|
||||
{
|
||||
// TODO: Can probably predict this.
|
||||
|
||||
/// <summary>
|
||||
/// Adds stun when it collides with an entity
|
||||
/// How long we are stunned for
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(StunOnCollideSystem))]
|
||||
public sealed partial class StunOnCollideComponent : Component
|
||||
{
|
||||
// TODO: Can probably predict this.
|
||||
[DataField]
|
||||
public TimeSpan StunAmount;
|
||||
|
||||
/// <summary>
|
||||
/// How long we are stunned for
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public TimeSpan StunAmount;
|
||||
/// <summary>
|
||||
/// How long we are knocked down for
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public TimeSpan KnockdownAmount;
|
||||
|
||||
/// <summary>
|
||||
/// How long we are knocked down for
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public TimeSpan KnockdownAmount;
|
||||
/// <summary>
|
||||
/// How long we are slowed down for
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public TimeSpan SlowdownAmount;
|
||||
|
||||
/// <summary>
|
||||
/// How long we are slowed down for
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public TimeSpan SlowdownAmount;
|
||||
/// <summary>
|
||||
/// Multiplier for a mob's walking speed
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float WalkSpeedModifier = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Multiplier for a mob's walking speed
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float WalkSpeedModifier = 1f;
|
||||
/// <summary>
|
||||
/// Multiplier for a mob's sprinting speed
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float SprintSpeedModifier = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Multiplier for a mob's sprinting speed
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float SprintSpeedModifier = 1f;
|
||||
/// <summary>
|
||||
/// Refresh Stun or Slowdown on hit
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool Refresh = true;
|
||||
|
||||
/// <summary>
|
||||
/// Refresh Stun or Slowdown on hit
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool Refresh = true;
|
||||
/// <summary>
|
||||
/// Should the entity try and stand automatically after being knocked down?
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool AutoStand = true;
|
||||
|
||||
/// <summary>
|
||||
/// Should the entity try and stand automatically after being knocked down?
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool AutoStand = true;
|
||||
/// <summary>
|
||||
/// Should the entity drop their items upon first being knocked down?
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool Drop = true;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture we track for the collision.
|
||||
/// </summary>
|
||||
[DataField("fixture")] public string FixtureID = "projectile";
|
||||
}
|
||||
/// <summary>
|
||||
/// Fixture we track for the collision.
|
||||
/// </summary>
|
||||
[DataField("fixture")] public string FixtureID = "projectile";
|
||||
}
|
||||
|
||||
|
||||
@@ -4,47 +4,60 @@ using JetBrains.Annotations;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Shared.Physics.Events;
|
||||
|
||||
namespace Content.Server.Stunnable
|
||||
namespace Content.Server.Stunnable.Systems;
|
||||
|
||||
[UsedImplicitly]
|
||||
internal sealed class StunOnCollideSystem : EntitySystem
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class StunOnCollideSystem : EntitySystem
|
||||
[Dependency] private readonly StunSystem _stunSystem = default!;
|
||||
[Dependency] private readonly MovementModStatusSystem _movementMod = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
[Dependency] private readonly StunSystem _stunSystem = default!;
|
||||
[Dependency] private readonly MovementModStatusSystem _movementMod = default!;
|
||||
base.Initialize();
|
||||
|
||||
public override void Initialize()
|
||||
SubscribeLocalEvent<StunOnCollideComponent, StartCollideEvent>(HandleCollide);
|
||||
SubscribeLocalEvent<StunOnCollideComponent, ThrowDoHitEvent>(HandleThrow);
|
||||
}
|
||||
|
||||
private void TryDoCollideStun(Entity<StunOnCollideComponent> ent, EntityUid target)
|
||||
{
|
||||
_stunSystem.TryKnockdown(target, ent.Comp.KnockdownAmount, ent.Comp.Refresh, ent.Comp.AutoStand, ent.Comp.Drop);
|
||||
|
||||
if (ent.Comp.Refresh)
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<StunOnCollideComponent, StartCollideEvent>(HandleCollide);
|
||||
SubscribeLocalEvent<StunOnCollideComponent, ThrowDoHitEvent>(HandleThrow);
|
||||
}
|
||||
|
||||
private void TryDoCollideStun(EntityUid uid, StunOnCollideComponent component, EntityUid target)
|
||||
{
|
||||
_stunSystem.TryUpdateStunDuration(target, component.StunAmount);
|
||||
|
||||
_stunSystem.TryKnockdown(target, component.KnockdownAmount, component.Refresh, component.AutoStand, force: true);
|
||||
|
||||
_stunSystem.TryUpdateStunDuration(target, ent.Comp.StunAmount);
|
||||
_movementMod.TryUpdateMovementSpeedModDuration(
|
||||
target,
|
||||
MovementModStatusSystem.TaserSlowdown,
|
||||
component.SlowdownAmount,
|
||||
component.WalkSpeedModifier,
|
||||
component.SprintSpeedModifier
|
||||
ent.Comp.SlowdownAmount,
|
||||
ent.Comp.WalkSpeedModifier,
|
||||
ent.Comp.SprintSpeedModifier
|
||||
);
|
||||
}
|
||||
|
||||
private void HandleCollide(EntityUid uid, StunOnCollideComponent component, ref StartCollideEvent args)
|
||||
else
|
||||
{
|
||||
if (args.OurFixtureId != component.FixtureID)
|
||||
return;
|
||||
|
||||
TryDoCollideStun(uid, component, args.OtherEntity);
|
||||
}
|
||||
|
||||
private void HandleThrow(EntityUid uid, StunOnCollideComponent component, ThrowDoHitEvent args)
|
||||
{
|
||||
TryDoCollideStun(uid, component, args.Target);
|
||||
_stunSystem.TryAddStunDuration(target, ent.Comp.StunAmount);
|
||||
_movementMod.TryAddMovementSpeedModDuration(
|
||||
target,
|
||||
MovementModStatusSystem.TaserSlowdown,
|
||||
ent.Comp.SlowdownAmount,
|
||||
ent.Comp.WalkSpeedModifier,
|
||||
ent.Comp.SprintSpeedModifier
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleCollide(Entity<StunOnCollideComponent> ent, ref StartCollideEvent args)
|
||||
{
|
||||
if (args.OurFixtureId != ent.Comp.FixtureID)
|
||||
return;
|
||||
|
||||
TryDoCollideStun(ent, args.OtherEntity);
|
||||
}
|
||||
|
||||
private void HandleThrow(Entity<StunOnCollideComponent> ent, ref ThrowDoHitEvent args)
|
||||
{
|
||||
TryDoCollideStun(ent, args.Target);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user