Merge remote-tracking branch 'WD-core/master' into upstream-core
This commit is contained in:
@@ -9,6 +9,7 @@ using Content.Shared.Database;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Standing;
|
||||
@@ -29,6 +30,7 @@ public abstract class SharedStunSystem : EntitySystem
|
||||
[Dependency] private readonly SharedStandingStateSystem _standingState = default!;
|
||||
[Dependency] private readonly StatusEffectsSystem _statusEffect = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!; // WD
|
||||
|
||||
/// <summary>
|
||||
/// Friction modifier for knocked down players.
|
||||
@@ -117,7 +119,7 @@ public abstract class SharedStunSystem : EntitySystem
|
||||
if (!TryComp(uid, out StandingStateComponent? standing) || !(!standing.CanLieDown || standing.AutoGetUp)) // WD edit
|
||||
return;
|
||||
|
||||
if (standing.AutoGetUp && !_container.IsEntityInContainer(uid)) // WD edit
|
||||
if (standing.AutoGetUp && !_container.IsEntityInContainer(uid) && _mobStateSystem.IsAlive(uid)) // WD edit
|
||||
{
|
||||
_standingState.TryStandUp(uid, standing);
|
||||
return;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ public sealed class WhiteCVars
|
||||
CVarDef.Create("white.random_artifacts_enabled", true, CVar.SERVERONLY);
|
||||
|
||||
public static readonly CVarDef<float> ItemToArtifactRatio =
|
||||
CVarDef.Create("white.random_artifacts_ratio", 0.4f, CVar.SERVERONLY);
|
||||
CVarDef.Create("white.random_artifacts_ratio", 0.5f, CVar.SERVERONLY);
|
||||
|
||||
public static readonly CVarDef<string> ACWebhook =
|
||||
CVarDef.Create("ac.webhook", "", CVar.SERVERONLY);
|
||||
|
||||
27
Content.Shared/_White/_Engi/Limping/LimpingComponent.cs
Normal file
27
Content.Shared/_White/_Engi/Limping/LimpingComponent.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared._White._Engi.Limping;
|
||||
|
||||
/// <summary>
|
||||
/// WD.
|
||||
/// This is used for the Limping trait.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class LimpingComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public float SpeedModifier = 0.3f;
|
||||
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class LimpingComponentState : ComponentState
|
||||
{
|
||||
public float SpeedModifier;
|
||||
|
||||
public LimpingComponentState(float speedModifier)
|
||||
{
|
||||
SpeedModifier = speedModifier;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Content.Shared._White._Engi.Limping;
|
||||
|
||||
/// <summary>
|
||||
/// WD.
|
||||
/// This is used for the Limping trait to reduce it.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class LimpingHelperComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
80
Content.Shared/_White/_Engi/Limping/LimpingSystem.cs
Normal file
80
Content.Shared/_White/_Engi/Limping/LimpingSystem.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Shared._White._Engi.Limping;
|
||||
|
||||
public sealed class LimpingSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeed = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<LimpingHelperComponent, GotEquippedHandEvent>(OnGotEquipped);
|
||||
SubscribeLocalEvent<LimpingHelperComponent, GotUnequippedHandEvent>(OnGotUnequipped);
|
||||
|
||||
SubscribeLocalEvent<LimpingComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMoveSpeed);
|
||||
SubscribeLocalEvent<LimpingComponent, ComponentShutdown>(OnShutdown);
|
||||
|
||||
SubscribeLocalEvent<LimpingComponent, ComponentGetState>(OnGetState);
|
||||
SubscribeLocalEvent<LimpingComponent, ComponentHandleState>(OnHandleState);
|
||||
}
|
||||
|
||||
private void OnShutdown(Entity<LimpingComponent> ent, ref ComponentShutdown args)
|
||||
{
|
||||
_movementSpeed.RefreshMovementSpeedModifiers(ent);
|
||||
}
|
||||
|
||||
private void OnRefreshMoveSpeed(EntityUid uid, LimpingComponent component, RefreshMovementSpeedModifiersEvent args)
|
||||
{
|
||||
args.ModifySpeed(component.SpeedModifier, component.SpeedModifier);
|
||||
}
|
||||
|
||||
private void OnGotEquipped(Entity<LimpingHelperComponent> ent, ref GotEquippedHandEvent args)
|
||||
{
|
||||
if (_gameTiming.ApplyingState)
|
||||
return;
|
||||
|
||||
if (!TryComp<LimpingComponent>(args.User, out var comp))
|
||||
return;
|
||||
|
||||
if (_gameTiming.IsFirstTimePredicted)
|
||||
comp.SpeedModifier = 0.5f;
|
||||
|
||||
_movementSpeed.RefreshMovementSpeedModifiers(args.User);
|
||||
}
|
||||
|
||||
private void OnGotUnequipped(Entity<LimpingHelperComponent> ent, ref GotUnequippedHandEvent args)
|
||||
{
|
||||
if (!TryComp<LimpingComponent>(args.User, out var comp))
|
||||
return;
|
||||
|
||||
if (_gameTiming.IsFirstTimePredicted)
|
||||
comp.SpeedModifier = 0.3f;
|
||||
|
||||
_movementSpeed.RefreshMovementSpeedModifiers(args.User);
|
||||
}
|
||||
|
||||
private void OnGetState(EntityUid uid, LimpingComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new LimpingComponentState(component.SpeedModifier);
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, LimpingComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not LimpingComponentState state)
|
||||
return;
|
||||
|
||||
var diff = !MathHelper.CloseTo(component.SpeedModifier, state.SpeedModifier);
|
||||
|
||||
if (diff && _container.TryGetContainingContainer(uid, out var container))
|
||||
{
|
||||
component.SpeedModifier = state.SpeedModifier;
|
||||
_movementSpeed.RefreshMovementSpeedModifiers(container.Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user