CHIMP handcannon (#15667)

This commit is contained in:
Nemanja
2023-04-23 19:58:45 -04:00
committed by GitHub
parent 8fbdad3009
commit 37bc649eef
22 changed files with 267 additions and 39 deletions

View File

@@ -66,27 +66,27 @@ public sealed partial class AnomalySystem : SharedAnomalySystem
private void OnStartCollide(EntityUid uid, AnomalyComponent component, ref StartCollideEvent args)
{
if (!TryComp<AnomalousParticleComponent>(args.OtherFixture.Body.Owner, out var particleComponent))
if (!TryComp<AnomalousParticleComponent>(args.OtherFixture.Body.Owner, out var particle))
return;
if (args.OtherFixture.ID != particleComponent.FixtureId)
if (args.OtherFixture.ID != particle.FixtureId)
return;
// small function to randomize because it's easier to read like this
float VaryValue(float v) => v * Random.NextFloat(MinParticleVariation, MaxParticleVariation);
if (particleComponent.ParticleType == component.DestabilizingParticleType)
if (particle.ParticleType == component.DestabilizingParticleType)
{
ChangeAnomalyStability(uid, VaryValue(component.StabilityPerDestabilizingHit), component);
ChangeAnomalyStability(uid, VaryValue(particle.StabilityPerDestabilizingHit), component);
}
else if (particleComponent.ParticleType == component.SeverityParticleType)
else if (particle.ParticleType == component.SeverityParticleType)
{
ChangeAnomalySeverity(uid, VaryValue(component.SeverityPerSeverityHit), component);
ChangeAnomalySeverity(uid, VaryValue(particle.SeverityPerSeverityHit), component);
}
else if (particleComponent.ParticleType == component.WeakeningParticleType)
else if (particle.ParticleType == component.WeakeningParticleType)
{
ChangeAnomalyHealth(uid, VaryValue(component.HealthPerWeakeningeHit), component);
ChangeAnomalyStability(uid, VaryValue(component.StabilityPerWeakeningeHit), component);
ChangeAnomalyHealth(uid, VaryValue(particle.HealthPerWeakeningeHit), component);
ChangeAnomalyStability(uid, VaryValue(particle.StabilityPerWeakeningeHit), component);
}
}

View File

@@ -1,4 +1,5 @@
using Content.Shared.Anomaly;
using Content.Shared.Anomaly.Components;
namespace Content.Server.Anomaly.Components;
@@ -20,4 +21,32 @@ public sealed class AnomalousParticleComponent : Component
/// </summary>
[DataField("fixtureId")]
public string FixtureId = "projectile";
/// <summary>
/// The amount that the <see cref="AnomalyComponent.Severity"/> increases by when hit
/// of an anomalous particle of <seealso cref="AnomalyComponent.SeverityParticleType"/>.
/// </summary>
[DataField("severityPerSeverityHit")]
public float SeverityPerSeverityHit = 0.025f;
/// <summary>
/// The amount that the <see cref="AnomalyComponent.Stability"/> increases by when hit
/// of an anomalous particle of <seealso cref="AnomalyComponent.DestabilizingParticleType"/>.
/// </summary>
[DataField("stabilityPerDestabilizingHit")]
public float StabilityPerDestabilizingHit = 0.04f;
/// <summary>
/// The amount that the <see cref="AnomalyComponent.Stability"/> increases by when hit
/// of an anomalous particle of <seealso cref="AnomalyComponent.DestabilizingParticleType"/>.
/// </summary>
[DataField("healthPerWeakeningeHit")]
public float HealthPerWeakeningeHit = -0.05f;
/// <summary>
/// The amount that the <see cref="AnomalyComponent.Stability"/> increases by when hit
/// of an anomalous particle of <seealso cref="AnomalyComponent.DestabilizingParticleType"/>.
/// </summary>
[DataField("stabilityPerWeakeningeHit")]
public float StabilityPerWeakeningeHit = -0.1f;
}