Listener gear (ListenerData, union 50), float HearingMultiple, and AetherDb sensor-stat-set

Entity.HearingMultiple is now the largest of 1 (any active sensor) and each active
listener's Multiple. sensor-stat-set authors every sensor design's InterceptFactor
as a quality-ranged emission-discipline stat plus the Passive Array and its
products. Not yet built or run; the catalog is not yet regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-13 19:10:15 +02:00
commit 45f98c74eb
7 changed files with 307 additions and 4 deletions

View file

@ -191,6 +191,7 @@ public interface IPowerConsumer
Union(47, typeof(MunitionFuelData)),
Union(48, typeof(PickupData)),
Union(49, typeof(LaunchSuppressorData)),
Union(50, typeof(ListenerData)),
JsonObject(MemberSerialization.OptIn)]
public abstract class BehaviorData
{

View file

@ -0,0 +1,44 @@
/* 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;
// Passive listening gear (ruling sensor-stat-set): hears other ships' emissions at a multiple of their own range,
// bearing only. It emits nothing; Entity.HearingMultiple asks each active listener at hearing time. Its power is the
// design's EnergyDraw and its activity is the item's Active, as for sensors.
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
public class ListenerData : BehaviorData
{
// How many times an emitter's own reach this listener hears it at.
[Inspectable, JsonProperty("multiple"), Key(1), RuntimeInspectable]
public PerformanceStat Multiple = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)
{
return new Listener(this, item);
}
public override Behavior CreateInstance(ConsumableItemEffect item)
{
return new Listener(this, item);
}
}
public class Listener : Behavior
{
private readonly ListenerData _data;
public Listener(ListenerData data, EquippedItem item) : base(data, item)
{
_data = data;
}
public Listener(ListenerData data, ConsumableItemEffect item) : base(data, item)
{
_data = data;
}
public float Multiple => Evaluate(_data.Multiple);
public override bool Execute(float dt) => true;
}

View file

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

View file

@ -694,8 +694,23 @@ public abstract class Entity
}
// How much of an emission's reach this observer's instruments hear it at (ruling sensor-stat-set: listeners hear at
// a multiple of an emitter's own range): 1 with an active sensor, 0 without. Listener gear extends it.
private int HearingMultiple() => ActiveSensors().Count > 0 ? 1 : 0;
// a multiple of an emitter's own range): the largest of 1 (any active sensor) and each active listener's Multiple,
// 0 with neither. Catalog values come from AetherDb sensor-stat-set.
private float HearingMultiple()
{
var multiple = ActiveSensors().Count > 0 ? 1f : 0f;
for (var i = 0; i < Equipment.Count; i++)
{
var item = Equipment[i];
if (!item.Active.Value) continue;
foreach (var behavior in item.Behaviors)
if (behavior is Listener listener) multiple = max(multiple, listener.Multiple);
}
foreach (var effect in _activeConsumables)
foreach (var behavior in effect.Behaviors)
if (behavior is Listener listener) multiple = max(multiple, listener.Multiple);
return multiple;
}
// Cut 12.3 (docs/fire-control-cut.md): "armour absorbs first" -- the per-cell armour phase, split out of
// what used to be Absorb's own first half (moved verbatim from DamageSchematic's per-cell body, Cut 3) so