diff --git a/Content.Server/Anomaly/Effects/GravityAnomalySystem.cs b/Content.Server/Anomaly/Effects/GravityAnomalySystem.cs index a928add35b..02cd0aafc6 100644 --- a/Content.Server/Anomaly/Effects/GravityAnomalySystem.cs +++ b/Content.Server/Anomaly/Effects/GravityAnomalySystem.cs @@ -1,4 +1,5 @@ -using Content.Server.Singularity.Components; +using Content.Server.Physics.Components; +using Content.Server.Singularity.Components; using Content.Shared.Anomaly.Components; using Content.Shared.Anomaly.Effects; using Content.Shared.Anomaly.Effects.Components; @@ -19,21 +20,31 @@ public sealed class GravityAnomalySystem : SharedGravityAnomalySystem SubscribeLocalEvent(OnStabilityChanged); } - private void OnSeverityChanged(EntityUid uid, GravityAnomalyComponent component, ref AnomalySeverityChangedEvent args) + private void OnSeverityChanged(Entity anomaly, ref AnomalySeverityChangedEvent args) { - if (TryComp(uid, out var radSource)) - radSource.Intensity = component.MaxRadiationIntensity * args.Severity; + if (TryComp(anomaly, out var radSource)) + radSource.Intensity = anomaly.Comp.MaxRadiationIntensity * args.Severity; - if (!TryComp(uid, out var gravityWell)) - return; - var accel = (component.MaxAccel - component.MinAccel) * args.Severity + component.MinAccel; - gravityWell.BaseRadialAcceleration = accel; - gravityWell.BaseTangentialAcceleration = accel * 0.2f; + if (TryComp(anomaly, out var gravityWell)) + { + var accel = MathHelper.Lerp(anomaly.Comp.MinAccel, anomaly.Comp.MaxAccel, args.Severity); + gravityWell.BaseRadialAcceleration = accel; + + var radialAccel = MathHelper.Lerp(anomaly.Comp.MinRadialAccel, anomaly.Comp.MaxRadialAccel, args.Severity); + gravityWell.BaseTangentialAcceleration = radialAccel; + } + + if (TryComp(anomaly, out var randomWalk)) + { + var speed = MathHelper.Lerp(anomaly.Comp.MinSpeed, anomaly.Comp.MaxSpeed, args.Severity); + randomWalk.MinSpeed = speed - anomaly.Comp.SpeedVariation; + randomWalk.MaxSpeed = speed + anomaly.Comp.SpeedVariation; + } } - private void OnStabilityChanged(EntityUid uid, GravityAnomalyComponent component, ref AnomalyStabilityChangedEvent args) + private void OnStabilityChanged(Entity anomaly, ref AnomalyStabilityChangedEvent args) { - if (TryComp(uid, out var gravityWell)) - gravityWell.MaxRange = component.MaxGravityWellRange * args.Stability; + if (TryComp(anomaly, out var gravityWell)) + gravityWell.MaxRange = anomaly.Comp.MaxGravityWellRange * args.Stability; } } diff --git a/Content.Server/Singularity/EntitySystems/GravityWellSystem.cs b/Content.Server/Singularity/EntitySystems/GravityWellSystem.cs index 2ba4dbd41c..ce4334391d 100644 --- a/Content.Server/Singularity/EntitySystems/GravityWellSystem.cs +++ b/Content.Server/Singularity/EntitySystems/GravityWellSystem.cs @@ -1,3 +1,4 @@ +using Content.Server.Atmos.Components; using Content.Server.Singularity.Components; using Content.Shared.Ghost; using Content.Shared.Singularity.EntitySystems; @@ -192,6 +193,9 @@ public sealed class GravityWellSystem : SharedGravityWellSystem continue; } + if (TryComp(entity, out var movedPressure) && !movedPressure.Enabled) //Ignore magboots users + continue; + if(!CanGravPulseAffect(entity)) continue; diff --git a/Content.Shared/Anomaly/Effects/Components/GravityAnomalyComponent.cs b/Content.Shared/Anomaly/Effects/Components/GravityAnomalyComponent.cs index ac2ae32dff..7c6dccea86 100644 --- a/Content.Shared/Anomaly/Effects/Components/GravityAnomalyComponent.cs +++ b/Content.Shared/Anomaly/Effects/Components/GravityAnomalyComponent.cs @@ -1,4 +1,4 @@ -using Robust.Shared.GameStates; +using Robust.Shared.GameStates; namespace Content.Shared.Anomaly.Effects.Components; @@ -9,47 +9,81 @@ public sealed partial class GravityAnomalyComponent : Component /// The maximumum size the GravityWellComponent MaxRange can be. /// Is scaled linearly with stability. /// - [DataField("maxGravityWellRange"), ViewVariables(VVAccess.ReadWrite)] - public float MaxGravityWellRange = 8f; + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float MaxGravityWellRange = 10f; /// /// The maximum distance from which the anomaly /// can throw you via a pulse. /// - [DataField("maxThrowRange"), ViewVariables(VVAccess.ReadWrite)] + [DataField, ViewVariables(VVAccess.ReadWrite)] public float MaxThrowRange = 5f; /// /// The maximum strength the anomaly /// can throw you via a pulse /// - [DataField("maxThrowStrength"), ViewVariables(VVAccess.ReadWrite)] + [DataField, ViewVariables(VVAccess.ReadWrite)] public float MaxThrowStrength = 10; /// /// The maximum Intensity of the RadiationSourceComponent. /// Is scaled linearly with stability. /// - [DataField("maxRadiationIntensity"), ViewVariables(VVAccess.ReadWrite)] + [DataField, ViewVariables(VVAccess.ReadWrite)] public float MaxRadiationIntensity = 3f; /// /// The minimum acceleration value for GravityWellComponent /// Is scaled linearly with stability. /// - [DataField("minAccel"), ViewVariables(VVAccess.ReadWrite)] - public float MinAccel = 1f; + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float MinAccel = 0f; /// /// The maximum acceleration value for GravityWellComponent /// Is scaled linearly with stability. /// - [DataField("maxAccel"), ViewVariables(VVAccess.ReadWrite)] + [DataField, ViewVariables(VVAccess.ReadWrite)] public float MaxAccel = 5f; + /// + /// The minimum acceleration value for GravityWellComponent + /// Is scaled linearly with stability. + /// + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float MinRadialAccel = 0f; + + /// + /// The maximum acceleration value for GravityWellComponent + /// Is scaled linearly with stability. + /// + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float MaxRadialAccel = 5f; + + /// + /// The maximum speed for RandomWalkComponent + /// Is scaled linearly with severity. + /// + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float MinSpeed = 0.1f; + + /// + /// The maximum speed for RandomWalkComponent + /// Is scaled linearly with severity. + /// + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float MaxSpeed = 1.0f; + + /// + /// Random +- speed modifier + /// + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float SpeedVariation = 0.1f; + /// /// The range around the anomaly that will be spaced on supercritical. /// - [DataField("spaceRange"), ViewVariables(VVAccess.ReadWrite)] + [DataField, ViewVariables(VVAccess.ReadWrite)] public float SpaceRange = 3f; } diff --git a/Content.Shared/Weapons/Melee/Components/MeleeThrowOnHitComponent.cs b/Content.Shared/Weapons/Melee/Components/MeleeThrowOnHitComponent.cs index ef8ee3f89c..82ffc5e51f 100644 --- a/Content.Shared/Weapons/Melee/Components/MeleeThrowOnHitComponent.cs +++ b/Content.Shared/Weapons/Melee/Components/MeleeThrowOnHitComponent.cs @@ -1,5 +1,6 @@ using System.Numerics; using Robust.Shared.GameStates; +using Robust.Shared.Physics.Components; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared.Weapons.Melee.Components; @@ -89,6 +90,12 @@ public sealed partial class MeleeThrownComponent : Component [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] [AutoNetworkedField] public TimeSpan MinLifetimeTime; + + /// + /// the status to which the entity will return when the thrown ends + /// + [DataField] + public BodyStatus PreviousStatus; } /// diff --git a/Content.Shared/Weapons/Melee/MeleeThrowOnHitSystem.cs b/Content.Shared/Weapons/Melee/MeleeThrowOnHitSystem.cs index d755f7a0b4..fc36428654 100644 --- a/Content.Shared/Weapons/Melee/MeleeThrowOnHitSystem.cs +++ b/Content.Shared/Weapons/Melee/MeleeThrowOnHitSystem.cs @@ -71,6 +71,7 @@ public sealed class MeleeThrowOnHitSystem : EntitySystem (body.BodyType & (BodyType.Dynamic | BodyType.KinematicController)) == 0x0) return; + comp.PreviousStatus = body.BodyStatus; comp.ThrownEndTime = _timing.CurTime + TimeSpan.FromSeconds(comp.Lifetime); comp.MinLifetimeTime = _timing.CurTime + TimeSpan.FromSeconds(comp.MinLifetime); _physics.SetBodyStatus(body, BodyStatus.InAir); @@ -82,7 +83,7 @@ public sealed class MeleeThrowOnHitSystem : EntitySystem private void OnThrownShutdown(Entity ent, ref ComponentShutdown args) { if (TryComp(ent, out var body)) - _physics.SetBodyStatus(body, BodyStatus.OnGround); + _physics.SetBodyStatus(body,ent.Comp.PreviousStatus); var ev = new MeleeThrowOnHitEndEvent(); RaiseLocalEvent(ent, ref ev); } diff --git a/Resources/Prototypes/Entities/Structures/Specific/Anomaly/anomalies.yml b/Resources/Prototypes/Entities/Structures/Specific/Anomaly/anomalies.yml index 56c970929c..e357769aa5 100644 --- a/Resources/Prototypes/Entities/Structures/Specific/Anomaly/anomalies.yml +++ b/Resources/Prototypes/Entities/Structures/Specific/Anomaly/anomalies.yml @@ -102,6 +102,14 @@ - type: GravityAnomaly - type: GravityWell - type: RadiationSource + - type: Physics + bodyType: Dynamic + bodyStatus: InAir + - type: CanMoveInAir + - type: RandomWalk + - type: SingularityDistortion + intensity: 1000 + falloffPower: 2.7 - type: entity id: AnomalyElectricity