Launch suppressor: scale the ship's own launch flash inside SetSignature, paying heat to its own cell

LaunchSuppressorData (union key 49; key 48 is held by cut loot-2 on eureka/aetheria-release-loot-2)
and LaunchSuppressor: Entity.SetSignature folds each light signature through the equipped
suppressors in equipment order. Only LaunchFlash is scaled, only while the item is Active and at
or below its rated temperature; each pays (removed x HeatPerUnit) through Behavior.AddHeat.
Fixture gear and LaunchSuppressorTests added. Not yet built or run (verify job follows).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-13 05:11:55 +02:00
commit 15b12cb95b
6 changed files with 379 additions and 13 deletions

View file

@ -189,6 +189,7 @@ public interface IPowerConsumer
Union(45, typeof(MunitionSeekerData)),
Union(46, typeof(MunitionControlData)),
Union(47, typeof(MunitionFuelData)),
Union(49, typeof(LaunchSuppressorData)),
JsonObject(MemberSerialization.OptIn)]
public abstract class BehaviorData
{

View file

@ -0,0 +1,62 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
using MessagePack;
using Newtonsoft.Json;
using static CultMath.math;
// Electronic warfare, hide-launch (campaign aetheria-ew, invariants lie-is-own-emission and lies-cost-real-heat): a
// gear that thins its own ship's launch flash. It never stores a factor and never writes a signature: Entity.SetSignature
// asks each equipped suppressor at write time, so the order in which a weapon and a suppressor execute decides nothing.
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
public class LaunchSuppressorData : BehaviorData
{
// The multiplier on the flash, clamped to 0..1: a suppressor never brightens a launch.
[Inspectable, JsonProperty("factor"), Key(1), RuntimeInspectable]
public PerformanceStat Factor = new PerformanceStat();
// Heat paid to the suppressor's own cell per unit of strength it removed.
[Inspectable, JsonProperty("heatPerUnit"), Key(2)]
public PerformanceStat HeatPerUnit = new PerformanceStat();
// Above this item temperature the suppressor scales nothing and pays nothing.
[Inspectable, JsonProperty("ratedTemperature"), Key(3)]
public PerformanceStat RatedTemperature = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)
{
return new LaunchSuppressor(this, item);
}
public override Behavior CreateInstance(ConsumableItemEffect item)
{
return new LaunchSuppressor(this, item);
}
}
public class LaunchSuppressor : Behavior
{
private readonly LaunchSuppressorData _data;
public LaunchSuppressor(LaunchSuppressorData data, EquippedItem item) : base(data, item)
{
_data = data;
}
public LaunchSuppressor(LaunchSuppressorData data, ConsumableItemEffect item) : base(data, item)
{
_data = data;
}
// Called by Entity.SetSignature for every light signature the ship writes; the strength passes through unchanged
// unless this is a launch flash and the suppressor is running below its rated temperature.
internal float Suppress(SignatureChannel channel, float strength)
{
if (channel != SignatureChannel.LaunchFlash || Item == null || !Item.Active.Value || Temperature > Evaluate(_data.RatedTemperature))
return strength;
var scaled = strength * clamp(Evaluate(_data.Factor), 0f, 1f);
AddHeat((strength - scaled) * Evaluate(_data.HeatPerUnit));
return scaled;
}
public override bool Execute(float dt) => true;
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: be58ee6eb8c74ea89518ee8200add0ba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -99,6 +99,10 @@ public abstract class Entity
{
if (channel == SignatureChannel.Emission)
throw new ArgumentException("Emission is active emission, never a light signature.", nameof(channel));
// A light signature is thinned by the ship's own gear at the moment it is written (aetheria-ew, lie-is-own-emission):
// each equipped suppressor folds the strength in equipment order and pays for what it alone removed.
foreach (var suppressor in GetBehaviors<LaunchSuppressor>())
strength = suppressor.Suppress(channel, strength);
_visibilitySources[source] = new Signature(channel, strength, item);
}
public readonly ReactiveDictionary<Entity, float> EntityInfoGathered = new ReactiveDictionary<Entity, float>();