Gravity anomaly rework (#24452)

* balance

* gorilla gauntlet fix

* magboots update

* some more buff

* randomwalk speed scales with severity

* nerf

* content

* Revert "content"
This commit is contained in:
Ed
2024-01-27 15:15:05 +03:00
committed by GitHub
parent 23999b3d69
commit a923beb21b
6 changed files with 88 additions and 23 deletions

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

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

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

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

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

View File

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