Fix Entity Effect Scaling (Hopefully) for good and some other misc fixes (#41163)

* Fix the last of the entity effects bugs

* aaa

* losing it

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
Princess Cheeseballs
2025-11-06 13:34:53 -08:00
committed by GitHub
parent 2b196257c1
commit e5b6e4bf04
21 changed files with 21 additions and 71 deletions

View File

@@ -9,7 +9,7 @@ namespace Content.Shared.EntityConditions.Conditions;
/// Returns true if this solution entity has an amount of reagent in it within a specified minimum and maximum.
/// </summary>
/// <inheritdoc cref="EntityConditionSystem{T, TCondition}"/>
public sealed partial class ReagentThresholdEntityConditionSystem : EntityConditionSystem<SolutionComponent, ReagentCondition>
public sealed partial class ReagentEntityConditionSystem : EntityConditionSystem<SolutionComponent, ReagentCondition>
{
protected override void Condition(Entity<SolutionComponent> entity, ref EntityConditionEvent<ReagentCondition> args)
{

View File

@@ -28,9 +28,6 @@ public abstract partial class BaseSpawnEntityEntityEffect<T> : EntityEffectBase<
[DataField]
public bool Predicted = true;
/// <inheritdoc cref="EntityEffect.Scaling"/>
public override bool Scaling => true;
public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> Loc.GetString("entity-effect-guidebook-spawn-entity",
("chance", Probability),

View File

@@ -28,8 +28,6 @@ public sealed partial class AreaReactionEffect : EntityEffectBase<AreaReactionEf
/// </summary>
[DataField(required: true)] public SoundSpecifier Sound = default!;
public override bool Scaling => true;
public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> Loc.GetString("entity-effect-guidebook-area-reaction",
("duration", Duration)

View File

@@ -49,8 +49,6 @@ public sealed partial class Emp : EntityEffectBase<Emp>
[DataField]
public TimeSpan Duration = TimeSpan.FromSeconds(15);
public override bool Scaling => true;
public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> Loc.GetString("entity-effect-guidebook-emp-reaction-effect", ("chance", Probability));

View File

@@ -50,8 +50,6 @@ public sealed partial class Explosion : EntityEffectBase<Explosion>
[DataField]
public float TileBreakScale = 1f;
public override bool Scaling => true;
public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> Loc.GetString("entity-effect-guidebook-explosion", ("chance", Probability));

View File

@@ -76,8 +76,6 @@ public sealed partial class Flash : EntityEffectBase<Flash>
[DataField]
public SoundSpecifier? Sound = new SoundPathSpecifier("/Audio/Weapons/flash.ogg");
public override bool Scaling => true;
public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> Loc.GetString("entity-effect-guidebook-flash-reaction-effect", ("chance", Probability));
}

View File

@@ -25,7 +25,7 @@ public abstract partial class EntityEffect
/// If true, then it allows the scale multiplier to go above 1.
/// </summary>
[DataField]
public virtual bool Scaling { get; private set; }
public virtual bool Scaling { get; private set; } = true;
// TODO: This should be an entity condition but guidebook relies on it heavily for formatting...
/// <summary>

View File

@@ -26,35 +26,35 @@ public sealed partial class SharedEntityEffectsSystem : EntitySystem, IEntityEff
private void OnReactive(Entity<ReactiveComponent> entity, ref ReactionEntityEvent args)
{
if (args.Reagent.ReactiveEffects == null || entity.Comp.ReactiveGroups == null)
return;
var scale = args.ReagentQuantity.Quantity.Float();
foreach (var (key, val) in args.Reagent.ReactiveEffects)
if (args.Reagent.ReactiveEffects != null && entity.Comp.ReactiveGroups != null)
{
if (!val.Methods.Contains(args.Method))
continue;
foreach (var (key, val) in args.Reagent.ReactiveEffects)
{
if (!val.Methods.Contains(args.Method))
continue;
if (!entity.Comp.ReactiveGroups.TryGetValue(key, out var group))
continue;
if (!entity.Comp.ReactiveGroups.TryGetValue(key, out var group))
continue;
if (!group.Contains(args.Method))
continue;
if (!group.Contains(args.Method))
continue;
ApplyEffects(entity, val.Effects, scale);
ApplyEffects(entity, val.Effects, scale);
}
}
if (entity.Comp.Reactions == null)
return;
foreach (var entry in entity.Comp.Reactions)
if (entity.Comp.Reactions != null)
{
if (!entry.Methods.Contains(args.Method))
continue;
foreach (var entry in entity.Comp.Reactions)
{
if (!entry.Methods.Contains(args.Method))
continue;
if (entry.Reagents == null || entry.Reagents.Contains(args.Reagent.ID))
ApplyEffects(entity, entry.Effects, scale);
if (entry.Reagents == null || entry.Reagents.Contains(args.Reagent.ID))
ApplyEffects(entity, entry.Effects, scale);
}
}
}