]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Gravity anomaly rework (#24452)
authorEd <96445749+TheShuEd@users.noreply.github.com>
Sat, 27 Jan 2024 12:15:05 +0000 (15:15 +0300)
committerGitHub <noreply@github.com>
Sat, 27 Jan 2024 12:15:05 +0000 (04:15 -0800)
* balance

* gorilla gauntlet fix

* magboots update

* some more buff

* randomwalk speed scales with severity

* nerf

* content

* Revert "content"

Content.Server/Anomaly/Effects/GravityAnomalySystem.cs
Content.Server/Singularity/EntitySystems/GravityWellSystem.cs
Content.Shared/Anomaly/Effects/Components/GravityAnomalyComponent.cs
Content.Shared/Weapons/Melee/Components/MeleeThrowOnHitComponent.cs
Content.Shared/Weapons/Melee/MeleeThrowOnHitSystem.cs
Resources/Prototypes/Entities/Structures/Specific/Anomaly/anomalies.yml

index a928add35b4a745bd275c28f35f3d17b1f9a9f16..02cd0aafc6239e721e7d47c2517b258fdfe61844 100644 (file)
@@ -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<GravityAnomalyComponent, AnomalyStabilityChangedEvent>(OnStabilityChanged);
     }
 
-    private void OnSeverityChanged(EntityUid uid, GravityAnomalyComponent component, ref AnomalySeverityChangedEvent args)
+    private void OnSeverityChanged(Entity<GravityAnomalyComponent> anomaly, ref AnomalySeverityChangedEvent args)
     {
-        if (TryComp<RadiationSourceComponent>(uid, out var radSource))
-            radSource.Intensity = component.MaxRadiationIntensity * args.Severity;
+        if (TryComp<RadiationSourceComponent>(anomaly, out var radSource))
+            radSource.Intensity = anomaly.Comp.MaxRadiationIntensity * args.Severity;
 
-        if (!TryComp<GravityWellComponent>(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<GravityWellComponent>(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<RandomWalkComponent>(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<GravityAnomalyComponent> anomaly, ref AnomalyStabilityChangedEvent args)
     {
-        if (TryComp<GravityWellComponent>(uid, out var gravityWell))
-            gravityWell.MaxRange = component.MaxGravityWellRange * args.Stability;
+        if (TryComp<GravityWellComponent>(anomaly, out var gravityWell))
+            gravityWell.MaxRange = anomaly.Comp.MaxGravityWellRange * args.Stability;
     }
 }
index 2ba4dbd41cbb0339485b6ba5d8d25366e3e79a6c..ce4334391db6e70861ce173b9f864b5861d7b678 100644 (file)
@@ -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<MovedByPressureComponent>(entity, out var movedPressure) && !movedPressure.Enabled) //Ignore magboots users
+                continue;
+
             if(!CanGravPulseAffect(entity))
                 continue;
 
index ac2ae32dff6092d99076999839adb26d1f75a19b..7c6dccea862478ea4a2cc0114c6d002c1af74f77 100644 (file)
@@ -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.
     /// </summary>
-    [DataField("maxGravityWellRange"), ViewVariables(VVAccess.ReadWrite)]
-    public float MaxGravityWellRange = 8f;
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
+    public float MaxGravityWellRange = 10f;
 
     /// <summary>
     /// The maximum distance from which the anomaly
     /// can throw you via a pulse.
     /// </summary>
-    [DataField("maxThrowRange"), ViewVariables(VVAccess.ReadWrite)]
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
     public float MaxThrowRange = 5f;
 
     /// <summary>
     /// The maximum strength the anomaly
     /// can throw you via a pulse
     /// </summary>
-    [DataField("maxThrowStrength"), ViewVariables(VVAccess.ReadWrite)]
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
     public float MaxThrowStrength = 10;
 
     /// <summary>
     /// The maximum Intensity of the RadiationSourceComponent.
     /// Is scaled linearly with stability.
     /// </summary>
-    [DataField("maxRadiationIntensity"), ViewVariables(VVAccess.ReadWrite)]
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
     public float MaxRadiationIntensity = 3f;
 
     /// <summary>
     /// The minimum acceleration value for GravityWellComponent
     /// Is scaled linearly with stability.
     /// </summary>
-    [DataField("minAccel"), ViewVariables(VVAccess.ReadWrite)]
-    public float MinAccel = 1f;
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
+    public float MinAccel = 0f;
 
     /// <summary>
     /// The maximum acceleration value for GravityWellComponent
     /// Is scaled linearly with stability.
     /// </summary>
-    [DataField("maxAccel"), ViewVariables(VVAccess.ReadWrite)]
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
     public float MaxAccel = 5f;
 
+    /// <summary>
+    /// The minimum acceleration value for GravityWellComponent
+    /// Is scaled linearly with stability.
+    /// </summary>
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
+    public float MinRadialAccel = 0f;
+
+    /// <summary>
+    /// The maximum acceleration value for GravityWellComponent
+    /// Is scaled linearly with stability.
+    /// </summary>
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
+    public float MaxRadialAccel = 5f;
+
+    /// <summary>
+    /// The maximum speed for RandomWalkComponent
+    /// Is scaled linearly with severity.
+    /// </summary>
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
+    public float MinSpeed = 0.1f;
+
+    /// <summary>
+    /// The maximum speed for RandomWalkComponent
+    /// Is scaled linearly with severity.
+    /// </summary>
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
+    public float MaxSpeed = 1.0f;
+
+    /// <summary>
+    /// Random +- speed modifier
+    /// </summary>
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
+    public float SpeedVariation = 0.1f;
+
     /// <summary>
     /// The range around the anomaly that will be spaced on supercritical.
     /// </summary>
-    [DataField("spaceRange"), ViewVariables(VVAccess.ReadWrite)]
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
     public float SpaceRange = 3f;
 }
index ef8ee3f89ce089955ef2c5d0b1eb2eaffe1626ac..82ffc5e51fc662a6dc8bf4f583cbad691c509e57 100644 (file)
@@ -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;
+
+    /// <summary>
+    /// the status to which the entity will return when the thrown ends
+    /// </summary>
+    [DataField]
+    public BodyStatus PreviousStatus;
 }
 
 /// <summary>
index d755f7a0b4e0c0eea6b7aba770bec5495610011f..fc364286549ef6b8b2a2ad1304b344a5bba986c5 100644 (file)
@@ -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<MeleeThrownComponent> ent, ref ComponentShutdown args)
     {
         if (TryComp<PhysicsComponent>(ent, out var body))
-            _physics.SetBodyStatus(body, BodyStatus.OnGround);
+            _physics.SetBodyStatus(body,ent.Comp.PreviousStatus);
         var ev = new MeleeThrowOnHitEndEvent();
         RaiseLocalEvent(ent, ref ev);
     }
index 56c970929cbff7e36bb97d9f8e73b5a4ff6608f8..e357769aa50ba006c1d03ad31a994df3fd8199fb 100644 (file)
   - 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