Merge remote-tracking branch 'WD-core/master' into upstream-core

This commit is contained in:
BIGZi0348
2025-01-05 23:44:06 +03:00
36 changed files with 456 additions and 93 deletions

View File

@@ -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;

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

@@ -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);

View 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;
}
}

View File

@@ -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
{
}

View 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);
}
}
}