Signatures: every light signature names its channel and item through Entity.SetSignature
VisibilitySources holds Signature (channel, strength, item); the eight direct writes go through the one writer; Visibility stays the sum; SignatureOn(channel) splits it. VisibilityData gains Key(3) Channel. No number changes. Not yet built or tested at this commit (verification follows). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e0b123a98d
commit
1d14edea3a
13 changed files with 431 additions and 16 deletions
|
|
@ -85,7 +85,12 @@ public abstract class Entity
|
|||
// public Dictionary<Guid, float> Personality = new Dictionary<Guid, float>();
|
||||
|
||||
public readonly Dictionary<string, float> Messages = new Dictionary<string, float>();
|
||||
public readonly Dictionary<object, float> VisibilitySources = new Dictionary<object, float>();
|
||||
public readonly Dictionary<object, Signature> VisibilitySources = new Dictionary<object, Signature>();
|
||||
|
||||
// The one writer of VisibilitySources (the decay loop in Update is the one decayer). Every light signature
|
||||
// names its channel and the item that produced it (null for the hull).
|
||||
public void SetSignature(object source, SignatureChannel channel, float strength, EquippedItem item) =>
|
||||
VisibilitySources[source] = new Signature(channel, strength, item);
|
||||
public readonly ReactiveDictionary<Entity, float> EntityInfoGathered = new ReactiveDictionary<Entity, float>();
|
||||
|
||||
public (List<Weapon> weapons, List<EquippedItem> items)[] WeaponGroups;
|
||||
|
|
@ -158,7 +163,9 @@ public abstract class Entity
|
|||
public ItemManager ItemManager { get; }
|
||||
public int AssignedPopulation => PopulationAssignments.Sum(pa => pa.AssignedPopulation);
|
||||
public float Mass { get; private set; }
|
||||
public float Visibility => VisibilitySources.Values.Sum();
|
||||
public float Visibility => VisibilitySources.Values.Sum(s => s.Strength);
|
||||
public float SignatureOn(SignatureChannel channel) =>
|
||||
VisibilitySources.Values.Where(s => s.Channel == channel).Sum(s => s.Strength);
|
||||
|
||||
public Subject<Entity> IncomingHit = new Subject<Entity>();
|
||||
public Subject<(int2 pos, float damage)> ArmorDamage = new Subject<(int2, float)>();
|
||||
|
|
@ -1423,9 +1430,9 @@ public abstract class Entity
|
|||
|
||||
foreach (var v in VisibilitySources.Keys.ToArray())
|
||||
{
|
||||
VisibilitySources[v] = decay(VisibilitySources[v], ItemManager.GameplaySettings.VisibilityDecay, delta);
|
||||
VisibilitySources[v] = VisibilitySources[v].WithStrength(decay(VisibilitySources[v].Strength, ItemManager.GameplaySettings.VisibilityDecay, delta));
|
||||
|
||||
if (VisibilitySources[v] < 0.1f) VisibilitySources.Remove(v);
|
||||
if (VisibilitySources[v].Strength < 0.1f) VisibilitySources.Remove(v);
|
||||
}
|
||||
|
||||
UpdateTemperature(delta);
|
||||
|
|
@ -1616,7 +1623,7 @@ public abstract class Entity
|
|||
MaxTemp = NewTemperature[v.x, v.y];
|
||||
}
|
||||
|
||||
VisibilitySources[this] = radiation;
|
||||
SetSignature(this, SignatureChannel.Thermal, radiation, null);
|
||||
var swap = Temperature;
|
||||
Temperature = NewTemperature;
|
||||
NewTemperature = swap;
|
||||
|
|
|
|||
Loading…
Reference in a new issue