Merge origin/master (325ef4bc, pirates-record) into the emoji-font branch
Mechanical merge; this cut changes no catalog. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
99f0005c8a
58 changed files with 1552 additions and 6802 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 151cf0ff54a22274caf671ece149fa6e
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Dithered Particle Trail AetherDrive
|
||||
m_Shader: {fileID: 4800000, guid: 46776b9fa35a437448f683f31b04d68d, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 1d6eba2a167939a468c00fda35723dd0, type: 3}
|
||||
m_Scale: {x: 0, y: 1}
|
||||
m_Offset: {x: 0.5, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1.216786, g: 1.216786, b: 1.216786, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 555ada90c0f01654a9387483bd95a688
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Settings.asset
(Stored with Git LFS)
BIN
Assets/Resources/Settings.asset
(Stored with Git LFS)
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
|
@ -140,12 +140,10 @@ public static class ShipPrefabAuthoring
|
|||
if (values.Length != 7) throw new InvalidOperationException($"Invalid pivot name {name}");
|
||||
var pivot = AddOrGet<ArticulationPoint>(node.gameObject);
|
||||
pivot.Group = ParseInt(values[1], name);
|
||||
pivot.YawMin = ParseInt(values[2], name);
|
||||
pivot.YawMax = ParseInt(values[3], name);
|
||||
pivot.PitchMin = ParseInt(values[4], name);
|
||||
pivot.PitchMax = ParseInt(values[5], name);
|
||||
pivot.Speed = ParseInt(values[6], name);
|
||||
if (pivot.YawMin > pivot.YawMax || pivot.PitchMin > pivot.PitchMax || pivot.Speed <= 0)
|
||||
if (pivot.PitchMin > pivot.PitchMax || pivot.Speed <= 0)
|
||||
throw new InvalidOperationException($"Invalid articulation range or speed in {name}");
|
||||
pivots.Add(pivot);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -961,7 +961,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
Dialog.MoveToCursor();
|
||||
// TODO: SFX: Fail
|
||||
}
|
||||
else if (CurrentEntity.GetBehavior<Thruster>() == null && CurrentEntity.GetBehavior<AetherDrive>() == null)
|
||||
else if (CurrentEntity.GetBehavior<Thruster>() == null)
|
||||
{
|
||||
Dialog.Clear();
|
||||
Dialog.Title.text = "Can't undock. Missing thruster component!";
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ using UnityEngine;
|
|||
using CultMath;
|
||||
using static CultMath.math;
|
||||
|
||||
// Presentation only: the barrel follows the point its group's solution places (EntityInstance), which FireControl has
|
||||
// already clamped to the arc. This decides no arc; Speed and the pitch clamp are how the picture slews.
|
||||
public class ArticulationPoint : MonoBehaviour
|
||||
{
|
||||
public Transform Target;
|
||||
|
||||
public int Group;
|
||||
|
||||
public float YawMin;
|
||||
public float YawMax;
|
||||
|
||||
public float PitchMin;
|
||||
public float PitchMax;
|
||||
|
||||
|
|
@ -30,7 +29,7 @@ public class ArticulationPoint : MonoBehaviour
|
|||
var yaw = Vector2.SignedAngle(new Vector2(0, 1), new Vector2(targetLocal.x, targetLocal.z));
|
||||
var pitch = Vector2.SignedAngle(new Vector2(1, 0), new Vector2(targetLocal.z, targetLocal.y));
|
||||
|
||||
var targetYaw = clamp(_yaw - yaw, YawMin, YawMax);
|
||||
var targetYaw = _yaw - yaw;
|
||||
var targetPitch = clamp(_pitch - pitch, PitchMin, PitchMax);
|
||||
|
||||
if (abs(targetYaw - _yaw) < Speed * Time.deltaTime)
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ public class EntityInstance : MonoBehaviour
|
|||
public Dictionary<HardpointData, int> BarrelIndices { get; private set; }
|
||||
public Dictionary<Radiator, MeshRenderer> RadiatorMeshes { get; private set; }
|
||||
public Transform LookAtPoint { get; private set; }
|
||||
private Dictionary<int, Transform> _groupAims;
|
||||
public Entity Entity { get; private set; }
|
||||
public ZoneRenderer ZoneRenderer { get; private set; }
|
||||
public Transform LocalSpace { get; private set; }
|
||||
|
|
@ -277,10 +278,14 @@ public class EntityInstance : MonoBehaviour
|
|||
// HullColliders no longer publish Hit or a blast event at all (R8).
|
||||
|
||||
LookAtPoint = new GameObject($"{entity.Name} Look Point").transform;
|
||||
|
||||
|
||||
// One aim point per articulation group, placed each LateUpdate where the group's first weapon aims.
|
||||
_groupAims = new Dictionary<int, Transform>();
|
||||
foreach (var articulationPoint in ArticulationPoints)
|
||||
{
|
||||
articulationPoint.Target = LookAtPoint;
|
||||
if (!_groupAims.TryGetValue(articulationPoint.Group, out var aim))
|
||||
_groupAims[articulationPoint.Group] = aim = new GameObject($"{entity.Name} Aim {articulationPoint.Group}").transform;
|
||||
articulationPoint.Target = aim;
|
||||
}
|
||||
|
||||
_subscriptions.Add(Entity.HullDamage.Subscribe(_ =>
|
||||
|
|
@ -399,8 +404,18 @@ public class EntityInstance : MonoBehaviour
|
|||
x.Value.material.SetFloat("_Emission", Entity.ItemManager.GameplaySettings.TemperatureEmissionCurve.Evaluate(x.Key.RadiatorTemperature));
|
||||
}
|
||||
|
||||
LookAtPoint.position = transform.position + Entity.Aim.ToUnity() *
|
||||
(!Entity.Target.Value.IsNone ? max(Entity.TargetRange,Entity.ItemManager.GameplaySettings.ConvergenceMinimumDistance) : 10000);
|
||||
var aimDistance = !Entity.Target.Value.IsNone
|
||||
? max(Entity.TargetRange, Entity.ItemManager.GameplaySettings.ConvergenceMinimumDistance)
|
||||
: 10000;
|
||||
LookAtPoint.position = transform.position + Entity.Aim.ToUnity() * aimDistance;
|
||||
foreach (var group in _groupAims)
|
||||
{
|
||||
var weapon = group.Key >= 0 && group.Key < Entity.WeaponGroups.Length ? Entity.WeaponGroups[group.Key].weapons.FirstOrDefault() : null;
|
||||
if (weapon == null) { group.Value.position = LookAtPoint.position; continue; }
|
||||
var barrel = Barrels.TryGetValue(weapon.Item.Hardpoint, out var barrels) ? barrels[0].position : transform.position;
|
||||
var direction = FireControl.Solution(weapon, Entity, Entity.Target.Value).Direction;
|
||||
group.Value.position = barrel + new Vector3(direction.x, 0, direction.y) * aimDistance;
|
||||
}
|
||||
LocalSpace.localPosition = transform.position = Entity.Position.ToUnity();
|
||||
if (_influenceInstance)
|
||||
_influenceInstance.position = new Vector3(Entity.Position.x, 0, Entity.Position.z);
|
||||
|
|
|
|||
|
|
@ -18,16 +18,7 @@ public class ShipInstance : EntityInstance
|
|||
public int MaxParticleCount;
|
||||
}
|
||||
|
||||
private class AetherDriveInstance
|
||||
{
|
||||
public AetherDrive Drive;
|
||||
public ParticleSystem Particles;
|
||||
public float BaseEmission;
|
||||
public float BaseForce;
|
||||
}
|
||||
|
||||
private ThrusterInstance[] _thrusters;
|
||||
private AetherDriveInstance _aetherDrive;
|
||||
|
||||
public Ship Ship { get; private set; }
|
||||
|
||||
|
|
@ -47,20 +38,6 @@ public class ShipInstance : EntityInstance
|
|||
return;
|
||||
}
|
||||
Ship = ship;
|
||||
var drive = ship.GetBehavior<AetherDrive>();
|
||||
if (drive != null)
|
||||
{
|
||||
var particles = Instantiate(EngineAssets.Load<ParticleSystem>(drive.DriveData.Particles), transform, false);
|
||||
var main = particles.main;
|
||||
main.customSimulationSpace = LocalSpace;
|
||||
_aetherDrive = new AetherDriveInstance
|
||||
{
|
||||
Drive = drive,
|
||||
BaseEmission = particles.emission.rateOverTimeMultiplier,
|
||||
Particles = particles,
|
||||
BaseForce = particles.forceOverLifetime.z.curveMultiplier
|
||||
};
|
||||
}
|
||||
_thrusters = ship.GetBehaviors<Thruster>().Select(thruster =>
|
||||
{
|
||||
var effectData = (ThrusterData) thruster.Data;
|
||||
|
|
@ -115,19 +92,6 @@ public class ShipInstance : EntityInstance
|
|||
TractorBeam.Power = Entity.TractorPower;
|
||||
TractorBeam.Direction = Entity.Aim.ToUnity();
|
||||
|
||||
if (_aetherDrive != null)
|
||||
{
|
||||
var thrust = length(_aetherDrive.Drive.ThrustDirection);
|
||||
var forceOverLifetime = _aetherDrive.Particles.forceOverLifetime;
|
||||
forceOverLifetime.xMultiplier = _aetherDrive.Drive.ThrustDirection.x * _aetherDrive.BaseForce;
|
||||
forceOverLifetime.zMultiplier = _aetherDrive.Drive.ThrustDirection.y * _aetherDrive.BaseForce;
|
||||
var emissionModule = _aetherDrive.Particles.emission;
|
||||
// Cut 8 (operator ask 2026-09-19): intent (thrust) times condition -- presentation reads the
|
||||
// simulation's own ratio rather than recomputing any part of it. AetherDrive.Condition is the
|
||||
// equivalent of Thruster.Condition below (Torque in place of Thrust).
|
||||
emissionModule.rateOverTimeMultiplier = _aetherDrive.BaseEmission * thrust * _aetherDrive.Drive.Condition;
|
||||
}
|
||||
|
||||
foreach (var thrusterInstance in _thrusters)
|
||||
{
|
||||
var emissionModule = thrusterInstance.System.emission;
|
||||
|
|
|
|||
|
|
@ -1,185 +0,0 @@
|
|||
/* 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 GameCult.Caching;
|
||||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
using CultMath;
|
||||
using static CultMath.math;
|
||||
|
||||
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), EntityTypeRestriction(HullType.Ship), RuntimeInspectable]
|
||||
public class AetherDriveData : BehaviorData
|
||||
{
|
||||
[Inspectable, JsonProperty("diameters"), Key(1)]
|
||||
public float3 RotorDiameter;
|
||||
|
||||
[Inspectable, JsonProperty("masses"), Key(2)]
|
||||
public float3 RotorMass;
|
||||
|
||||
[Inspectable, JsonProperty("rpm"), Key(3), RuntimeInspectable]
|
||||
public PerformanceStat MaximumRpm;
|
||||
|
||||
[Inspectable, JsonProperty("couplingLambdas"), Key(4)]
|
||||
public float3 CouplingLambda;
|
||||
|
||||
[Inspectable, JsonProperty("lambdaMultiplier"), Key(5)]
|
||||
public PerformanceStat LambdaMultiplier;
|
||||
|
||||
[Inspectable, JsonProperty("couplingEfficiency"), Key(6), RuntimeInspectable]
|
||||
public PerformanceStat CouplingEfficiency;
|
||||
|
||||
[Inspectable, JsonProperty("torque"), Key(7), RuntimeInspectable]
|
||||
public PerformanceStat Torque;
|
||||
|
||||
[Inspectable, JsonProperty("torqueProfile"), Key(8), RuntimeInspectable]
|
||||
public BezierCurve TorqueProfile;
|
||||
|
||||
[Inspectable, JsonProperty("draw"), Key(9), RuntimeInspectable]
|
||||
public PerformanceStat EnergyDraw;
|
||||
|
||||
[Inspectable, JsonProperty("passiveCoupling"), Key(10), RuntimeInspectable]
|
||||
public PerformanceStat PassiveCoupling;
|
||||
|
||||
[Inspectable, JsonProperty("rpmAudio"), Key(11), RuntimeInspectable]
|
||||
public uint RpmAudioParameter;
|
||||
|
||||
[Inspectable, JsonProperty("torqueAudio"), Key(12), RuntimeInspectable]
|
||||
public uint TorqueRatioAudioParameter;
|
||||
|
||||
[Inspectable, CultInspectorAssetGuid, JsonProperty("particles"), Key(13)]
|
||||
public string Particles;
|
||||
|
||||
public override Behavior CreateInstance(EquippedItem item)
|
||||
{
|
||||
return new AetherDrive(this, item);
|
||||
}
|
||||
|
||||
public override Behavior CreateInstance(ConsumableItemEffect item)
|
||||
{
|
||||
return new AetherDrive(this, item);
|
||||
}
|
||||
}
|
||||
|
||||
public class AetherDrive : Behavior, IPowerConsumer
|
||||
{
|
||||
private AetherDriveData _data;
|
||||
private float3 _axis;
|
||||
|
||||
public float3 Thrust { get; private set; }
|
||||
public float3 Rpm { get; private set; }
|
||||
public float MaximumRpm { get; private set; }
|
||||
public float2 ThrustDirection { get; private set; }
|
||||
|
||||
public AetherDriveData DriveData => _data;
|
||||
|
||||
// Cut 8 (operator ask 2026-09-19): the equivalent quantity to Thruster.Condition -- Torque is the stat that
|
||||
// actually governs this behaviour's rotor spin-up (PowerRequest/Execute above both read it), so it is what
|
||||
// "broken" means for a drive. 1f for the item-less ConsumableItemEffect case, same reasoning as Thruster.
|
||||
public float Condition => Item?.ConditionRatio(_data.Torque) ?? 1f;
|
||||
|
||||
public float3 Axis
|
||||
{
|
||||
get => _axis;
|
||||
set => _axis = clamp(value, -1, 1);
|
||||
}
|
||||
|
||||
public AetherDrive(AetherDriveData data, EquippedItem item) : base(data, item)
|
||||
{
|
||||
_data = data;
|
||||
}
|
||||
|
||||
public AetherDrive(AetherDriveData data, ConsumableItemEffect item) : base(data, item)
|
||||
{
|
||||
_data = data;
|
||||
}
|
||||
|
||||
// Cut 3 (docs/stats-and-power-cut.md): the request PowerBus needs before Execute runs. Only the rotor
|
||||
// spin-up (torque accelerating Rpm toward MaximumRpm) costs power -- spending existing spin into thrust
|
||||
// (Execute's decay-to-thrust arithmetic below) is free, same as before. Pure and side-effect-free: it reads
|
||||
// Rpm but does not write it, so Execute's own identical arithmetic a few lines later -- which does perform
|
||||
// the real decay -- produces the same numbers Rpm actually moves by. Accepts the recompute (Q3's ruling).
|
||||
//
|
||||
// Nominal-request ruling (docs/stats-and-power-cut.md, operator ruling 2026-09-19): Torque, LambdaMultiplier,
|
||||
// MaximumRpm, PassiveCoupling and EnergyDraw are all registered request fields (StatValidation.
|
||||
// PowerRequestFields) -- read nominally (what full power would produce) so Torque carrying its own
|
||||
// PowerSupply term (Cut 7's brownout curve) no longer makes this tick's request depend on this tick's own
|
||||
// grant. Execute below is unchanged: it calls the real, curved Evaluate, so the actual spin-up still
|
||||
// degrades with whatever the bus actually grants.
|
||||
public float PowerRequest(float dt)
|
||||
{
|
||||
var couplingLambda = _data.CouplingLambda * Item.EvaluateNominalPower(_data.LambdaMultiplier) * max(abs(_axis), EvaluateNominalPower(_data.PassiveCoupling));
|
||||
var rpmAfterDecay = decay(Rpm, couplingLambda, dt);
|
||||
var maximumRpm = EvaluateNominalPower(_data.MaximumRpm);
|
||||
var torqueProfile = float3(
|
||||
_data.TorqueProfile.Evaluate(rpmAfterDecay.x / maximumRpm),
|
||||
_data.TorqueProfile.Evaluate(rpmAfterDecay.y / maximumRpm),
|
||||
_data.TorqueProfile.Evaluate(rpmAfterDecay.z / maximumRpm));
|
||||
var potentialTorque = EvaluateNominalPower(_data.Torque) * torqueProfile;
|
||||
var potentialRpmDelta = potentialTorque / length(_data.RotorMass) * dt;
|
||||
var actualRpmDelta = min(maximumRpm - rpmAfterDecay, potentialRpmDelta);
|
||||
var torqueRatio = actualRpmDelta / potentialRpmDelta;
|
||||
var draw = torqueRatio * EvaluateNominalPower(_data.EnergyDraw) / 3;
|
||||
return (draw.x + draw.y + draw.z) * dt;
|
||||
}
|
||||
|
||||
// Cut 5 (docs/stats-and-power-cut.md §1.3, PowerTiers.cs): Medium -- mobility, same as Thruster.
|
||||
public int DefaultPowerTier => PowerTiers.Medium;
|
||||
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
var rotorSpeed = Rpm * _data.RotorDiameter / 100;
|
||||
|
||||
var forward = normalize(Entity.Direction);
|
||||
var right = forward.Rotate(ItemRotation.Clockwise);
|
||||
|
||||
var speed = float2(dot(Entity.Velocity, forward), dot(Entity.Velocity, right));
|
||||
var couplingEfficiency = Evaluate(_data.CouplingEfficiency);
|
||||
var efficiency = float3(saturate(1 - speed / max(rotorSpeed.xy, 1) * sign(_axis.xy)) * couplingEfficiency, 1);
|
||||
|
||||
Thrust = (Rpm - decay(Rpm, _data.CouplingLambda, dt)) * _data.RotorMass * efficiency;
|
||||
|
||||
var couplingLambda = _data.CouplingLambda * Item.Evaluate(_data.LambdaMultiplier) * max(abs(_axis), Evaluate(_data.PassiveCoupling));
|
||||
var previousRpm = Rpm;
|
||||
Rpm = decay(Rpm, couplingLambda, dt);
|
||||
var rpmLoss = previousRpm - Rpm;
|
||||
var force = rpmLoss * _data.RotorMass * efficiency;
|
||||
|
||||
var heat = rpmLoss * _data.RotorMass * (1 - couplingEfficiency);
|
||||
AddHeat((heat.x + heat.y + heat.z)*ItemManager.GameplaySettings.AetherHeatMultiplier);
|
||||
|
||||
ThrustDirection = forward * (_axis.x * force.x / Entity.Mass) + right * (_axis.y * force.y / Entity.Mass);
|
||||
Entity.Velocity += ThrustDirection;
|
||||
|
||||
Entity.Direction = mul(Entity.Direction,
|
||||
CultMath.float2x2.Rotate(force.z * _axis.z * ItemManager.GameplaySettings.AetherTorqueMultiplier / Entity.Mass));
|
||||
|
||||
if(float.IsNaN(Entity.Velocity.x))
|
||||
ItemManager.Log("FUCK FUCK FUCK FUCK");
|
||||
|
||||
MaximumRpm = Evaluate(_data.MaximumRpm);
|
||||
var torqueProfile = float3(
|
||||
_data.TorqueProfile.Evaluate(Rpm.x / MaximumRpm),
|
||||
_data.TorqueProfile.Evaluate(Rpm.y / MaximumRpm),
|
||||
_data.TorqueProfile.Evaluate(Rpm.z / MaximumRpm));
|
||||
var potentialTorque = Evaluate(_data.Torque) * torqueProfile;
|
||||
var potentialRpmDelta = potentialTorque / length(_data.RotorMass) * dt;
|
||||
var actualRpmDelta = min(MaximumRpm - Rpm, potentialRpmDelta);
|
||||
var torqueRatio = actualRpmDelta / potentialRpmDelta;
|
||||
|
||||
Item.SetAudioParameter(SpecialAudioParameter.Intensity, max(max(abs(_axis.x), abs(_axis.y)), abs(_axis.z)));
|
||||
Item.SetAudioParameter(_data.RpmAudioParameter, (Rpm.x + Rpm.y + Rpm.z) / 3 / MaximumRpm);
|
||||
Item.SetAudioParameter(_data.TorqueRatioAudioParameter, max(max(torqueRatio.x, torqueRatio.y), torqueRatio.z));
|
||||
|
||||
// Cut 7 (docs/stats-and-power-target.md): actualRpmDelta already derives from Evaluate(_data.Torque)
|
||||
// above, so a Torque stat carrying a PowerSupply term already shrinks the rotor's spin-up under a
|
||||
// partial grant -- this no longer demands a full one, only that supply has not been cut to true zero.
|
||||
if (Item.PowerSupply > 1e-4f)
|
||||
{
|
||||
Rpm += actualRpmDelta;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2022c838bbc64a0d86cfbd477e6a379c
|
||||
timeCreated: 1618332827
|
||||
|
|
@ -157,7 +157,7 @@ public interface IPowerConsumer
|
|||
Union(9, typeof(WearData)),
|
||||
Union(10, typeof(VelocityConversionData)),
|
||||
Union(11, typeof(VelocityLimitData)),
|
||||
Union(12, typeof(AetherDriveData)),
|
||||
// Union(12): retired, do not reuse -- was AetherDriveData (retire-longinusx; parked/aether-drive)
|
||||
// Union(14, typeof(TowingControllerData)),
|
||||
Union(15, typeof(CooldownData)),
|
||||
Union(16, typeof(HeatData)),
|
||||
|
|
|
|||
|
|
@ -112,14 +112,10 @@ public abstract class Weapon : Behavior, IActivatedBehavior
|
|||
// so a weapon is never safed against one.
|
||||
public bool StanceAllowsFire => Entity.Target.Value.Entity == null || Entity.IsHostileTo(Entity.Target.Value.Entity);
|
||||
|
||||
// Cut 3 (docs/fire-control-cut.md, Q2): player fire is arc-gated like everyone else's. This is the same
|
||||
// predicate (FireControl.InArc) Combat.cs and TurretController.cs gate AI and turret fire with, read at
|
||||
// the one point every shooter's trigger passes through (InstantWeapon.Trigger) -- not a parallel check, and
|
||||
// not the AI's own AgentMinHitProbability heuristic, which is a "worth it" decision layered above this
|
||||
// gate, not the gate itself. With no target set, behaviour is unchanged (nothing to bear on).
|
||||
// Cut 5, 5.4 (Soul finding 11): the point-blank special case this used to carry moved into InArc itself --
|
||||
// one bearing test, one owner, so every caller (not just this one) gets a point-blank shot that bears.
|
||||
// FireControl owns the gate, including its one exemption: a fused weapon fires out of arc.
|
||||
// The trigger gate for player and AI shooters alike, read at the one point every shooter's trigger passes
|
||||
// through (InstantWeapon.Trigger). A gun fires on its solution (FireControl.Solution) without the aim, else
|
||||
// along the aim when the aim is inside its arc, else it holds. An AI shooter's aim is its intercept, so its
|
||||
// fire is unchanged. FireControl owns the gate, including its exemption: a fused weapon fires out of arc.
|
||||
public bool ArcAllowsFire => FireControl.ArcPermitsFire(this, Entity);
|
||||
|
||||
public Weapon(WeaponData data, EquippedItem item) : base(data, item)
|
||||
|
|
|
|||
|
|
@ -1823,7 +1823,7 @@ public class EquippedItem : IStatContext
|
|||
// RefreshInputCapacitor implementation now calls for a request-field stat, and it pins that stat's own
|
||||
// PowerSupplyFactor to 1 regardless of what Terms the stat declares -- so a direct PowerSupply term on a
|
||||
// request field can no longer make the request depend on its own answer, and the six shipped records this
|
||||
// ruling exists to make legal again (RadiatorData.PumpedHeat, AetherDriveData.Torque) are not an authoring
|
||||
// ruling exists to make legal again (RadiatorData.PumpedHeat) are not an authoring
|
||||
// error to refuse. What is still refused: a request field fed a PowerSupply-tainted value through a
|
||||
// *modifier chain* (StatModifier.ValidateNoPowerSupplyChain, StatModifier.cs) -- EvaluateNominalPower
|
||||
// forwards ScaleModifier/ConstantModifier to the item's real, non-nominal resolver entries (same as
|
||||
|
|
@ -1839,8 +1839,8 @@ public class EquippedItem : IStatContext
|
|||
// Nominal-request ruling (docs/stats-and-power-cut.md, operator ruling 2026-09-19): what this item wants at
|
||||
// full power supply, not what it is currently managing -- the read every PowerRequest/RefreshReserve/
|
||||
// RefreshInputCapacitor implementation uses for a stat named in StatValidation.PowerRequestFields, so a stat
|
||||
// that is both what a request asks for and what it also produces (RadiatorData.PumpedHeat, AetherDriveData.
|
||||
// Torque) stops being circular at the root instead of being forbidden outright. Only PowerSupply is pinned:
|
||||
// that is both what a request asks for and what it also produces (RadiatorData.PumpedHeat)
|
||||
// stops being circular at the root instead of being forbidden outright. Only PowerSupply is pinned:
|
||||
// Heat and Durability are NOT, because they are not the term a request would be circular through -- this
|
||||
// tick's PowerBus.Step (which calls PowerRequest) always runs before this tick's grant exists, so nothing
|
||||
// here could depend on an answer that has not been computed yet, and a hot or worn item honestly asking for
|
||||
|
|
|
|||
|
|
@ -49,8 +49,7 @@ public enum HardpointType
|
|||
Energy,
|
||||
Ballistic,
|
||||
Launcher,
|
||||
ControlModule,
|
||||
AetherDrive
|
||||
ControlModule
|
||||
}
|
||||
|
||||
public enum WeaponType
|
||||
|
|
|
|||
|
|
@ -67,24 +67,18 @@ public static class FireControl
|
|||
return blastRadius > 0f ? data.Fuse : null;
|
||||
}
|
||||
|
||||
// The one arc gate on the trigger. A fused weapon fires whatever the arc says: a target it cannot bear on is
|
||||
// no reason to keep it silent, the round flies along the arc-clamped aim and bursts at the target's range
|
||||
// (Fire; operator ruling 2026-09-30, "the user is hoping that the arc gets the weapon close enough to still
|
||||
// splash some damage"). A weapon that only hits what it fires at still refuses. Fire reads InArc itself to
|
||||
// choose that flight, so the two share the one bearing test and differ only in this exemption.
|
||||
// Mining Cut 3: a chunk target bears through its own position, on the plane the bearing test reads.
|
||||
// The one gate on the trigger (operator rulings fire-on-solutions, controls-solution-trigger, 2026-10-06). A gun
|
||||
// fires on its solution without the aim, else free along the aim if the aim is inside its arc, else it holds.
|
||||
// A fused weapon fires whatever the arc says: a target it cannot bear on is no reason to keep it silent, the
|
||||
// round flies along the arc-clamped aim and bursts at the target's range (Fire; operator ruling 2026-09-30,
|
||||
// "the user is hoping that the arc gets the weapon close enough to still splash some damage"). A mine layer
|
||||
// lays a body, not a round, and is never arc-gated. The price of a free shot at a target that does not bear is
|
||||
// HitProbability's: zero.
|
||||
public static bool ArcPermitsFire(Weapon weapon, Entity shooter)
|
||||
{
|
||||
var target = shooter.Target.Value;
|
||||
if (target.IsNone) return true;
|
||||
float3 toTarget;
|
||||
if (target.Chunk is ChunkId chunk)
|
||||
{
|
||||
var at = shooter.Zone.ChunkPose(chunk.Field, chunk.Index).xy;
|
||||
toTarget = float3(at.x, 0, at.y) - shooter.Position;
|
||||
}
|
||||
else toTarget = target.Entity.Position - shooter.Position;
|
||||
return FuseOf(weapon.Item, out _) != null || IsMineLayer(weapon) || InArc(weapon.Item, toTarget);
|
||||
if (FuseOf(weapon.Item, out _) != null || IsMineLayer(weapon)) return true;
|
||||
var solution = Solution(weapon, shooter, shooter.Target.Value);
|
||||
return solution.Bears || solution.Free;
|
||||
}
|
||||
|
||||
// Whether the shooter's next round from this weapon is refused: the weapons ask before they spend anything, so
|
||||
|
|
@ -131,6 +125,33 @@ public static class FireControl
|
|||
return float2(mount.x * cos(turn) - mount.y * sin(turn), mount.x * sin(turn) + mount.y * cos(turn));
|
||||
}
|
||||
|
||||
// The one owner of a gun's solution against its subject (the designated target; ruling controls-solution-subject).
|
||||
// Bears: the gun can engage the subject, so the player fires on it without the aim. Free: the aim is inside the
|
||||
// arc, so the gun can fire along it. Direction: where a round from this gun travels and where its barrel points --
|
||||
// the subject's intercept when it bears, else the arc-clamped aim. A chunk subject bears through its pose and
|
||||
// flies the aim, as an untargeted round (Subject is null for it). Derived on every read and never stored: turrets
|
||||
// traverse instantly in the simulation. Traverse speed belongs to the link (ruling arc-and-traverse-on-the-link),
|
||||
// which will make this stateful behind the same signature. It never prices; HitProbability is the one price.
|
||||
public static GunSolution Solution(Weapon weapon, Entity shooter, TargetRef subject)
|
||||
{
|
||||
var bears = false;
|
||||
if (subject.Entity != null) bears = Bears(weapon, shooter, subject.Entity, out _);
|
||||
else if (subject.Chunk is ChunkId chunk)
|
||||
{
|
||||
var at = shooter.Zone.ChunkPose(chunk.Field, chunk.Index).xy;
|
||||
bears = InArc(weapon.Item, float3(at.x, 0, at.y) - shooter.Position);
|
||||
}
|
||||
return new GunSolution
|
||||
{
|
||||
Subject = subject.Entity,
|
||||
Bears = bears,
|
||||
Free = InArc(weapon.Item, shooter.Aim),
|
||||
Direction = bears && subject.Entity != null
|
||||
? TravelDirection(weapon, shooter, subject.Entity)
|
||||
: AimDirection(weapon.Item, shooter)
|
||||
};
|
||||
}
|
||||
|
||||
// Cut 2, R5: whether `observer` has resolved `item` (which must belong to some entity in the zone) well
|
||||
// enough to aim at it. Derived fresh from EntityInfoGathered on every call -- nothing caches a reveal
|
||||
// result, so decay drops it the moment info falls back below tier, with no clearing loop anywhere.
|
||||
|
|
@ -276,21 +297,26 @@ public static class FireControl
|
|||
!(weapon is LockWeapon lockWeapon && !lockWeapon.IsLocked);
|
||||
}
|
||||
|
||||
// `designated` is the answer above. `inArc` is the bearing test, asked only once a target is designated.
|
||||
// Whether this gun can engage this target: designated and inside the arc. The one test of it; PFire prices a shot
|
||||
// at zero unless it holds, and Solution reads it to decide whether the gun fires on the target. `designated` is
|
||||
// the answer above, kept apart for Solve's burst flight: a designated target out of arc still sets the burst range.
|
||||
public static bool Bears(Weapon weapon, Entity source, Entity target, out float range) =>
|
||||
Bears(weapon, source, target, out range, out _);
|
||||
|
||||
private static bool Bears(Weapon weapon, Entity source, Entity target, out float range, out bool designated)
|
||||
{
|
||||
designated = Designated(weapon, source, target, out range);
|
||||
return designated && InArc(weapon.Item, target.Position - source.Position);
|
||||
}
|
||||
|
||||
// `designated` is the answer above. `inArc` is Bears, asked only once a target is designated.
|
||||
// PFire prices a shot at zero unless both hold. Fire reads them to decide what a fused round flies at
|
||||
// (operator rulings 2026-09-30): without valid data it has no target and bursts at max range; with data but
|
||||
// out of arc it bursts at the target's range, along the aim. The HUD reads Designated and the
|
||||
// arc from Solve and Inspect and decides nothing.
|
||||
private static float PFire(Weapon weapon, Entity source, Entity target, out float range, out bool designated, out bool inArc)
|
||||
{
|
||||
range = 0f;
|
||||
designated = false;
|
||||
inArc = false;
|
||||
if (target == null) return 0f;
|
||||
|
||||
designated = Designated(weapon, source, target, out range);
|
||||
if (!designated) return 0f;
|
||||
inArc = InArc(weapon.Item, target.Position - source.Position);
|
||||
inArc = Bears(weapon, source, target, out range, out designated);
|
||||
if (!inArc) return 0f;
|
||||
|
||||
var settings = source.ItemManager.GameplaySettings;
|
||||
|
|
@ -615,7 +641,7 @@ public static class FireControl
|
|||
// burst's later rounds and a power-starved Range included).
|
||||
var engaged = fuse != null && !(designated && inArc) ? null : target;
|
||||
var origin = source.Position;
|
||||
var travelDirection = engaged != null ? TravelDirection(weapon, source, engaged) : AimDirection(item, source);
|
||||
var travelDirection = Solution(weapon, source, target).Direction;
|
||||
|
||||
var arming = fuse != null ? blastRadius : 0f;
|
||||
var burstPosition = engaged != null ? engaged.Position : origin;
|
||||
|
|
@ -1989,6 +2015,16 @@ public enum FireOutcome
|
|||
Refused
|
||||
}
|
||||
|
||||
// A gun's solution against its subject (FireControl.Solution): whether the gun bears on the subject, whether the
|
||||
// aim is free (inside the arc), and the direction a round from it travels.
|
||||
public struct GunSolution
|
||||
{
|
||||
public Entity Subject;
|
||||
public bool Bears;
|
||||
public bool Free;
|
||||
public float2 Direction;
|
||||
}
|
||||
|
||||
// Solve's answer. Outcome and BurstReach (planar distance from the shooter to the burst point, read for Burst
|
||||
// only) are what the HUD shows; the rest is what Fire freezes into the PendingShot.
|
||||
public struct FireSolution
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ public class Galaxy
|
|||
// restored from a save.
|
||||
public uint Seed { get; }
|
||||
|
||||
private HashSet<CultRecordKey> _containedFactions;
|
||||
private GalaxyZone[] _exitPath;
|
||||
private Dictionary<Faction, MarkovNameGenerator> _nameGenerators = new Dictionary<Faction, MarkovNameGenerator>();
|
||||
private readonly CultCache _cache;
|
||||
|
|
@ -450,12 +449,6 @@ public class Galaxy
|
|||
}
|
||||
}
|
||||
|
||||
public bool ContainsFaction(CultRecordRef<Faction> faction)
|
||||
{
|
||||
_containedFactions ??= new HashSet<CultRecordKey>(Factions.Select(f => _cache.RefOf(f).Key));
|
||||
return _containedFactions.Contains(faction.Key);
|
||||
}
|
||||
|
||||
class DijkstraVertex
|
||||
{
|
||||
public float Cost;
|
||||
|
|
|
|||
|
|
@ -855,8 +855,7 @@ public static class StatValidation
|
|||
//
|
||||
// F6 (docs/stats-and-power-cut.md, Soul pass 2026-09-19) named every field a PowerRequest implementation
|
||||
// actually reads, not just each consumer's top-level request field: Radiator.PowerRequest also reads
|
||||
// PumpedHeat and WasteHeat, AetherDrive.PowerRequest also reads Torque, LambdaMultiplier, MaximumRpm and
|
||||
// PassiveCoupling, Shield.PowerRequest (via RefreshReserve) also reads RefillDuration and RestoreDuration,
|
||||
// PumpedHeat and WasteHeat, Shield.PowerRequest (via RefreshReserve) also reads RefillDuration and RestoreDuration,
|
||||
// InstantWeapon.PowerRequest (via RefreshInputCapacitor) also reads Cooldown and Count, and Sensor.
|
||||
// PowerRequest (via RefreshInputCapacitor) also reads PingCooldown. Audited directly against each
|
||||
// PowerRequest method's own body (and RefreshReserve/RefreshInputCapacitor, which PowerRequest calls into)
|
||||
|
|
@ -892,11 +891,6 @@ public static class StatValidation
|
|||
(typeof(RadiatorData), nameof(RadiatorData.EnergyUsage)),
|
||||
(typeof(RadiatorData), nameof(RadiatorData.PumpedHeat)),
|
||||
(typeof(RadiatorData), nameof(RadiatorData.WasteHeat)),
|
||||
(typeof(AetherDriveData), nameof(AetherDriveData.EnergyDraw)),
|
||||
(typeof(AetherDriveData), nameof(AetherDriveData.Torque)),
|
||||
(typeof(AetherDriveData), nameof(AetherDriveData.LambdaMultiplier)),
|
||||
(typeof(AetherDriveData), nameof(AetherDriveData.MaximumRpm)),
|
||||
(typeof(AetherDriveData), nameof(AetherDriveData.PassiveCoupling)),
|
||||
};
|
||||
|
||||
// Whether `stat` is the request stat of some IPowerConsumer behaviour on `data` -- used by StatModifier's
|
||||
|
|
|
|||
|
|
@ -198,30 +198,34 @@ public class LoadoutGenerator
|
|||
// Hardpoint gear that no hull in the catalog can mount has no home (operator, 2026-09-30: "we'll need to author a
|
||||
// bunch more hulls before all the gear variety in the game has a home"): generation never offers it, so no station
|
||||
// stocks it. It gains one the moment a hull with a hardpoint that takes it exists. Tool gear goes in any interior.
|
||||
private static bool HasHome(EquippableItemData design, HullData[] hulls) =>
|
||||
public static bool HasHome(EquippableItemData design, HullData[] hulls) =>
|
||||
design.HardpointType == HardpointType.Tool || design.HardpointType == HardpointType.Hull ||
|
||||
hulls.Any(hull => hull.Hardpoints.Any(hardpoint => hardpoint.Takes(design)));
|
||||
|
||||
// No galaxy means no availability to filter by: every product is on offer. A fixture generates loadouts that
|
||||
// way, so a test can exercise placement and products without standing up a whole galaxy; no game path does.
|
||||
// Loadouts.Materialize takes availability as a predicate; RunStart, the game's one preset spawner, passes this, so
|
||||
// presets and generation share one availability rule. In a galaxy, a faction always reaches its own manufacturer's
|
||||
// gear, and otherwise gear made by a manufacturer in that galaxy that its allegiance names (operator, 2026-09-30:
|
||||
// allegiance lists only other factions).
|
||||
// No galaxy, or no faction, means no allegiance to filter by: every product is on offer. A fixture generates
|
||||
// loadouts that way, so a test can exercise placement and products without standing up a whole galaxy; a scenario
|
||||
// stage has no faction and reaches every maker. Loadouts.Materialize takes availability as a predicate; RunStart,
|
||||
// the game's one preset spawner, passes this, so presets and generation share one availability rule. A faction
|
||||
// always reaches its own manufacturer's gear, and otherwise gear made by a manufacturer its allegiance names
|
||||
// (operator, 2026-09-30: allegiance lists only other factions). Whether that manufacturer is present in the galaxy
|
||||
// does not matter (operator, 2026-10-06: a faction need not be present for its gear to be available).
|
||||
public bool IsAvailable(FactionProductData product) =>
|
||||
Galaxy == null || Galaxy.IsPrelude ||
|
||||
Faction != null && ItemManager.ItemData.Get(product.Manufacturer) == Faction ||
|
||||
Galaxy.ContainsFaction(product.Manufacturer) && (Faction == null || Faction.Allegiance.ContainsKey(product.Manufacturer));
|
||||
Galaxy == null || Faction == null ||
|
||||
ItemManager.ItemData.Get(product.Manufacturer) == Faction || Faction.Allegiance.ContainsKey(product.Manufacturer);
|
||||
|
||||
// Prioritize products from the zone faction and its allies, penalizing distance to the manufacturer's headquarters
|
||||
private float ManufacturerPreference(CultRecordRef<Faction> manufacturer)
|
||||
// Prioritize products from the zone faction and its allies, penalizing distance to the manufacturer's headquarters.
|
||||
// A manufacturer with no home zone in this galaxy weighs as if its headquarters lay one jump beyond the farthest
|
||||
// zone this zone reaches: reachable through allegiance, least preferred.
|
||||
public float ManufacturerPreference(CultRecordRef<Faction> manufacturer)
|
||||
{
|
||||
if (Faction == null || Galaxy == null) return 1;
|
||||
var maker = ItemManager.ItemData.Get(manufacturer);
|
||||
var allegiance = maker == Faction ? 1 :
|
||||
Faction.Allegiance.TryGetValue(manufacturer, out var a) ? a : 0;
|
||||
var home = maker != null && Galaxy.HomeZones.TryGetValue(maker, out var h) ? h : null;
|
||||
var distance = home != null && Zone?.Distance != null && Zone.Distance.TryGetValue(home, out var d) ? d : 0;
|
||||
var distance = Zone?.Distance == null ? 0 :
|
||||
home != null && Zone.Distance.TryGetValue(home, out var d) ? d :
|
||||
home == null && Zone.Distance.Count > 0 ? Zone.Distance.Values.Max() + 1 : 0;
|
||||
return allegiance / (1 + distance);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
// every other item on the hull (EquippedItem.UpdatePerformance). Feed it first or lose the rest anyway.
|
||||
// - High: Shield. Hull survival the player is actively trading power for; not a life-support constant, so it
|
||||
// sits below Radiator rather than beside it.
|
||||
// - Medium: Thruster, AetherDrive. Mobility -- needed to hold position, evade, or disengage, but a ship that
|
||||
// - Medium: Thruster. Mobility -- needed to hold position, evade, or disengage, but a ship that
|
||||
// loses thrust for a tick under brownout is inconvenienced, not dead the way an overheating hull is.
|
||||
// - Low: ConstantWeapon, InstantWeapon. Offense. The ruling's own framing ("low-priority subsystems starve
|
||||
// first") names weapons as the default example of what a reactor throttle should sacrifice first.
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ using static ItemRotation;
|
|||
public sealed class Arcs : Scenario
|
||||
{
|
||||
public override string Name => "Arcs";
|
||||
public override string Brief => "Forward mounts, a bare hull off the bow, one off the stern, a hostile turret. Verify: the bow " +
|
||||
"hull can be hit, nothing fires at the stern one through the ship, the turret tracks you all the way round.";
|
||||
public override string Brief => "Forward mounts, a bare hull off the bow, one off the stern, a hostile turret. Verify: the hull keeps its " +
|
||||
"heading while you aim at the stern hull, and the forward guns hold. Designate the bow hull and fire with the " +
|
||||
"aim anywhere: the forward guns fire on it and hit. The turret tracks you all the way round.";
|
||||
public override uint Seed => 103;
|
||||
public override bool Ambient => false;
|
||||
|
||||
|
|
@ -16,18 +17,21 @@ public sealed class Arcs : Scenario
|
|||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
var fighter = stage.Fit("LonginusX",
|
||||
var fighter = stage.Fit("Longinus",
|
||||
("Cockpit 2x2", int2(2, 6), None),
|
||||
("Traction", int2(2, 3), None),
|
||||
("Core Power", int2(2, 1), None),
|
||||
("Large Drive", int2(1, 0), Reversed),
|
||||
("Large Drive", int2(3, 0), Reversed),
|
||||
("Talaria", int2(2, 14), CounterClockwise),
|
||||
("Talaria", int2(3, 14), Clockwise),
|
||||
("Core Power", int2(2, 4), None),
|
||||
("GT 3K", int2(0, 5), None),
|
||||
("GT 3K", int2(5, 5), None),
|
||||
("FastBlast+-", int2(1, 8), None),
|
||||
("FastBlast+-", int2(4, 8), None),
|
||||
("Iapyx", int2(1, 2), CounterClockwise),
|
||||
("Iapyx", int2(4, 2), Clockwise),
|
||||
("Iapyx", int2(2, 2), CounterClockwise),
|
||||
("Iapyx", int2(3, 2), Clockwise),
|
||||
("not if i see you first", int2(3, 10), None),
|
||||
("Fire Control Array", int2(2, 5), None));
|
||||
("Fire Control Array", int2(1, 6), Clockwise));
|
||||
var turret = stage.Fit("Turret",
|
||||
("ClearPath", int2(1, 2), None),
|
||||
("ClearPath", int2(5, 2), None),
|
||||
|
|
@ -39,8 +43,8 @@ public sealed class Arcs : Scenario
|
|||
("Fire Control Array", int2(3, 6), None));
|
||||
|
||||
stage.Player(fighter, float2(0, 0), facing: float2(0, 1));
|
||||
stage.Place(stage.Bare("LonginusX"), Bow);
|
||||
stage.Place(stage.Bare("LonginusX"), Stern);
|
||||
stage.Place(stage.Bare("Longinus"), Bow);
|
||||
stage.Place(stage.Bare("Longinus"), Stern);
|
||||
stage.Place(turret, Turret, stance: ScenarioStance.Hostile);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using static ItemRotation;
|
|||
public sealed class Duel : Scenario
|
||||
{
|
||||
public override string Name => "Duel";
|
||||
public override string Brief => "One piloted, hostile LonginusX with slow GT 3K missiles and a Spectra in its hold. Verify: rolled " +
|
||||
public override string Brief => "One piloted, hostile Longinus with slow GT 3K missiles and a Spectra in its hold. Verify: rolled " +
|
||||
"hits and near-misses, subsystem aim, beam reads above bow, armour takes the missile, loot keeps its brand.";
|
||||
public override uint Seed => 104;
|
||||
public override bool Ambient => false;
|
||||
|
|
@ -13,19 +13,22 @@ public sealed class Duel : Scenario
|
|||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
var fighter = stage.Fit("LonginusX",
|
||||
var fighter = stage.Fit("Longinus",
|
||||
("Cockpit 2x2", int2(2, 6), None),
|
||||
("Traction", int2(2, 3), None),
|
||||
("Core Power", int2(2, 1), None),
|
||||
("Large Drive", int2(1, 0), Reversed),
|
||||
("Large Drive", int2(3, 0), Reversed),
|
||||
("Talaria", int2(2, 14), CounterClockwise),
|
||||
("Talaria", int2(3, 14), Clockwise),
|
||||
("Core Power", int2(2, 4), None),
|
||||
("GT 3K", int2(0, 5), None),
|
||||
("GT 3K", int2(5, 5), None),
|
||||
("FastBlast+-", int2(1, 8), None),
|
||||
("FastBlast+-", int2(4, 8), None),
|
||||
("Iapyx", int2(1, 2), CounterClockwise),
|
||||
("Iapyx", int2(4, 2), Clockwise),
|
||||
("Iapyx", int2(2, 2), CounterClockwise),
|
||||
("Iapyx", int2(3, 2), Clockwise),
|
||||
("not if i see you first", int2(3, 10), None),
|
||||
("PotaT+-", int2(1, 5), None),
|
||||
("Fire Control Array", int2(2, 5), None),
|
||||
("Fire Control Array", int2(1, 6), Clockwise),
|
||||
("Store-All Plus", int2(2, 8), None));
|
||||
|
||||
stage.Player(fighter, float2(0, 0));
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using static ItemRotation;
|
|||
public sealed class LauncherAngles : Scenario
|
||||
{
|
||||
public override string Name => "Launcher Angles";
|
||||
public override string Brief => "A GT 3K, a pswarm and two FastBlasts; a hostile LonginusX broadside on, a bare Longinus beside it. " +
|
||||
public override string Brief => "A GT 3K, a pswarm and two FastBlasts; a hostile bare Longinus broadside on, another beside it. " +
|
||||
"Verify: hits pulse only the facing edge; a pswarm round whose target dies fades unexploded.";
|
||||
public override uint Seed => 105;
|
||||
public override bool Ambient => false;
|
||||
|
|
@ -13,21 +13,24 @@ public sealed class LauncherAngles : Scenario
|
|||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
var launcher = stage.Fit("LonginusX",
|
||||
var launcher = stage.Fit("Longinus",
|
||||
("Cockpit 2x2", int2(2, 6), None),
|
||||
("Traction", int2(2, 3), None),
|
||||
("Core Power", int2(2, 1), None),
|
||||
("Large Drive", int2(1, 0), Reversed),
|
||||
("Large Drive", int2(3, 0), Reversed),
|
||||
("Talaria", int2(2, 14), CounterClockwise),
|
||||
("Talaria", int2(3, 14), Clockwise),
|
||||
("Core Power", int2(2, 4), None),
|
||||
("GT 3K", int2(0, 5), None),
|
||||
("pswarm", int2(5, 5), None),
|
||||
("FastBlast+-", int2(1, 8), None),
|
||||
("FastBlast+-", int2(4, 8), None),
|
||||
("Iapyx", int2(1, 2), CounterClockwise),
|
||||
("Iapyx", int2(4, 2), Clockwise),
|
||||
("Iapyx", int2(2, 2), CounterClockwise),
|
||||
("Iapyx", int2(3, 2), Clockwise),
|
||||
("not if i see you first", int2(3, 10), None),
|
||||
("Fire Control Array", int2(2, 5), None));
|
||||
("Fire Control Array", int2(1, 6), Clockwise));
|
||||
|
||||
stage.Player(launcher, float2(0, 0));
|
||||
stage.Place(stage.Bare("LonginusX"), float2(0, 900), facing: float2(1, 0), stance: ScenarioStance.Hostile);
|
||||
stage.Place(stage.Bare("Longinus"), float2(0, 900), facing: float2(1, 0), stance: ScenarioStance.Hostile);
|
||||
stage.Place(stage.Bare("Longinus"), float2(300, 700));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,17 +13,20 @@ public sealed class StarvedReactor : Scenario
|
|||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
var starved = stage.Fit("LonginusX",
|
||||
var starved = stage.Fit("Longinus",
|
||||
("Cockpit 2x2", int2(2, 6), None),
|
||||
("Traction", int2(2, 3), None),
|
||||
("MoveOnPro", int2(2, 1), None),
|
||||
("Large Drive", int2(1, 0), Reversed),
|
||||
("Large Drive", int2(3, 0), Reversed),
|
||||
("Talaria", int2(2, 14), CounterClockwise),
|
||||
("Talaria", int2(3, 14), Clockwise),
|
||||
("MoveOnPro", int2(2, 4), None),
|
||||
("Spectra", int2(1, 8), None),
|
||||
("Spectra", int2(4, 8), None),
|
||||
("Iapyx", int2(1, 2), CounterClockwise),
|
||||
("Iapyx", int2(4, 2), Clockwise),
|
||||
("Iapyx", int2(2, 2), CounterClockwise),
|
||||
("Iapyx", int2(3, 2), Clockwise),
|
||||
("not if i see you first", int2(3, 10), None),
|
||||
("Fire Control Array", int2(2, 5), None));
|
||||
("Fire Control Array", int2(1, 6), Clockwise));
|
||||
stage.Player(starved, float2(0, 0));
|
||||
stage.Place(stage.Bare("LonginusX"), float2(0, 400));
|
||||
stage.Place(stage.Bare("Longinus"), float2(0, 400));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,8 +213,6 @@ public class GameplaySettings
|
|||
public ExponentialLerp LockSpinSpeed;
|
||||
public float TorqueFloor;
|
||||
public float TorqueMultiplier;
|
||||
public float AetherTorqueMultiplier;
|
||||
public float AetherHeatMultiplier;
|
||||
public float VisibilityDecay;
|
||||
public float TargetInfoDecay;
|
||||
public float TargetDetectionInfoThreshold;
|
||||
|
|
@ -240,7 +238,7 @@ public class GameplaySettings
|
|||
// UnaidedTracking above -- FireControl.Precision falls back to this the same way it already falls back to
|
||||
// UnaidedAccuracy/UnaidedTracking. Precision is now a grouping tightness (FireControl.Sigma = 1/Precision,
|
||||
// in hull-schematic cell units), not the old coin-flip probability, so the unaided floor has to be
|
||||
// authored on that scale. .3 -> sigma 3.33 cells: against the live catalog's own hulls (LonginusX 6x17,
|
||||
// authored on that scale. .3 -> sigma 3.33 cells: against the live catalog's own hulls (Longinus 6x17,
|
||||
// Zenith 12x12, Turret 8x8) that puts pOnHull at the hull's own centre of mass around .5-.84 -- broadly
|
||||
// sprayed across the whole silhouette (sigma is a large fraction of the hull's own width) while still
|
||||
// landing on the ship more often than not. A tighter floor (e.g. .1, sigma 10) was tried first and
|
||||
|
|
|
|||
|
|
@ -38,8 +38,6 @@ public class Ship : Entity
|
|||
private HashSet<Thruster> _leftThrusters;
|
||||
private HashSet<Thruster> _clockwiseThrusters;
|
||||
private HashSet<Thruster> _counterClockwiseThrusters;
|
||||
private HashSet<EquippedItem> _aetherDriveItems;
|
||||
private HashSet<AetherDrive> _aetherDrives;
|
||||
|
||||
private bool _exitingWormhole = false;
|
||||
private bool _enteringWormhole = false;
|
||||
|
|
@ -96,9 +94,6 @@ public class Ship : Entity
|
|||
{
|
||||
base.Activate();
|
||||
|
||||
_aetherDrives = new HashSet<AetherDrive>(GetBehaviors<AetherDrive>());
|
||||
_aetherDriveItems = new HashSet<EquippedItem>(_aetherDrives.Select(x => x.Item));
|
||||
|
||||
_allThrusters = GetBehaviors<Thruster>().ToArray();
|
||||
_thrusterItems = new HashSet<EquippedItem>(_allThrusters.Select(x=>x.Item));
|
||||
|
||||
|
|
@ -124,13 +119,6 @@ public class Ship : Entity
|
|||
public Ship(ItemManager itemManager, Zone zone, EquippableItem hull, EntitySettings settings) : base(itemManager, zone, hull, settings)
|
||||
{
|
||||
ItemDestroyed.Where(item=>_thrusterItems.Contains(item)).Subscribe(RemoveThruster);
|
||||
ItemDestroyed.Where(item=>_aetherDriveItems.Contains(item)).Subscribe(RemoveAetherDrive);
|
||||
}
|
||||
|
||||
private void RemoveAetherDrive(EquippedItem item)
|
||||
{
|
||||
_aetherDriveItems.Remove(item);
|
||||
_aetherDrives.Remove(item.GetBehavior<AetherDrive>());
|
||||
}
|
||||
|
||||
private void RemoveThruster(EquippedItem item)
|
||||
|
|
@ -176,10 +164,6 @@ public class Ship : Entity
|
|||
foreach (var thruster in _forwardThrusters)
|
||||
if (thruster.Item.Active.Value)
|
||||
ForwardThrust += thruster.Thrust;
|
||||
|
||||
foreach (var drive in _aetherDrives)
|
||||
if (drive.Item.Active.Value)
|
||||
ForwardThrust += drive.Thrust.x;
|
||||
}
|
||||
|
||||
private void RecalculateReverseThrust()
|
||||
|
|
@ -188,10 +172,6 @@ public class Ship : Entity
|
|||
foreach (var thruster in _reverseThrusters)
|
||||
if (thruster.Item.Active.Value)
|
||||
ReverseThrust += thruster.Thrust;
|
||||
|
||||
foreach (var drive in _aetherDrives)
|
||||
if (drive.Item.Active.Value)
|
||||
ReverseThrust += drive.Thrust.x;
|
||||
}
|
||||
|
||||
private void RecalculateLeftStrafeThrust()
|
||||
|
|
@ -210,10 +190,6 @@ public class Ship : Entity
|
|||
foreach(var thruster in _leftThrusters)
|
||||
if (abs(sign(thruster.Torque) - sign(LeftStrafeTotalTorque)) < .01f)
|
||||
LeftStrafeTorqueThrusters.Add(thruster);
|
||||
|
||||
foreach (var drive in _aetherDrives)
|
||||
if (drive.Item.Active.Value)
|
||||
LeftStrafeThrust += drive.Thrust.y;
|
||||
}
|
||||
|
||||
private void RecalculateRightStrafeThrust()
|
||||
|
|
@ -232,10 +208,6 @@ public class Ship : Entity
|
|||
foreach(var thruster in _rightThrusters)
|
||||
if (abs(sign(thruster.Torque) - sign(RightStrafeTotalTorque)) < .01f)
|
||||
RightStrafeTorqueThrusters.Add(thruster);
|
||||
|
||||
foreach (var drive in _aetherDrives)
|
||||
if (drive.Item.Active.Value)
|
||||
RightStrafeThrust += drive.Thrust.y;
|
||||
}
|
||||
|
||||
private void RecalculateClockwiseTorque()
|
||||
|
|
@ -244,10 +216,6 @@ public class Ship : Entity
|
|||
foreach (var thruster in _clockwiseThrusters)
|
||||
if (thruster.Item.Active.Value)
|
||||
ClockwiseTorque += thruster.Torque;
|
||||
|
||||
foreach (var drive in _aetherDrives)
|
||||
if (drive.Item.Active.Value)
|
||||
ClockwiseTorque += drive.Thrust.z;
|
||||
}
|
||||
|
||||
private void RecalculateCounterClockwiseTorque()
|
||||
|
|
@ -256,10 +224,6 @@ public class Ship : Entity
|
|||
foreach (var thruster in _counterClockwiseThrusters)
|
||||
if (thruster.Item.Active.Value)
|
||||
CounterClockwiseTorque -= thruster.Torque;
|
||||
|
||||
foreach (var drive in _aetherDrives)
|
||||
if (drive.Item.Active.Value)
|
||||
CounterClockwiseTorque += drive.Thrust.z;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -293,9 +257,6 @@ public class Ship : Entity
|
|||
|
||||
foreach (var thruster in _clockwiseThrusters) thruster.Axis += Turn;
|
||||
foreach (var thruster in _counterClockwiseThrusters) thruster.Axis += -Turn;
|
||||
|
||||
foreach (var drive in _aetherDrives)
|
||||
drive.Axis = float3(MovementDirection.y, MovementDirection.x, Turn);
|
||||
}
|
||||
|
||||
var velocityMagnitude = length(Velocity);
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ public class SchematicDisplay : MonoBehaviour
|
|||
public GameObject ShieldIcon;
|
||||
public Image HeatsinkBackground;
|
||||
|
||||
public GameObject AetherDriveUi;
|
||||
|
||||
public TextMeshProUGUI EnergyLabel;
|
||||
public TextMeshProUGUI CockpitTemperatureLabel;
|
||||
public TextMeshProUGUI RadiatorTemperatureLabel;
|
||||
|
|
@ -32,9 +30,6 @@ public class SchematicDisplay : MonoBehaviour
|
|||
public TextMeshProUGUI VisibilityLabel;
|
||||
public TextMeshProUGUI HullDurabilityLabel;
|
||||
public TextMeshProUGUI DistanceLabel;
|
||||
public TextMeshProUGUI ForwardRPMLabel;
|
||||
public TextMeshProUGUI StrafeRPMLabel;
|
||||
public TextMeshProUGUI TurnRPMLabel;
|
||||
|
||||
public RectTransform SensorCooldownFill;
|
||||
public RectTransform EnergyFill;
|
||||
|
|
@ -42,9 +37,6 @@ public class SchematicDisplay : MonoBehaviour
|
|||
public RectTransform HeatstrokeMeterFill;
|
||||
public RectTransform HypothermiaMeterFill;
|
||||
public RectTransform HeatstrokeLimitFill;
|
||||
public RectTransform ForwardRPMFill;
|
||||
public RectTransform StrafeRPMFill;
|
||||
public RectTransform TurnRPMFill;
|
||||
|
||||
private Entity _entity;
|
||||
private EquippableItem _hull;
|
||||
|
|
@ -55,7 +47,6 @@ public class SchematicDisplay : MonoBehaviour
|
|||
private HeatStorage[] _heatStorages;
|
||||
private EquippedCargoBay[] _cargoBays;
|
||||
private SchematicDisplayItem[] _schematicItems;
|
||||
private AetherDrive _aetherDrive;
|
||||
|
||||
private bool _enemy;
|
||||
private Entity _player;
|
||||
|
|
@ -90,8 +81,6 @@ public class SchematicDisplay : MonoBehaviour
|
|||
_cockpit = entity.GetBehavior<Cockpit>();
|
||||
_reactor = entity.GetBehavior<Reactor>();
|
||||
_capacitors = entity.GetBehaviors<Capacitor>().ToArray();
|
||||
_aetherDrive = entity.GetBehavior<AetherDrive>();
|
||||
AetherDriveUi.SetActive(_aetherDrive != null);
|
||||
|
||||
_radiators = entity.GetBehaviors<Radiator>().ToArray();
|
||||
if (_radiators.Length == 0)
|
||||
|
|
@ -186,18 +175,6 @@ public class SchematicDisplay : MonoBehaviour
|
|||
EnergyFill.anchorMax = new Vector2(charge / maxCharge, 1);
|
||||
EnergyLabel.text = $"{((int)charge).ToString()}/{((int)maxCharge).ToString()} + ({((int)_reactor.Draw).ToString()})";
|
||||
}
|
||||
|
||||
if (_aetherDrive != null)
|
||||
{
|
||||
ForwardRPMLabel.text = ActionGameManager.PlayerSettings.Format(_aetherDrive.Rpm.x);
|
||||
ForwardRPMFill.anchorMax = new Vector2(_aetherDrive.Rpm.x / _aetherDrive.MaximumRpm, 1);
|
||||
|
||||
StrafeRPMLabel.text = ActionGameManager.PlayerSettings.Format(_aetherDrive.Rpm.y);
|
||||
StrafeRPMFill.anchorMax = new Vector2(_aetherDrive.Rpm.y / _aetherDrive.MaximumRpm, 1);
|
||||
|
||||
TurnRPMLabel.text = ActionGameManager.PlayerSettings.Format(_aetherDrive.Rpm.z);
|
||||
TurnRPMFill.anchorMax = new Vector2(_aetherDrive.Rpm.z / _aetherDrive.MaximumRpm, 1);
|
||||
}
|
||||
}
|
||||
// else
|
||||
// {
|
||||
|
|
|
|||
BIN
GameData/Aetheria.cc
(Stored with Git LFS)
BIN
GameData/Aetheria.cc
(Stored with Git LFS)
Binary file not shown.
|
|
@ -6191,3 +6191,300 @@ reverse. One coverage test makes "triggered by" and "harmed by" the same disc.
|
|||
**Why no targeting provider or point defense against mines.** The old mine was neither
|
||||
detectable nor shootable, and ruling `pd-who-engages` prices munitions, which a mine is not.
|
||||
Detection of floating bodies stays with follow-up `bodies-detection`.
|
||||
|
||||
## Catalog breadth: the weapon matrix, roles backfill and stat-boosting gear
|
||||
|
||||
Pass: Imagination `imagination-catalog-breadth`, session `self-2026-10-08b`. Self merges this into
|
||||
`docs/aetheria-release-map.md`; nothing here is committed. Body: `GameCult/Aetheria` origin/master
|
||||
`a8f71d463bf1160de0b5f23caa56dc7957252345` (fetched 2026-10-08), detached worktree in the session
|
||||
scratchpad, removed at the end. Rulings applied: `catalog-breadth-weapons-gear-consumables`,
|
||||
`catalog-grows-generic-designs-branded-products`, `tech-lineage-per-component-role`,
|
||||
`weapon-tracking-authored`, `plight-not-one-cell`, `plight-shape`. Operator, 2026-10-08, relayed by
|
||||
Self: "All this comes with roles and components too, right?" (not yet admitted as a ruling; Self
|
||||
should admit it so specs can cite it by id).
|
||||
|
||||
Part (c), consumables, is not mapped here. The component-role rule (CB-R1) and the stacking rule
|
||||
(question `boost-stacking`) are written so that pass reuses them unchanged.
|
||||
|
||||
### Body facts
|
||||
|
||||
Decode method: `cultcache_py` `SingleFileMessagePackBackingStore.pull_all()` over
|
||||
`GameData/Aetheria.cc` at a8f71d46 (LFS pulled into the worktree), payloads `msgpack.unpackb`ed and
|
||||
read by MessagePack key. Scratch scripts `cat.py`, `wm.py`, `stats.py`, not committed.
|
||||
|
||||
- **CB1. Census at a8f71d46.** 74 FactionProductData, 51 CompoundCommodityData, 31 GearData,
|
||||
22 WeaponItemData, 13 SimpleCommodityData, 12 Faction, 12 NameFile, 4 CargoBayData, 4 HullData,
|
||||
3 PersonalityAttribute, 1 FieldKindData, 1 DockingBayData, 1 InputLayout. pd-gear and the Mine
|
||||
Launcher are on master; the Pirates (pirates-record 8e51016f), lot-product (ec081b9b),
|
||||
generic-design-names, product-lines-weapons, maker-only-faction (5dce222b), mods-in-tree
|
||||
(cc83f5ad) and faction-play-1 (b3d1e929) are not. Design names are still the branded ones.
|
||||
- **CB2. The catalog already has a category axis and a size axis on weapons** (source read
|
||||
`ItemData.cs:477-487`, `Enums.cs:55-83`). `WeaponItemData.WeaponType` (key 26: ElectromagneticallyPropelled,
|
||||
ExplosivelyPropelled, Laser, Electrostatic, ParticleProjection, Missile, MicroMissile, SplitMissile,
|
||||
Mine, Jet) and `WeaponCaliber` (key 25: Small, Medium, Large, ExtraLarge). The operator's vault note
|
||||
`AetheriaLore Aetheria/Worldbuilding/Post-Elysium/Reference/Weapon Category Codes.md` (33cd06a)
|
||||
defines the same taxonomy: caliber S/M/L/XL, weapon types EMPS, XPS, L, PL, ESD, PPC, launchers
|
||||
M, MM, MIRV with guidance D/G/S. The enum lacks PL (pulse laser) and adds Mine and Jet. The only
|
||||
code readers are the action-bar icon (`Gameplay/ActionBarSlot.cs:154`, `GameSettings.cs:52-54`).
|
||||
- **CB3. The matrix at a8f71d46** (type x authored caliber, with cell footprint):
|
||||
|
||||
| Type | Small | Medium | Large | ExtraLarge |
|
||||
|---|---|---|---|---|
|
||||
| XPS (Ballistic) | ClearPath 2, Earp 2, 6k Shooter 2, PD Gun 1 | Autocannon 4, DeathCluster 4, pretty pretty bang bang 4, Flak Gun 2 | - | - |
|
||||
| EMPS | - | - | - | - |
|
||||
| Laser (Energy) | Spectra 2, ColdFire 2, PD Laser 1, CShot RainbowLite Lazer 9 | - | - | - |
|
||||
| ESD (Energy) | - | - | plight 2 | - |
|
||||
| PPC (Energy) | FastBlast+- 2 | ChargeBlast+- 4, ChargeBlast SG 4 | - | - |
|
||||
| Missile (Launcher) | - | GT 3K 3 | - | - |
|
||||
| MicroMissile (Launcher) | - | scorched void policy 3, pswarm 1 | LRMM72 6 | SRMM72 6 |
|
||||
| SplitMissile | - | - | - | - |
|
||||
| Mine (Launcher) | - | Mine Launcher 1 | - | - |
|
||||
| Jet | - | - | - | - |
|
||||
|
||||
Caliber and footprint disagree in six designs: CShot (Small, 9 cells), plight (Large, 2),
|
||||
pswarm (Medium, 1), SRMM72 (ExtraLarge, 6 like LRMM72's Large), Mine Launcher (Medium, 1),
|
||||
Flak Gun (Medium, 2). Map M30 already recorded CShot and plight.
|
||||
- **CB4. Weapon homes on master** (`HullData.Hardpoints`, key 23). Longinus: Energy 1x2 x2,
|
||||
Launcher 1x3 x2. Djinni: Ballistic 1x2 x2, Launcher 1x3 x2, Launcher 3x2 x2. Turret (station):
|
||||
Ballistic 2x4 x2. Zenith: none. `LoadoutGenerator.HasHome` (`:201`) offers a design only if some
|
||||
hull's hardpoint `Takes` it, so a Large or ExtraLarge Energy gun, an ExtraLarge launcher and a
|
||||
2x2 Energy gun have no home until a hull carries such a mount. No mod package is in the tree yet.
|
||||
- **CB5. Roles and components today** (source read `ItemData.cs:315-331`, `FactionProduct.cs:14-40`,
|
||||
`Provenance.cs:73`, `ItemData.cs:640-720`). A design declares `Roles` (`ItemRole`, a name only;
|
||||
its comment: "the part itself earns a record when crafting needs one to exist"). A product
|
||||
authors `ProductRole{Role, Mean, StandardDeviation}` per role; `ItemManager.CreateLot`
|
||||
(`ItemManager.cs:149`) rolls each role's quality into the lot; a stat reads it through a
|
||||
`StatTerm{Source: Quality, Role}`. No record type for a component item exists; the 51
|
||||
CompoundCommodityData (Circuit Board, Reaction Chamber, Heat Sink Tile, Trigger ...) carry no
|
||||
roles and nothing links a role to them. Lineage (`tech-lineage-per-component-role`) has no field.
|
||||
- **CB6. Roles are live only where a stat reads them.** `AetherDb roles-migrate`
|
||||
(`tools/AetherDb/Program.cs:255-378`) assigned roles per kind from fixed field maps
|
||||
(`:156-216`) and skipped flat stats (`Min == Max`) and kinds with no quality-reading behaviour.
|
||||
The census prints, but no test fails on, products that author no spread for a role
|
||||
(`Program.cs:110-127`).
|
||||
- **CB7. The audit of in-flight content for roles** (decode plus pirates-record diff read):
|
||||
- pd-gear (merged): all three designs declare their kind's roles, each read by non-flat stats;
|
||||
every product authors ProductRole for each. No gap.
|
||||
- Pirates (pirates-record 8e51016f, `Program.cs` diff lines 66-82): every rebrand mirrors its
|
||||
design's roles at apply time (mean .45, sd .22). It inherits the design's gaps: its Autocannon
|
||||
rebrand carries no roles because Autocannon declares none.
|
||||
- Mine Launcher (merged): no roles, every MineLayerData stat flat with no terms at all; its DME
|
||||
product authors none.
|
||||
- Also role-less with flat stats: Autocannon, LRMM72, SRMM72 (every stat Min == Max, Quality term
|
||||
with no role). Large Drive reads Quality with no role and declares none. Cargo bays, docking
|
||||
bay, Cockpit 2x2, Turret Control Module and Tractor Beam carry no quality-reading stat.
|
||||
- **CB8. Stat modifiers exist and work for passive gear** (source read
|
||||
`Behaviors/StatModifier.cs`, `StatResolver.cs:108-145`, `Entity.cs:1960-1980`).
|
||||
`StatModifierData` (behaviour union 4) names a target `StatReference{Target type name, Stat
|
||||
field}`, a magnitude `PerformanceStat` (so per-role quality works), `Constant` or `Multiplier`,
|
||||
and an optional `RequireBehavior`. While the gear is Active its behaviour groups execute in order
|
||||
and stop at the first that fails (`Entity.cs:1969-1976`), so an `EnergyDraw` before the modifier
|
||||
gates it on power; the modifier attaches to every matching stat on the same entity and detaches
|
||||
when it stops executing. `PerformanceStat.Evaluate` applies `lerp * Scale + Constant`, then the
|
||||
power factor (`ItemData.cs:700-722`). The sim reads every boosted stat through `Evaluate`
|
||||
(Thruster.cs:43, Sensor.cs:168, Radiator.cs:118, Weapon.cs:133-143, VelocityLimit.cs:35,
|
||||
TargetingSystem.cs:80). The catalog's one modifier: MoveOnPro (both sizes) scales
|
||||
`CapacitorData.Capacity` by 1.1-1.25.
|
||||
- **CB9. Gap: a modifier cannot target a base behaviour type.** `TargetsOf`
|
||||
(`StatModifier.cs:91-114`) matches `GetType() == targetType` at `:98`, `:102` and `:104`, while
|
||||
`ResolveStatField` resolves any `BehaviorData` subtype by name, abstract ones included
|
||||
(`ItemData.cs:785-799`, `Extensions.cs:36-44`). A modifier on `WeaponData.Damage` validates and
|
||||
then attaches to nothing, because every gun's behaviour is a concrete subtype (AutoWeaponData,
|
||||
InstantWeaponData, ChargedWeaponData, ConstantWeaponData, LauncherData, MineLayerData).
|
||||
- **CB10. Stacking today is unbounded.** `StatResolver.ScaleModifier` multiplies every attached
|
||||
scale and `ConstantModifier` sums every constant (`StatResolver.cs:108-122`). Ten 1.15
|
||||
multipliers compound to 4.0x. Consumable effects attach through the same resolver
|
||||
(`Entity.cs:857-881`, `StatModifier.cs:63`), so the stacking rule is shared with part (c).
|
||||
- **CB11. Where stat gear lives.** Tool gear has no hardpoint and fits any free interior cell
|
||||
(`Entity.cs:1076-1090`); Targeting Computer (Tool 1x1: TargetingSystem, EnergyDraw 2, Heat 15) is
|
||||
the closest template for a powered booster.
|
||||
- **CB12. Consumables already have a sim mechanism** (for part (c), not mapped here):
|
||||
`ConsumableItemData` (`ItemData.cs`, keys 10-14: Behaviors, Stackable, Duration, Icon,
|
||||
Effectiveness) is a CraftedItemData, so it declares roles; `Entity.TryActivateConsumable`
|
||||
(`:872`) and `ConsumableItemEffect` (`:1582`) run its behaviours, including StatModifier, with a
|
||||
`ConsumableProgress` stat source. The catalog holds no consumable record.
|
||||
|
||||
### Model page row changes
|
||||
|
||||
- **WeaponItemData (catalog)**: who decides gains "the matrix cell": `WeaponType` and
|
||||
`WeaponCaliber` are the authored category and size (question `weapon-matrix-axes`); footprint
|
||||
lies in its caliber's band (Small 1-2 cells, Medium 3-4, Large 5-6, ExtraLarge 7-9).
|
||||
- **CraftedItemData.Roles / FactionProductData.Roles**: a design declares a role only if a non-flat
|
||||
stat reads it; every product authors one ProductRole per role (rule CB-R1).
|
||||
- **StatModifierData**: targets a behaviour type and its subtypes (after modifier-subtypes); the
|
||||
resolver's stacking rule is the one for gear and consumables alike (question `boost-stacking`).
|
||||
|
||||
### Rules (cited by the specs)
|
||||
|
||||
- **CB-R1, roles and components (the whole ruling, consumables included).** A crafted design
|
||||
(weapon, gear, consumable) declares roles iff it has a stat that varies with quality. Each
|
||||
declared role is read by at least one non-flat stat's `Quality` term; each non-flat stat reads
|
||||
exactly one declared role; every product that sells the design authors one ProductRole per
|
||||
role, from its maker's profile (catalog-growth addenda table; Pirates .45/.22 per pirates-record).
|
||||
Roles come from the kind's field map in `Program.cs:156-216`, extended for new kinds as named in
|
||||
each spec. A consumable's roles govern its effect magnitude stats the same way. Under the
|
||||
recommended option of question `component-items`, the component is the (design role, product
|
||||
ProductRole) pair: no component item record until crafting reads one, and the lineage mark of
|
||||
`tech-lineage-per-component-role` lands on ProductRole when the first aethertech product does.
|
||||
- **CB-R2, authoring a new design.** Copy a template by record key (never by name, so it holds
|
||||
across generic-design-names), set the shape, caliber, type and name, set every authored stat by
|
||||
the ladder below as a Min-Max range of value x (0.8, 1.2) (benefit stats rise with quality, cost
|
||||
stats fall), keep the template's non-quality terms, point each Quality term at its role, author
|
||||
Tracking per weapon with no terms (`weapon-tracking-authored`), carry no BlastRadius or Fuse
|
||||
(`FireControlCut124Tests.cs:2589`), no AmmoType (the ballistic-ammo revision owns rounds), and a
|
||||
description with no maker name. Two or more products from distinct makers, never Miss Terri's or
|
||||
the Pirates, product name never the design name.
|
||||
- **CB-R3, caliber ladder** (per step from the template's caliber): Damage per shot x2.0, Range
|
||||
x1.2, Mass x2.0, Price x2.0, Energy and Heat x1.8, Cooldown x1.25, Spread x0.85, Visibility x1.5.
|
||||
Tracking (authored, steep): 2-cell Small 10-12, Medium 5-6, Large 3, ExtraLarge 1.5; flame guns
|
||||
double those (the cone covers what tracking misses).
|
||||
- **CB-R4, footprints for new designs.** Small 1x2, Medium 2x2 (launchers 1x3), Large 2x3
|
||||
(launchers 3x2), ExtraLarge 2x4 (fits the station Turret's Ballistic 2x4).
|
||||
- **CB-R5, catalog blob.** Each content cut lands through one idempotent AetherDb command; under
|
||||
follow-up `catalog-blob-merge-order` its merge takes master's catalog, reruns the command's
|
||||
`apply`, commits the regenerated blob in its own LFS commit with the dry-run text and reruns the
|
||||
suite. No cut picks a side's blob.
|
||||
|
||||
### Design tables
|
||||
|
||||
Product names are drafts in each maker's voice (profiles: catalog-growth addenda); Hands writes the
|
||||
one-line descriptions in that voice.
|
||||
|
||||
**matrix-coilguns** (EMPS, Ballistic hardpoint, template ClearPath `0271bb97` for Small and
|
||||
Autocannon `13116166` above; EMPS vs XPS at one caliber: Velocity x2.5, Penetration authored high,
|
||||
Energy x3 per `ballistics-cycle-power`, Damage x1.2, Cooldown x1.6; roles barrel, feed mechanism):
|
||||
|
||||
| Design | Caliber | Shape | Products (maker) |
|
||||
|---|---|---|---|
|
||||
| Light Coilgun | Small | 1x2 | RC-1 Needle (R&D), Pin (Finch) |
|
||||
| Coilgun | Medium | 2x2 | RC-4 Spindle (R&D), Plumb Line (Adrasteia) |
|
||||
| Railgun | Large | 2x3 | True Meridian (Adrasteia), RX-9 Lancer (R&D), Gavel (Zhestokost) |
|
||||
| Heavy Railgun | ExtraLarge | 2x4 | Axis (Adrasteia), Long Reach (AU) |
|
||||
|
||||
**matrix-cannons** (XPS, template Autocannon, AutoWeaponData; barrel, feed mechanism):
|
||||
|
||||
| Heavy Autocannon | Large | 2x3 | Bulwark (Zhestokost), Foreman (AU) |
|
||||
|---|---|---|---|
|
||||
| Siege Cannon | ExtraLarge | 2x4 | Last Word (Zhestokost), big red problem (DME) |
|
||||
|
||||
**matrix-beams** (Energy; Laser from ColdFire `2933c4ce`, PPC from ChargeBlast+- `499f7891`;
|
||||
focusing array, power coupling):
|
||||
|
||||
| Medium Beam Laser | Medium | 2x2 | Filament (Alakrita), Limelight (Lucent) |
|
||||
|---|---|---|---|
|
||||
| Large Beam Laser | Large | 2x3 | Marquee (Lucent), Clear Sight (Adrasteia) |
|
||||
| Heavy Ion Cannon | Large | 2x3 | Blackout (NiteLife), short circuit (DME) |
|
||||
| Ion Lance | ExtraLarge | 2x4 | Lights Out (NiteLife), IX-12 Breaker (R&D) |
|
||||
|
||||
**matrix-lightning** (ESD, ChargedWeaponData from plight `632420a6`; focusing array, power coupling):
|
||||
|
||||
| Arc Thrower | Small | 1x2 | Sparkler (Lucent), Live Wire (NiteLife) |
|
||||
|---|---|---|---|
|
||||
| Storm Projector | Medium | 2x2 | Thunderhead (NiteLife), everybody dance (DME) |
|
||||
| Tempest Projector | ExtraLarge | 2x4 | Grand Finale (Lucent), Mains (NiteLife) |
|
||||
|
||||
**matrix-missiles** (Launcher; Missile from GT 3K `5ee2ff03`, MicroMissile from LRMM72 `32157982`;
|
||||
guidance system, thruster, warhead):
|
||||
|
||||
| Light Missile Launcher | Small | 1x2 | Fledgling (Finch), Courier (AU) |
|
||||
|---|---|---|---|
|
||||
| Heavy Missile Launcher | Large | 3x2 | GT 6K (R&D), Freight Forward (AU) |
|
||||
| Torpedo Launcher | ExtraLarge | 2x4 | Battering Ram (Zhestokost), GT 12K (R&D) |
|
||||
| Micromissile Battery | ExtraLarge | 2x4 | the whole show (DME), Fireworks (Lucent) |
|
||||
|
||||
**matrix-mines** (Launcher, MineLayerData from Mine Launcher `1b4a2bb3`; new role map: warhead
|
||||
reads Damage, Penetration, DamageSpread; dispenser reads Range, Cooldown, Spread, Velocity, Energy,
|
||||
Heat, Visibility; ArmingDelay, FuseDelay and Lifetime stay authored per design, not ladder-scaled):
|
||||
|
||||
| Mine Rack | Medium | 1x3 | party favours (DME), Caltrop (Zhestokost) |
|
||||
|---|---|---|---|
|
||||
| Heavy Mine Layer | Large | 3x2 | surprise party (DME), Wake Warden (Lightsail) |
|
||||
| Minefield Projector | ExtraLarge | 2x4 | Exclusion Zone (Zhestokost), do not enter (DME) |
|
||||
|
||||
**matrix-flamers** (Jet, Ballistic hardpoint, InstantWeaponData pellet gun from Flak Gun
|
||||
`6af6446e`: DamageType Thermal, Count 8-12, Spread 25-35 deg, Range 150-300 at Small, Velocity
|
||||
300; roles nozzle (Range, Spread, Velocity) and fuel pump (Damage, Cooldown, Energy, Heat,
|
||||
Visibility)). Absorbs follow-up `pirates-flamethrower`'s design; the Pirates' own 🔥 product moves
|
||||
in their own record, not here.
|
||||
|
||||
| Light Flamethrower | Small | 1x2 | hot take (DME), Scorch (Zhestokost) |
|
||||
|---|---|---|---|
|
||||
| Flamethrower | Medium | 2x2 | keep it lit (DME), Brushfire (AU) |
|
||||
| Heavy Flamethrower | Large | 2x3 | Purifier (Zhestokost), burn the boats (DME) |
|
||||
| Inferno Projector | ExtraLarge | 2x4 | Ashfall (Zhestokost), Afterparty (NiteLife) |
|
||||
|
||||
After these, every cell of CB3 is filled except the SplitMissile row (follow-up
|
||||
`mirv-split-munition`): 24 new designs, 49 new products.
|
||||
|
||||
**Stat boosters** (Tool 1x1, template Targeting Computer `c07ea205`'s EnergyDraw and Heat, then a
|
||||
StatModifierData Multiplier in the same group so power gates it; roles amplifier (the magnitude)
|
||||
and regulator (EnergyDraw, Heat); magnitude per question `boost-strength`):
|
||||
|
||||
| Design | Targets | Products (maker) | Cut |
|
||||
|---|---|---|---|
|
||||
| Thrust Amplifier | ThrusterData.Thrust | Tailwind (Finch), Second Wind (Lightsail) | boost-gear-systems |
|
||||
| Signal Amplifier | SensorData.Sensitivity | Earful (Finch), Lookout (AU) | boost-gear-systems |
|
||||
| Emissivity Booster | RadiatorData.Emissivity | Cold Read (Adrasteia), Cool Head (Lightsail) | boost-gear-systems |
|
||||
| Reactor Overclock | ReactorData.Charge | Afterhours (NiteLife), redline (DME) | boost-gear-systems |
|
||||
| Damage Amplifier | WeaponData.Damage | Showstopper (Lucent), Heavy Hand (Zhestokost) | boost-gear-combat |
|
||||
| Range Extender | WeaponData.Range | Far Sight (Adrasteia), Long Look (Finch) | boost-gear-combat |
|
||||
| Shield Booster | ShieldData.Capacity | Thick Skin (AU), SB-2 Bastion (R&D) | boost-gear-combat |
|
||||
|
||||
### Rationale
|
||||
|
||||
**Why the category is WeaponType and the size is WeaponCaliber.** The operator's own taxonomy
|
||||
(CB2) names exactly these two axes, and the catalog already carries both fields. Footprint is mount
|
||||
space, which the brief's "sizes (cell footprints)" reads as the size; the two disagree in six
|
||||
records (CB3). Recommended: caliber is the one authored size, and a catalog test holds every
|
||||
footprint inside its caliber's band, so neither can drift; the six are fixed as content. plight is
|
||||
the exception the operator holds open (ruling `plight-shape`, Defaulted, revisit after play): it
|
||||
stays Large, and the band test names that ruling as its one exemption. Prior art: Starsector mounts
|
||||
are type x size (small/medium/large; ballistic/energy/missile) and every type exists at every size;
|
||||
Elite's hardpoints are class 1-4 with weapon families not filling every class.
|
||||
|
||||
**Why MIRV waits.** A split missile with no split is a mislabelled missile. Missiles become stepped
|
||||
munition records only after missile-records (r3, no report); splitting belongs on that record.
|
||||
|
||||
**Why components are the role and its ProductRole.** No system reads a part record (crafting is not
|
||||
in the demo; the target's not-in-scope line excludes new mechanics), so a component item now would
|
||||
be inert data. X4 and EVE give components item records because their economies produce and consume
|
||||
them; the role-quality pair already carries what the operator's examples need (a laser better at
|
||||
what its focusing role governs). Question `component-items` asks the operator.
|
||||
|
||||
**Why the stacking question recommends diminishing returns.** Interior cells are cheap compared with
|
||||
hardpoints, so unbounded multiplication (CB10) makes a hold full of amplifiers the dominant fit.
|
||||
EVE University, Stacking penalties (fetched 2026-10-08): the n-th percentage modifier on one
|
||||
attribute is multiplied by S(n-1), S(u) = e^-(u/2.67)^2, strongest first, so 100%, 86.9%, 57.1%,
|
||||
28.3%, 10.6%, 3.0%; absolute effects are never penalized; positive and negative effects are
|
||||
penalized separately. Starsector hullmods are on or off per ship and priced in ordnance points
|
||||
(starsector.wiki.gg/wiki/Hullmods, fetched 2026-10-08: Unstable Injector raises speed and cuts
|
||||
weapon range 25%); the exact bonus values were not on that page. Nebulous jammers stack on a similar
|
||||
diminishing curve (consumables prior-art file, "Stacking and exclusivity"). Because consumables
|
||||
attach through the same resolver, whichever rule the operator picks covers part (c) too.
|
||||
|
||||
**Cut order.** roles-backfill and modifier-subtypes are independent of everything here. The seven
|
||||
matrix cuts are independent of one another and of generic-design-names (templates by key, new
|
||||
designs born generic); they wait only on the axis ruling. caliber-bands lands last: it recalibers
|
||||
six records and adds the band and coverage tests that would fail before the matrix fills.
|
||||
product-lines-weapons r2 adds roles-backfill to r1's dependencies so its new products of Autocannon,
|
||||
LRMM72, SRMM72 and Mine Launcher author ProductRole for real roles. product-lines-gear turns
|
||||
follow-up `gear-product-lines` into a spec (Self withdraws the follow-up as absorbed when it
|
||||
admits nothing else over it). boost-gear-combat waits on modifier-subtypes; modifier-stacking and
|
||||
both boost cuts wait on the operator.
|
||||
|
||||
**Record keys.** No cut here adds a MessagePack key to any type, so none touches the Faction key
|
||||
collision (maker-only-faction 19, faction-play-1 Doctrine, livery 18).
|
||||
|
||||
### Admitted (mind receipts 2026-10-08 19:48-19:50 UTC)
|
||||
|
||||
Questions: `weapon-matrix-axes` (raised in matrix-coilguns, blocks every matrix cut and
|
||||
caliber-bands), `component-items` (raised in nothing: the specs follow its recommended option and
|
||||
stay valid under the others), `boost-strength` (raised in boost-gear-systems), `boost-stacking`
|
||||
(raised in modifier-stacking). Cut specs r1: roles-backfill, modifier-subtypes, modifier-stacking,
|
||||
boost-gear-systems, boost-gear-combat, matrix-coilguns, matrix-cannons, matrix-beams,
|
||||
matrix-lightning, matrix-missiles, matrix-mines, matrix-flamers, caliber-bands, product-lines-gear;
|
||||
product-lines-weapons r2 with resolution `cut_spec.cut-product-lines-weapons.r1.n1` (Superseded).
|
||||
Follow-ups: `mirv-split-munition`, `homeless-calibers`, `matrix-rounds`. Left for Self:
|
||||
follow-up `gear-product-lines` is absorbed by product-lines-gear (close it when that merges);
|
||||
follow-up `pirates-flamethrower`'s design half is absorbed by matrix-flamers (its product move
|
||||
stays the Pirates' record's).
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ Compiled 2026-09-29 by Eyes from the maps on the branch. Pointers are `doc:line`
|
|||
### 2b. Fresh launch (no `run.cc`, no `player.cc`)
|
||||
|
||||
3. **Launch to main menu.** Expect no Addressables errors, and the Groups window shows `Assets/Content` under `Default Local Group` (`addressables-cut.md:301`). `player.cc` appears and Continue is disabled (`cultcache-migration-cut.md:2746`). Proves: Addressables Cut 1, CultCache cutover. The 09-17 smoke covered the last two on the old tree; this is a cheap recheck on the new schema.
|
||||
4. **New Game (tutorial).** Expect the galaxy generates and the start ship is LonginusX (`settings-globals-cut.md:498`, an expectation, not a recorded check for this stack). Expect a Zenith station with a docking bay in the entrance zone every time (`locomotion-cut.md:375`). Proves: locomotion Cut 1 station rule.
|
||||
4. **New Game (tutorial).** Expect the galaxy generates and the start ship is the Longinus (`settings-globals-cut.md:498`, an expectation, not a recorded check for this stack). Expect a Zenith station with a docking bay in the entrance zone every time (`locomotion-cut.md:375`). Proves: locomotion Cut 1 station rule.
|
||||
5. **Addressables, "Use Asset Database".** Ships, turret and Zenith spawn; thruster and aether-drive particles show; fire an instant weapon (Autocannon) and a charged one (ChargeBlast SG); action bar icons show (`addressables-cut.md:362-366`). Proves: Addressables Cut 2.
|
||||
|
||||
### 2c. Flight, power and economy
|
||||
|
|
@ -44,19 +44,19 @@ Compiled 2026-09-29 by Eyes from the maps on the branch. Pointers are `doc:line`
|
|||
9. **Brownout and refill (O6, O4).** Brownout reads as degradation, not breakage (`:774`, `:990`). A weapon refilling under brownout stutters instead of firing full rate and cooking the ship (`:729-730`). Proves: power-supply term, brownout, input capacitors.
|
||||
10. **Memory across zones (O1).** Play across several zones with kills, open the Profiler or Task Manager, and confirm memory does not climb (`:672-673`, `:980-982`). Proves: stat resolver, the entity-leak fix (map Cut 2). Combine with steps 11 and 12.
|
||||
|
||||
### 2d. Combat (against a LonginusX-class AI), then save and Studio
|
||||
### 2d. Combat (against a Longinus-class AI), then save and Studio
|
||||
|
||||
11. **Fire-control Cut 1 arcs.** Side-mounted weapons still fire at targets abeam; a turret tracks all the way round; nothing fires through the hull (`fire-control-cut.md:397-398`).
|
||||
12. **Fire-control Cut 3 and shots.** Shots show rolled impacts and misses; a miss reads as a near-miss, not a bug; damage matches the HUD; aiming at a revealed subsystem concentrates damage; kill time is in the same order as before (`:659-661`). Reveal and selection work, kills drop loot, pickup stores it, the tractor beam still pulls (`headless-playground-cut.md:789-794`). No crash or frozen hot ship when the target vanishes (the 2026-09-20 failure, `fire-control-cut.md:1464-1470`). Recheck after the fixes: unrecorded.
|
||||
13. **12.2, bow then beam.** The HUD `hull` factor reads higher from the beam. Turn your armoured face into a slow missile and watch where it lands (`:2380-2383`).
|
||||
14. **12.3, launcher into a bow, then a flank.** Use a GT 3K or pswarm launcher. The schematic display pulses the facing edge only (`:2519-2520`).
|
||||
15. **12.4, scratch catalog.** Watch a proximity airburst beside a LonginusX and a delayed penetrator into its nose. Damage must land where the model shows the blast; this confirms the centre-of-mass anchor. Bow is already confirmed +y (`:3095-3097`, `:2028-2031`). Proves: 12.4(b) `Detonate`.
|
||||
15. **12.4, scratch catalog.** Watch a proximity airburst beside a Longinus and a delayed penetrator into its nose. Damage must land where the model shows the blast; this confirms the centre-of-mass anchor. Bow is already confirmed +y (`:3095-3097`, `:2028-2031`). Proves: 12.4(b) `Detonate`.
|
||||
16. **Wormhole, save, Continue.** Take a wormhole, quit, Continue: same items, same tier and brand (`item-provenance-cut.md:536-537`).
|
||||
17. **Die.** Continue is disabled and `run.cc` holds no ledger (`:540-541`).
|
||||
18. **Shield panel, `FieldShieldTest`.** Follow the numbered look in `shield-panel-cut.md:683-700`. Nothing visible on load. Click the nose: a patch grows and the field ripple runs too. Click the flank: the panel lies flat, not tilted. Click the same spot twice: it strikes the same panel. Spam far-apart clicks: at most 12 panels, oldest replaced. Let them fade: none left. Then the Cut 5 payoff: strong hits dice the patch, and repeated hits on one spot break through on a later hit (`:737-739`). Proves: shield-panel Cuts 3, 4, 5.
|
||||
19. **Studio click-through.**
|
||||
- Open `Aetheria.cc`. The fire-control behaviour union renders (`fire-control-cut.md:503-506`).
|
||||
- `LonginusX` schematic still underlays the shape drawer (`addressables-cut.md:370-371`).
|
||||
- `Longinus` schematic still underlays the shape drawer (`addressables-cut.md:370-371`).
|
||||
- The restored hull records open (`locomotion-cut.md:501`; the map gives no checklist beyond "the Studio click-through").
|
||||
- The scratch catalog's new `Fuse` and `BlastRadius` fields edit (from 2a; no map line).
|
||||
- Open `GameData/run.cc` after step 16. `aetheria.provenanceledger` renders `Lots` with `Attributed` origins and per-role lists. If Studio cannot draw an int-keyed dictionary of unions, that is a Studio defect to raise, not a schema change (`item-provenance-cut.md:541-544`).
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ using static CultMath.math;
|
|||
// Cut 7 (docs/stats-and-power-target.md): "Continuous consumers brown out through a power supply curve on
|
||||
// their performance stats. An exponent is enough." Cut 6 wired the curve itself (PowerCurveTests.cs) and the
|
||||
// bus already writes a real fractional grant (PowerBusTests.cs, PowerTierTests.cs), but every continuous
|
||||
// consumer still gated its own effect on Item.PowerSupply >= 1f (Thruster.Execute, AetherDrive.Execute,
|
||||
// consumer still gated its own effect on Item.PowerSupply >= 1f (Thruster.Execute,
|
||||
// Radiator.Execute, ConstantWeapon.Execute, EnergyDraw.Execute) -- so a partial grant read exactly like none,
|
||||
// the flicking-off bug the ruling names. This file pins each behaviour's own gate removal: a partial grant now
|
||||
// produces a reduced effect, a full grant is unchanged, a zero grant still produces nothing, the degradation
|
||||
|
|
@ -18,12 +18,11 @@ using static CultMath.math;
|
|||
// rule, Cut 4) is untouched by any of it. Each rule has a matching mutation in
|
||||
// tests/mutation_tests_stats_power_cut7.py.
|
||||
//
|
||||
// F6 (docs/stats-and-power-cut.md, Soul pass 2026-09-19) surfaced a real conflict this file's Radiator and
|
||||
// AetherDrive fixtures happened to sit on top of, unnoticed because the pre-F6 registry only named each
|
||||
// F6 (docs/stats-and-power-cut.md, Soul pass 2026-09-19) surfaced a real conflict this file's Radiator
|
||||
// fixture happened to sit on top of, unnoticed because the pre-F6 registry only named each
|
||||
// consumer's own top-level request field. Radiator.PowerRequest's own early-out reads PumpedHeat AND WasteHeat
|
||||
// (to decide whether the pump can keep up this tick); AetherDrive.PowerRequest's spin-up arithmetic reads
|
||||
// Torque, LambdaMultiplier, MaximumRpm and PassiveCoupling. Cut 7 asks for the brownout curve to live on exactly
|
||||
// the stats these two behaviours actually curve (PumpedHeat, Torque), but F6 forbade a PowerSupply term on any
|
||||
// (to decide whether the pump can keep up this tick). Cut 7 asks for the brownout curve to live on exactly
|
||||
// the stats the behaviour actually curves (PumpedHeat), but F6 forbade a PowerSupply term on any
|
||||
// stat a request reads at all, on pain of the exact oscillation Soul measured against the shipped catalog's own
|
||||
// "OK Disperser" radiator (SOUL_RadiatorRequestDependsOnItsOwnGrantAndOscillates, docs/stats-and-power-cut.md).
|
||||
// The six tests below that authored one were marked Skip rather than deleted or silently reworked to hide the
|
||||
|
|
@ -32,8 +31,8 @@ using static CultMath.math;
|
|||
//
|
||||
// Nominal-request ruling (docs/stats-and-power-cut.md, operator ruling 2026-09-19) is that future pass: a power
|
||||
// request is evaluated nominally -- what the item wants at full supply, not what it is currently managing
|
||||
// (EquippedItem.EvaluateNominalPower, Entity.cs). Radiator.PowerRequest and AetherDrive.PowerRequest now read
|
||||
// PumpedHeat/Torque (and every other field in StatValidation.PowerRequestFields) through that nominal read, so
|
||||
// (EquippedItem.EvaluateNominalPower, Entity.cs). Radiator.PowerRequest now reads
|
||||
// PumpedHeat (and every other field in StatValidation.PowerRequestFields) through that nominal read, so
|
||||
// the same stat can carry a PowerSupply term (curved for Execute's real effect) AND be a request field, without
|
||||
// the request depending on its own answer -- there is no more oscillation to reproduce, because the request no
|
||||
// longer reads the live grant at all. StatValidation.ValidateNoPowerSupplyOnRequest (the static check F6 added
|
||||
|
|
@ -64,14 +63,6 @@ public sealed class BrownoutTests : IDisposable
|
|||
private static PerformanceStat Curved(float max, float exponent) =>
|
||||
new PerformanceStat { Min = 0, Max = max, Terms = { new StatTerm { Source = StatSource.PowerSupply, Exponent = exponent } } };
|
||||
|
||||
// A flat Bezier (two keys, equal value, zero tangents): AetherDrive's TorqueProfile multiplies potential
|
||||
// torque by this curve's value at the current rpm ratio -- flat at 1 keeps that multiplier out of the way of
|
||||
// the PowerSupply curve under test.
|
||||
private static BezierCurve FlatCurve(float value) => new BezierCurve
|
||||
{
|
||||
Keys = new[] { new float4(0, value, 0, 0), new float4(1, value, 0, 0) }
|
||||
};
|
||||
|
||||
private static EquippableItem Mint(CultCache cache, ItemManager items, ItemData design) => new EquippableItem
|
||||
{
|
||||
Data = cache.RefOf<ItemData>(design),
|
||||
|
|
@ -180,55 +171,6 @@ public sealed class BrownoutTests : IDisposable
|
|||
Assert.Equal(.025f, half, 3);
|
||||
}
|
||||
|
||||
// --- AetherDrive: PassiveCoupling = 1 engages the rotor regardless of axis input, so the drive can be
|
||||
// --- exercised without threading Ship's own movement/torque classification -- Axis stays at Ship.Update's
|
||||
// --- own default (0,0,Turn), and Turn is 0 by default. Rpm starts at 0,
|
||||
// --- so decay(0, ...) contributes nothing and the whole tick's Rpm gain is exactly this behaviour's own
|
||||
// --- spin-up under test. ---
|
||||
private (float rpmGain, AetherDrive drive) RunAetherDrive(float reactorCharge, float exponent = 1)
|
||||
{
|
||||
using var cache = OpenCatalog(new AetherDriveData
|
||||
{
|
||||
RotorDiameter = float3(1, 1, 1), RotorMass = float3(1, 1, 1),
|
||||
MaximumRpm = Constant(100), CouplingLambda = float3(1, 1, 1), LambdaMultiplier = Constant(1),
|
||||
CouplingEfficiency = Constant(1), Torque = Curved(30, exponent), TorqueProfile = FlatCurve(1),
|
||||
EnergyDraw = Constant(50), PassiveCoupling = Constant(1)
|
||||
});
|
||||
var ship = BuildShip(cache, reactorCharge);
|
||||
ship.Update(1f);
|
||||
var drive = ship.GetBehavior<AetherDrive>();
|
||||
return (drive.Rpm.x, drive);
|
||||
}
|
||||
|
||||
// Nominal-request ruling (docs/stats-and-power-cut.md, operator ruling 2026-09-19, see file header): Torque
|
||||
// is a registered AetherDrive request field (PowerRequest's spin-up arithmetic reads it), but PowerRequest now
|
||||
// reads it through EvaluateNominalPower (full-supply, undegraded), so Curved(...) on Torque is a legal
|
||||
// catalog shape again -- Execute's own real, curved Evaluate is what actually degrades the spin-up below.
|
||||
[Fact]
|
||||
public void AetherDriveAtHalfGrantProducesReducedNotZeroNotFullSpinUp()
|
||||
{
|
||||
var (full, _) = RunAetherDrive(reactorCharge: 1000); // demand ~50, generation far exceeds it -> ratio 1
|
||||
var (half, _) = RunAetherDrive(reactorCharge: 25); // demand ~50, generation 25 -> ratio .5
|
||||
|
||||
Assert.True(half > 0f && half < full, $"half={half} should sit strictly between 0 and full={full}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AetherDriveAtFullGrantIsUnchangedFromToday()
|
||||
{
|
||||
var (full, drive) = RunAetherDrive(reactorCharge: 1000);
|
||||
Assert.Equal(1f, drive.Item.PowerSupply, 3);
|
||||
Assert.True(full > 0f);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AetherDriveAtZeroGrantProducesNothing()
|
||||
{
|
||||
var (zero, drive) = RunAetherDrive(reactorCharge: 0);
|
||||
Assert.Equal(0f, drive.Item.PowerSupply, 3);
|
||||
Assert.Equal(0f, zero, 4);
|
||||
}
|
||||
|
||||
// --- Radiator: no explicit power gate survives Cut 7 at all -- PumpedHeat above is a plain Evaluate() read,
|
||||
// --- so a curved PumpedHeat already pumps less under a partial grant, and waste heat is unaffected, so a
|
||||
// --- starved radiator falls behind (the reduced-performance failure the ruling asks for) instead of the
|
||||
|
|
@ -383,10 +325,10 @@ public sealed class BrownoutTests : IDisposable
|
|||
|
||||
// --- Nominal-request ruling (docs/stats-and-power-cut.md, operator ruling 2026-09-19): a direct probe of
|
||||
// --- EquippedItem.EvaluateNominalPower itself, decoupled from any behaviour's own physical state (Radiator's
|
||||
// --- temperature, AetherDrive's Rpm) so the only thing that can make it diverge from the ordinary Evaluate
|
||||
// --- temperature) so the only thing that can make it diverge from the ordinary Evaluate
|
||||
// --- is the item's own PowerSupply grant. Thruster's EnergyUsage carries the term here purely as a probe --
|
||||
// --- not a shape BrownoutTests' other fixtures author -- because Thruster has no other tick-to-tick state
|
||||
// --- that could confound the comparison the way Radiator's RadiatorTemperature or AetherDrive's Rpm would.
|
||||
// --- that could confound the comparison the way Radiator's RadiatorTemperature would.
|
||||
// --- Backs tests/mutation_tests_stats_power_nominal_request.py's own mutation of this exact method. ---
|
||||
[Fact]
|
||||
public void EvaluateNominalPowerIgnoresTheItemsCurrentPowerSupplyGrant()
|
||||
|
|
@ -444,16 +386,4 @@ public sealed class BrownoutTests : IDisposable
|
|||
$"expected tick 2's gate to stay open on the nominal PumpedHeat/WasteHeat ratio, got demand {secondDemand}");
|
||||
}
|
||||
|
||||
// --- The same wiring check attempted on AetherDrive.PowerRequest's own Torque read does not carry over
|
||||
// --- cleanly: torqueRatio (actualRpmDelta/potentialRpmDelta) self-cancels Torque's own magnitude whenever
|
||||
// --- the rotor is not yet rpm-capped (both numerator and denominator scale with Torque, so the ratio -- and
|
||||
// --- so the final draw -- comes out identical whether Torque is read nominally or through the curved
|
||||
// --- Evaluate; verified empirically while building this fixture: reverting AetherDrive.PowerRequest to
|
||||
// --- Evaluate produced byte-identical TotalDemand across two ticks, including once the rotor was pushed
|
||||
// --- into its rpm cap). A black-box demand comparison cannot discriminate this call site the way it can
|
||||
// --- Radiator's binary gate above. Its correctness rests instead on the identical pattern to Radiator's
|
||||
// --- (same EvaluateNominalPower call, same EquippedItem mechanism EvaluateNominalPowerIgnoresTheItemsCurrent
|
||||
// --- PowerSupplyGrant already pins) and on AetherDriveAtHalfGrantProducesReducedNotZeroNotFullSpinUp/
|
||||
// --- AtFullGrantIsUnchangedFromToday/AtZeroGrantProducesNothing above, which exercise the real end-to-end
|
||||
// --- Execute path this ruling exists to keep legal. Not part of the mutation harness for that reason.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ using static CultMath.math;
|
|||
// Should multiply that by actual performance." EquippedItem.ConditionRatio (Entity.cs) is the one number that
|
||||
// answers "how healthy does this item actually look": the item's resolved value for a stat against what the
|
||||
// same item, same lot, same modifiers would produce with Heat/Durability/PowerSupply pinned to their identity.
|
||||
// Thruster.Condition and AetherDrive.Condition (Thruster.cs/AetherDrive.cs) are that ratio read against each
|
||||
// Thruster.Condition (Thruster.cs) is that ratio read against each
|
||||
// behaviour's own governing stat (Thrust, Torque); ShipInstance.cs (Unity-side, not covered here) multiplies
|
||||
// presentation intent by it instead of recomputing any durability/heat/power arithmetic of its own.
|
||||
// Each rule here has a matching mutation in tests/mutation_tests_condition_ratio_cut8.py.
|
||||
|
|
|
|||
|
|
@ -9,30 +9,16 @@ using CultMath;
|
|||
using Xunit;
|
||||
|
||||
// The demo scenario (aetheria-release, cut demo-galaxy): a prelude galaxy of a fixed cast whose antagonist's home is the
|
||||
// boss zone and the exit. The shipped catalog holds no Pirates faction yet, so each test that needs one adds it to its
|
||||
// scratch copy of the catalog.
|
||||
// boss zone and the exit. The cast, the Pirates included, is in the shipped catalog.
|
||||
public sealed partial class RunStartTests
|
||||
{
|
||||
private static readonly uint[] DemoSeeds = { 1, 2, 3, 4, 5 };
|
||||
|
||||
// The catalog record the demo's protagonist needs, until the shipped catalog has one. Zone names need a name file,
|
||||
// and the entrance's station needs a faction whose allegiance reaches some manufacturer, so it reaches every one.
|
||||
private void AddPirates()
|
||||
{
|
||||
var pirates = new Faction
|
||||
{
|
||||
Name = "Pirates", ShortName = "Pirates", GeonameFile = _cache.RefOf(_cache.GetAll<NameFile>().First())
|
||||
};
|
||||
foreach (var faction in _cache.GetAll<Faction>().ToArray()) pirates.Allegiance[_cache.RefOf(faction)] = 1;
|
||||
_cache.Upsert(pirates);
|
||||
}
|
||||
|
||||
private Galaxy DemoGalaxy(uint seed) => RunStart.Generate(new DemoTerminus(), Inputs(() => seed));
|
||||
|
||||
[Fact]
|
||||
public void DemoTerminus_fixed_cast()
|
||||
{
|
||||
AddPirates();
|
||||
foreach (var seed in DemoSeeds)
|
||||
Assert.Equal(new[] { "Pirates", "Zhestokost", "Lucent Media", "Aeronautics Unlimited" },
|
||||
DemoGalaxy(seed).Factions.Select(faction => faction.Name));
|
||||
|
|
@ -41,7 +27,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void DemoTerminus_gate_at_antagonist_home()
|
||||
{
|
||||
AddPirates();
|
||||
foreach (var seed in DemoSeeds)
|
||||
{
|
||||
var galaxy = DemoGalaxy(seed);
|
||||
|
|
@ -60,7 +45,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void DemoTerminus_standing_survives_continue()
|
||||
{
|
||||
AddPirates();
|
||||
var (galaxy, arena, staged, failures) = Launch(new DemoTerminus(), Inputs(() => 1));
|
||||
Assert.True(failures.Count == 0, string.Join("; ", failures));
|
||||
galaxy.Entrance.Contents = arena;
|
||||
|
|
@ -83,11 +67,16 @@ public sealed partial class RunStartTests
|
|||
restored.BossZones.Select(boss => (boss.Key.Name, Array.IndexOf(restored.Zones, boss.Value))));
|
||||
}
|
||||
|
||||
// On the shipped catalog, which has no Pirates, the run does not start: the galaxy refuses, naming the cast field,
|
||||
// and the scenario never reaches staging.
|
||||
// A catalog without the Pirates (the shipped record and its products removed from this scratch copy) does not start the
|
||||
// run: the galaxy refuses, naming the cast field, and the scenario never reaches staging.
|
||||
[Fact]
|
||||
public void DemoTerminus_missing_cast_refused()
|
||||
{
|
||||
var pirates = _cache.GetAll<Faction>().Single(faction => faction.Name == "Pirates");
|
||||
var piratesRef = _cache.RefOf(pirates);
|
||||
foreach (var product in _cache.GetAll<FactionProductData>().Where(product => product.Manufacturer.Equals(piratesRef)).ToArray())
|
||||
Assert.True(_cache.Remove(_cache.RefOf(product).Key));
|
||||
Assert.True(_cache.Remove(piratesRef.Key));
|
||||
Assert.DoesNotContain(_cache.GetAll<Faction>(), faction => faction.Name.StartsWith("Pirates", StringComparison.Ordinal));
|
||||
var refusal = Assert.Throws<InvalidOperationException>(() => DemoGalaxy(1));
|
||||
Assert.Contains("Pirates", refusal.Message);
|
||||
|
|
@ -108,7 +97,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void DemoTerminus_player_flies_a_non_pirates_brand_hull_the_longinus()
|
||||
{
|
||||
AddPirates();
|
||||
foreach (var seed in DemoSeeds)
|
||||
{
|
||||
var (galaxy, _, staged, failures) = Launch(new DemoTerminus(), Inputs(() => seed));
|
||||
|
|
@ -130,7 +118,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void DemoTerminus_player_carries_the_longinus_default_fit()
|
||||
{
|
||||
AddPirates();
|
||||
string Fit(Entity ship) => string.Join(";", ship.Equipment
|
||||
.Select(item => $"{item.Data.Name}@{item.Position}/{item.EquippableItem.Rotation}")
|
||||
.OrderBy(entry => entry, StringComparer.Ordinal));
|
||||
|
|
@ -151,7 +138,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void DemoTerminus_region_is_sixty_four_zones_linked_at_half_density()
|
||||
{
|
||||
AddPirates();
|
||||
string Links(Galaxy g) => string.Join(";", g.Zones.Select(zone =>
|
||||
string.Join(",", zone.AdjacentZones.Select(adjacent => Array.IndexOf(g.Zones, adjacent)).OrderBy(index => index))));
|
||||
Galaxy Reference(uint seed, float density)
|
||||
|
|
@ -177,7 +163,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void ACastNamingNoQuestFactionPlacesNoQuestZone()
|
||||
{
|
||||
AddPirates();
|
||||
var galaxy = DemoGalaxy(1);
|
||||
Assert.Equal(4, galaxy.HomeZones.Count);
|
||||
Assert.Equal(4, galaxy.Factions.Length);
|
||||
|
|
|
|||
|
|
@ -313,6 +313,147 @@ public sealed partial class RunStartTests
|
|||
}
|
||||
}
|
||||
|
||||
private WeaponItemData PdDesign(string name) => _cache.GetAll<WeaponItemData>().Single(w => w.Name == name);
|
||||
|
||||
// Data check, not a behaviour test: cut pd-gear's authored catalog (ruling catalog-grows-generic-designs-branded-products):
|
||||
// three generic designs, each with several products, no maker twice on one design, and no brand on a design.
|
||||
[Fact]
|
||||
public void PdGearIsAuthored()
|
||||
{
|
||||
var expected = new (string design, HardpointType hardpoint, int width, int height, float tracking)[]
|
||||
{
|
||||
("Point Defense Gun", HardpointType.Ballistic, 1, 1, 40f),
|
||||
("Point Defense Laser", HardpointType.Energy, 1, 1, 40f),
|
||||
("Flak Gun", HardpointType.Ballistic, 1, 2, 20f),
|
||||
};
|
||||
var products = _cache.GetAll<FactionProductData>().ToArray();
|
||||
foreach (var (name, hardpoint, width, height, tracking) in expected)
|
||||
{
|
||||
var design = PdDesign(name);
|
||||
Assert.Equal(hardpoint, design.HardpointType);
|
||||
Assert.Equal(width, design.Shape.Width);
|
||||
Assert.Equal(height, design.Shape.Height);
|
||||
Assert.True(design.Shape.Cells.Cast<bool>().All(cell => cell), $"{name} occupies every cell of its shape");
|
||||
var rate = design.Behaviors.OfType<WeaponData>().Single().Tracking;
|
||||
Assert.Equal(tracking, rate.Min);
|
||||
Assert.Equal(tracking, rate.Max);
|
||||
|
||||
var key = _cache.RefOf(design).Key;
|
||||
var sold = products.Where(p => p.Design.Key.Equals(key)).ToArray();
|
||||
Assert.True(sold.Length >= 3, $"{name} has at least three products, not {sold.Length}");
|
||||
var makers = sold.Select(p => _cache.Get(p.Manufacturer)).ToArray();
|
||||
Assert.DoesNotContain(null, makers);
|
||||
Assert.Equal(makers.Length, makers.Select(m => m.ShortName).Distinct().Count());
|
||||
Assert.DoesNotContain(makers, m => m.ShortName == "Miss Terri's");
|
||||
Assert.All(sold, p => Assert.NotEqual(design.Name, p.Name));
|
||||
Assert.All(sold, p => Assert.Equal(design.Roles.Select(r => r.Name).OrderBy(n => n), p.Roles.Select(r => r.Role).OrderBy(n => n)));
|
||||
}
|
||||
}
|
||||
|
||||
private static void PdStat(string design, string stat, PerformanceStat actual, float min, float max) =>
|
||||
Assert.True(actual.Min == min && actual.Max == max, $"{design} {stat} is {min}-{max}, not {actual.Min}-{actual.Max}");
|
||||
|
||||
// Data check: the authored numbers of the three designs, read from the shipped catalog through the production load path
|
||||
// (addenda "Catalog growth: generic designs, branded products", the Derivation of the PD stats). Each is a lever the
|
||||
// operator tunes, so each is pinned; the ammunition is the commodity Autocannon's rounds are.
|
||||
[Fact]
|
||||
public void PdGearStatsAreAuthored()
|
||||
{
|
||||
var ammunition = PdDesign("Autocannon").Behaviors.OfType<InstantWeaponData>().Single().AmmoType.Key;
|
||||
var expected = new (string name, float mass, int price, float durability, WeaponModifiers modifiers, (float min, float max) damage,
|
||||
(float min, float max) count, (float min, float max) range, (float min, float max) cooldown, (float min, float max) spread,
|
||||
(float min, float max) velocity, (float min, float max) energy, (float min, float max) heat, (float min, float max) visibility,
|
||||
bool ammo, int magazine, float reload)[]
|
||||
{
|
||||
("Point Defense Gun", 40f, 80000, 60f, WeaponModifiers.RapidFire, (1.5f, 4f), (1f, 1f), (300f, 550f), (.06f, .025f), (1f, .3f),
|
||||
(1100f, 1600f), (.4f, .2f), (40f, 15f), (400f, 150f), true, 250, 3f),
|
||||
("Point Defense Laser", 30f, 110000, 30f, PdDesign("Spectra").WeaponModifiers, (5f, 12f), (1f, 1f), (400f, 750f), (.2f, .1f), (.05f, 0f),
|
||||
(0f, 0f), (6f, 10f), (300f, 150f), (300f, 100f), false, PdDesign("Spectra").Behaviors.OfType<InstantWeaponData>().Single().MagazineSize, PdDesign("Spectra").Behaviors.OfType<InstantWeaponData>().Single().ReloadTime),
|
||||
("Flak Gun", 120f, 180000, 80f, WeaponModifiers.Cluster, (30f, 70f), (6f, 8f), (350f, 800f), (.6f, .35f), (4f, 2f),
|
||||
(900f, 1300f), (1f, .5f), (300f, 150f), (800f, 300f), true, 40, 4f),
|
||||
};
|
||||
foreach (var e in expected)
|
||||
{
|
||||
var design = PdDesign(e.name);
|
||||
var data = design.Behaviors.OfType<InstantWeaponData>().Single();
|
||||
Assert.Equal(e.mass, design.Mass);
|
||||
Assert.Equal(e.price, design.Price);
|
||||
Assert.Equal(e.durability, design.Durability);
|
||||
Assert.Equal(e.modifiers, design.WeaponModifiers);
|
||||
PdStat(e.name, "damage", data.Damage, e.damage.min, e.damage.max);
|
||||
PdStat(e.name, "count", data.Count, e.count.min, e.count.max);
|
||||
PdStat(e.name, "range", data.Range, e.range.min, e.range.max);
|
||||
PdStat(e.name, "min range", data.MinRange, 0f, 0f);
|
||||
PdStat(e.name, "cooldown", data.Cooldown, e.cooldown.min, e.cooldown.max);
|
||||
PdStat(e.name, "spread", data.Spread, e.spread.min, e.spread.max);
|
||||
PdStat(e.name, "velocity", data.Velocity, e.velocity.min, e.velocity.max);
|
||||
PdStat(e.name, "energy", data.Energy, e.energy.min, e.energy.max);
|
||||
PdStat(e.name, "heat", data.Heat, e.heat.min, e.heat.max);
|
||||
PdStat(e.name, "visibility", data.Visibility, e.visibility.min, e.visibility.max);
|
||||
Assert.Equal(e.magazine, data.MagazineSize);
|
||||
Assert.Equal(e.reload, data.ReloadTime);
|
||||
if (e.ammo) Assert.True(data.AmmoType.Key.Equals(ammunition), $"{e.name} draws the ammunition commodity");
|
||||
else Assert.False(data.AmmoType.IsSet(), $"{e.name} draws no ammunition");
|
||||
}
|
||||
Assert.Equal("Close-in defence gun: a hose of light rounds.", PdDesign("Point Defense Gun").Description);
|
||||
Assert.Equal("Close-in defence beam: quick, light, instant.", PdDesign("Point Defense Laser").Description);
|
||||
Assert.Equal("Small flak gun: a short-range pellet volley.", PdDesign("Flak Gun").Description);
|
||||
}
|
||||
|
||||
// Rule test (ruling catalog-grows-generic-designs-branded-products): branding lives in the products, so no PD design's
|
||||
// name or description carries any maker's name or short name. The makers are enumerated from the catalog.
|
||||
[Fact]
|
||||
public void PdDesignsCarryNoMakerName()
|
||||
{
|
||||
var makers = _cache.GetAll<Faction>().SelectMany(f => new[] { f.Name, f.ShortName }).Where(n => !string.IsNullOrWhiteSpace(n)).Distinct().ToArray();
|
||||
Assert.True(makers.Length > 10, $"fixture: the catalog lists its makers ({makers.Length})");
|
||||
foreach (var name in new[] { "Point Defense Gun", "Point Defense Laser", "Flak Gun" })
|
||||
{
|
||||
var design = PdDesign(name);
|
||||
foreach (var maker in makers)
|
||||
{
|
||||
var word = new System.Text.RegularExpressions.Regex($@"(?<!\w){System.Text.RegularExpressions.Regex.Escape(maker)}(?!\w)", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
|
||||
Assert.False(word.IsMatch(design.Name ?? ""), $"{name}'s name carries the maker {maker}");
|
||||
Assert.False(word.IsMatch(design.Description ?? ""), $"{name}'s description carries the maker {maker}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Data check: a design is offered only if some hull has a hardpoint that takes it (LoadoutGenerator.HasHome), so these
|
||||
// guns are stocked and fitted only while a catalog hull takes them (body fact CG6).
|
||||
[Fact]
|
||||
public void PdGunsHaveHomes()
|
||||
{
|
||||
var djinni = _cache.GetAll<HullData>().Single(h => h.Name == "Djinni");
|
||||
var longinus = _cache.GetAll<HullData>().Single(h => h.Name == "Longinus");
|
||||
foreach (var name in new[] { "Point Defense Gun", "Flak Gun" })
|
||||
Assert.Contains(djinni.Hardpoints, hardpoint => hardpoint.Type == HardpointType.Ballistic && hardpoint.Takes(PdDesign(name)));
|
||||
Assert.Contains(longinus.Hardpoints, hardpoint => hardpoint.Type == HardpointType.Energy && hardpoint.Takes(PdDesign("Point Defense Laser")));
|
||||
}
|
||||
|
||||
// Ruling weapon-tracking-authored, in play: a PD gun follows a speed demon crossing close in, and the machine gun does not.
|
||||
[Fact]
|
||||
public void PdGunHoldsASpeedDemon()
|
||||
{
|
||||
var range = EvMountRange(40f, 3f);
|
||||
EvCross(range, jinking: false, float2(150, 0));
|
||||
var shooter = range.Gunner;
|
||||
var omega = FireControl.AngularVelocity(shooter, range.Target);
|
||||
Assert.InRange(omega, degrees(150f / 200f) * .999f, degrees(150f / 200f) * 1.001f);
|
||||
var gear = FireControl.Tracking(shooter) / _items.GameplaySettings.UnaidedTracking;
|
||||
Assert.True(gear > 1.2f, $"fixture: the shooter's targeting gear tracks better than unaided ({gear})");
|
||||
// The rate the production path reads: the catalog design's authored Tracking on the weapon, times the shooter's gear.
|
||||
float RateOf(string design)
|
||||
{
|
||||
EvSetRate(range.Gun, range.Gunner, PdDesign(design).Behaviors.OfType<WeaponData>().Single().Tracking.Max);
|
||||
return FireControl.TrackingRate(range.Gun, range.Gunner);
|
||||
}
|
||||
var pd = FireControl.PMount(omega, RateOf("Point Defense Gun"));
|
||||
var clearPath = FireControl.PMount(omega, RateOf("ClearPath"));
|
||||
Assert.True(pd >= .75f, $"the PD gun follows a speed demon: {pd}");
|
||||
Assert.True(clearPath <= .25f, $"the machine gun does not: {clearPath}");
|
||||
}
|
||||
|
||||
// Data check, not a behaviour test: ruling plight-shape, plight is one wide, two high and fits a Longinus Energy hardpoint.
|
||||
[Fact]
|
||||
public void PlightHasItsRuledShape()
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ using int2 = CultMath.int2;
|
|||
// follows, with the rules this cut's own tests must obey: SchematicCellSize 2 throughout (the 12.3 fixture's
|
||||
// cell size of 1 would hide a missing `/ SchematicCellSize`), the target off the origin, and a hull whose
|
||||
// centre of mass is not an integer cell.
|
||||
public sealed class FireControlCut124Tests : IDisposable
|
||||
public sealed partial class FireControlCut124Tests : IDisposable
|
||||
{
|
||||
private readonly string _root = Path.Combine(Path.GetTempPath(), "aetheria-firecontrolcut124-" + Guid.NewGuid().ToString("N"));
|
||||
private string Catalog => Path.Combine(_root, "Aetheria.cc");
|
||||
|
|
@ -469,10 +469,9 @@ public sealed class FireControlCut124Tests : IDisposable
|
|||
}
|
||||
|
||||
// The same rule on the shipped hulls: a blast just grazing the corner farthest from the centre of mass. The
|
||||
// corners of the shipped Longinus and LonginusX reach past the old cull's box-half-diagonal bound.
|
||||
// corner of the shipped Longinus reaches past the old cull's box-half-diagonal bound.
|
||||
[Theory]
|
||||
[InlineData("Longinus")]
|
||||
[InlineData("LonginusX")]
|
||||
public void AGrazingBlastAtAShippedHullsFarthestCornerLands(string hullName)
|
||||
{
|
||||
Shape shape;
|
||||
|
|
@ -1397,7 +1396,7 @@ public sealed class FireControlCut124Tests : IDisposable
|
|||
var e = Build(TestSettings(), SolidShape(5, 4), velocity: 0, fuse: fuse, blastRadius: 4f, damage: 100f,
|
||||
weaponRange: NoLockRange, targetRange: 40f);
|
||||
e.Shooter.Direction = float2(0, -1);
|
||||
Aim(e, float2(0, -1));
|
||||
Aim(e, float2(0, 1)); // outside the flipped mount's arc too: no solution, and the aim is not free
|
||||
Assert.Equal(fires, e.Weapon.ArcAllowsFire);
|
||||
var committed = 0;
|
||||
using var c = e.Zone.ShotCommitted.Subscribe(_ => committed++);
|
||||
|
|
|
|||
|
|
@ -1324,7 +1324,7 @@ public sealed class FireControlCut12Tests : IDisposable
|
|||
}
|
||||
|
||||
// S3 fix batch (Hands, 2026-09-25): Lane's own comment ("never allocates on its own") and Silhouette's
|
||||
// pooled path are pinned directly, instead of trusting the comment. Measured (Release, LonginusX-shaped
|
||||
// pooled path are pinned directly, instead of trusting the comment. Measured (Release, Longinus-shaped
|
||||
// fixture unavailable to this test file -- a 7x9 solid hull is used instead): Lane and Silhouette (given a
|
||||
// caller-supplied buffer) allocate exactly 0 bytes over 1000 calls, confirming the S3 change itself
|
||||
// (Array.Sort(T[], int, int) resolving Interval/LaneCell's own IComparable<T> at JIT time, not the
|
||||
|
|
|
|||
|
|
@ -364,6 +364,7 @@ public sealed class FireControlCut5Tests : IDisposable
|
|||
var settings = TestSettings();
|
||||
settings.FiringArc = 60; // narrow -- an abeam target is well outside it
|
||||
var e = BuildBeam(settings, float3(100, 0, 0)); // directly abeam
|
||||
e.Shooter.Aim = float3(0, 0, -1); // astern, outside the arc: nothing bears and the aim is not free
|
||||
|
||||
e.Weapon.Activate();
|
||||
Assert.True(e.Weapon.Firing); // Activate() sets _firing unconditionally, same as InstantWeapon.Trigger
|
||||
|
|
@ -466,11 +467,13 @@ public sealed class FireControlCut5Tests : IDisposable
|
|||
shooter.Position = float3.zero;
|
||||
target.Position = float3(100, 0, 0); // directly abeam
|
||||
shooter.SetTarget(target);
|
||||
shooter.Aim = float3(0, 0, -1); // astern, outside the arc: only a solution can fire the gun
|
||||
|
||||
var weapon = (Weapon) weaponItem.Behaviors.Single(b => b is Weapon);
|
||||
Assert.False(weapon.ArcAllowsFire);
|
||||
|
||||
target.Position = float3(0, 0, 100); // dead ahead
|
||||
shooter.Aim = float3(0, 0, 1); // the free aim fires, as a gun with no target would
|
||||
Assert.True(weapon.ArcAllowsFire);
|
||||
}
|
||||
|
||||
|
|
@ -489,6 +492,7 @@ public sealed class FireControlCut5Tests : IDisposable
|
|||
e.Shooter.Position = float3.zero;
|
||||
e.Target.Position = float3(100, 0, 0); // abeam -- outside the narrow 60-degree arc
|
||||
e.Shooter.SetTarget(e.Target);
|
||||
e.Shooter.Aim = float3(0, 0, -1); // astern, outside the arc: nothing bears and the aim is not free
|
||||
|
||||
var resolvedCount = 0;
|
||||
e.Zone.ShotResolved.Subscribe(_ => resolvedCount++);
|
||||
|
|
|
|||
|
|
@ -231,9 +231,9 @@ public sealed class FireControlCut6cTests : IDisposable
|
|||
var cache = AetheriaStores.Open(Catalog, Run(), Player());
|
||||
_openCaches.Add(cache);
|
||||
|
||||
// A minimal one-zone galaxy whose faction roster excludes Targeting Maker entirely, the same
|
||||
// SavedGame/Galaxy round trip RunSaveTests uses to build a real Galaxy without standing up full
|
||||
// procedural generation.
|
||||
// A minimal one-zone galaxy the same SavedGame/Galaxy round trip RunSaveTests uses builds, without standing
|
||||
// up full procedural generation. Its generator's faction is Maker, whose allegiance does not name
|
||||
// Targeting Maker, so IsAvailable rejects Targeting Maker's products by allegiance.
|
||||
var game = new SavedGame
|
||||
{
|
||||
Factions = new[] { maker },
|
||||
|
|
@ -250,13 +250,14 @@ public sealed class FireControlCut6cTests : IDisposable
|
|||
};
|
||||
RunSave.Commit(cache, game, zones, new ProvenanceLedger());
|
||||
var galaxy = new Galaxy(cache, cache.GetGlobal<SavedGame>(), _ => { });
|
||||
Assert.False(galaxy.ContainsFaction(targetingMaker));
|
||||
var makerFaction = cache.Get(maker);
|
||||
Assert.False(makerFaction.Allegiance.ContainsKey(targetingMaker));
|
||||
|
||||
var random = new Random(1u);
|
||||
var settings = TestSettings();
|
||||
var log = new List<string>();
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), settings, log.Add);
|
||||
var generator = new LoadoutGenerator(ref random, items, galaxy, null, null, .5f);
|
||||
var generator = new LoadoutGenerator(ref random, items, galaxy, null, makerFaction, .5f);
|
||||
|
||||
var pack = generator.GenerateShipLoadout(candidate => candidate.Name == "Armed");
|
||||
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ public sealed class FireControlCut7Tests : IDisposable
|
|||
Assert.NotEmpty(equippable);
|
||||
Assert.Contains(equippable, e => e is WeaponItemData);
|
||||
|
||||
var hull = cache.GetByName<HullData>("LonginusX");
|
||||
var hull = cache.GetByName<HullData>("Longinus");
|
||||
Assert.NotNull(hull);
|
||||
|
||||
var settings = new GameplaySettings
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ public sealed class FireControlCut9Tests : IDisposable
|
|||
// Even extents: CenterOfMass is the raw mean of integer cell coordinates (ItemData.cs), with no
|
||||
// +0.5 cell-centre offset -- an odd extent's mean lands exactly on an occupied cell (no cliff to
|
||||
// reproduce), while an even one lands on the half-cell boundary between two cells, the same
|
||||
// off-integer shape every shipped hull's real (irregular) footprint produces (LonginusX 2.5/6.697,
|
||||
// off-integer shape every shipped hull's real (irregular) footprint produces (Longinus 2.5/6.697,
|
||||
// Zenith 5.5/5.5, Turret 3.5/3.5).
|
||||
var hullShape = SolidShape(6, 12);
|
||||
|
||||
|
|
|
|||
|
|
@ -446,6 +446,24 @@ public sealed class MineTests : IDisposable
|
|||
Assert.True(shipsA[4].Hull.Durability < 1000000f);
|
||||
}
|
||||
|
||||
// The trigger gate never arcs a mine layer (FireControl.ArcPermitsFire; IsMineLayer is its own half of the
|
||||
// exemption). The layer is unfused, so the fused half cannot pass it: only the mine-layer exemption can. An unfused
|
||||
// layer lays nothing (Lay), so the gate is the layer this is decided at. The fixture checks the aim is outside
|
||||
// the arc, with no target designated, so the gate has no other way to pass.
|
||||
[Fact]
|
||||
public void AMineLayerPassesTheTriggerGateWithTheAimOutsideItsArc()
|
||||
{
|
||||
var lab = Build(fuseKind: null);
|
||||
Assert.Null(FireControl.FuseOf(lab.WeaponItem, out _));
|
||||
Assert.True(FireControl.IsMineLayer(lab.Weapon));
|
||||
lab.Layer.Aim = -FireControl.MountDirection(lab.WeaponItem);
|
||||
Assert.False(FireControl.InArc(lab.WeaponItem, lab.Layer.Aim), "fixture: the aim must be outside the arc");
|
||||
Assert.False(FireControl.Solution(lab.Weapon, lab.Layer, lab.Layer.Target.Value).Free);
|
||||
Assert.False(FireControl.Solution(lab.Weapon, lab.Layer, lab.Layer.Target.Value).Bears);
|
||||
|
||||
Assert.True(FireControl.ArcPermitsFire(lab.Weapon, lab.Layer));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LayingFiresNoShot()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -719,6 +719,7 @@ public sealed partial class MiningCut3Tests : IDisposable
|
|||
Tick((shooter, eyeAt));
|
||||
var gun = shooter.Weapons.Single();
|
||||
|
||||
shooter.Aim = float3(0, 0, -1); // astern: only a solution can fire the gun
|
||||
Assert.True(shooter.SetTarget(ahead));
|
||||
Assert.True(gun.ArcAllowsFire);
|
||||
Assert.True(gun.StanceAllowsFire);
|
||||
|
|
@ -728,6 +729,33 @@ public sealed partial class MiningCut3Tests : IDisposable
|
|||
Assert.True(gun.StanceAllowsFire);
|
||||
}
|
||||
|
||||
// The same bearing through the solution: a chunk ahead is a solution, one to the side is not, and a chunk is a
|
||||
// solution without a subject entity (its round flies the aim, as an untargeted one).
|
||||
[Fact]
|
||||
public void AChunkTargetBearsByItsPose()
|
||||
{
|
||||
var kind = Kind("Asteroid", 4f);
|
||||
var s = BuildScene(new[] { kind }, Belt(kind, Rock(150f, .25f), Rock(150f)));
|
||||
var eyeAt = float2(-10, 50);
|
||||
var shooter = SpawnShip(s, eyeAt, sensor: true, weaponRanges: 300f);
|
||||
Tick((shooter, eyeAt));
|
||||
var gun = shooter.Weapons.Single();
|
||||
|
||||
var ahead = FireControl.Solution(gun, shooter, new ChunkId(s.Belts[0], 0));
|
||||
var aside = FireControl.Solution(gun, shooter, new ChunkId(s.Belts[0], 1));
|
||||
|
||||
Assert.True(ahead.Bears);
|
||||
Assert.Null(ahead.Subject);
|
||||
Assert.False(aside.Bears);
|
||||
|
||||
// The bearing is the chunk's pose minus the shooter's position: from (100, -100) the side chunk at (150, 0)
|
||||
// is 26 degrees off the nose, though its pose sum with the shooter's position would be far abeam.
|
||||
var nearAt = float2(100, -100);
|
||||
var near = SpawnShip(s, nearAt, sensor: true, weaponRanges: 300f);
|
||||
Tick((shooter, eyeAt), (near, nearAt));
|
||||
Assert.True(FireControl.Solution(near.Weapons.Single(), near, new ChunkId(s.Belts[0], 1)).Bears);
|
||||
}
|
||||
|
||||
// A writable copy of the shipped catalog plus a scratch run store, through a registry scoped to the shipped
|
||||
// assembly's own document types (RestoredHullsTests' composition): this test assembly's own catalog global
|
||||
// would otherwise be demanded of a catalog that was never authored with it.
|
||||
|
|
|
|||
155
tests/Aetheria.Shared.Tests/PiratesFactionCommandTests.cs
Normal file
155
tests/Aetheria.Shared.Tests/PiratesFactionCommandTests.cs
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
/* 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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using GameCult.Caching;
|
||||
using GameCult.Caching.MessagePack;
|
||||
using Xunit;
|
||||
|
||||
// AetherDb's pirates-faction command (aetheria-release, cut pirates-record), run on a scratch copy of the shipped catalog
|
||||
// with the Pirates removed from it.
|
||||
public sealed class PiratesFactionCommandTests : IDisposable
|
||||
{
|
||||
private readonly string _root = Path.Combine(Path.GetTempPath(), "pirates-command-" + Guid.NewGuid().ToString("N"));
|
||||
private string CatalogPath => Path.Combine(_root, "GameData", "Aetheria.cc");
|
||||
|
||||
public PiratesFactionCommandTests()
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(_root, "GameData"));
|
||||
File.Copy(Path.Combine(AetherDb.FindRoot(), "GameData", "Aetheria.cc"), CatalogPath);
|
||||
// AetherDb.Open composes the process-wide registry, which in this test host also sees this assembly's TestCatalogGlobal
|
||||
// (see FireControlCut7Tests). So the copy is stripped through a registry scoped to the shipped assembly and then given
|
||||
// the record that registry's shared sibling demands, as AetheriaStoresTests does.
|
||||
var registry = CultDocumentRegistry.ForTypes(typeof(ItemData).Assembly.GetTypes()
|
||||
.Where(t => t is { IsAbstract: false, IsInterface: false })
|
||||
.Where(t => t.GetCustomAttribute<CultDocumentAttribute>() != null));
|
||||
using (var cache = new CultCache(registry))
|
||||
{
|
||||
cache.AddBackingStore(new SingleFileMessagePackBackingStore(CatalogPath), AetheriaStores.CatalogTypes);
|
||||
var pirates = cache.GetAll<Faction>().Single(faction => faction.Name == "Pirates");
|
||||
var ours = cache.RefOf(pirates);
|
||||
foreach (var product in cache.GetAll<FactionProductData>().Where(product => product.Manufacturer.Equals(ours)).ToArray())
|
||||
Assert.True(cache.Remove(cache.RefOf(product).Key));
|
||||
Assert.True(cache.Remove(ours.Key));
|
||||
cache.FlushAsync().Wait();
|
||||
}
|
||||
using (var cache = new CultCache())
|
||||
{
|
||||
cache.AddBackingStore(new SingleFileMessagePackBackingStore(CatalogPath), AetheriaStores.CatalogTypes);
|
||||
cache.Upsert(new TestCatalogGlobal { Name = "Temperament" });
|
||||
cache.FlushAsync().Wait();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose() => Directory.Delete(_root, true);
|
||||
|
||||
private (Faction[] Pirates, FactionProductData[] Products) Read()
|
||||
{
|
||||
var db = AetherDb.Open(root: _root);
|
||||
try
|
||||
{
|
||||
var pirates = db.Cache.GetAll<Faction>().Where(faction => faction.Name == "Pirates").ToArray();
|
||||
var products = pirates.Length == 0 ? new FactionProductData[0]
|
||||
: db.Cache.GetAll<FactionProductData>().Where(product => product.Manufacturer.Equals(db.Cache.RefOf(pirates[0]))).ToArray();
|
||||
return (pirates, products);
|
||||
}
|
||||
finally { db.Cache.Dispose(); }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_dry_run_writes_nothing_and_apply_lands_the_record_once()
|
||||
{
|
||||
var before = File.ReadAllBytes(CatalogPath);
|
||||
Assert.Equal(0, Program.PiratesFaction(apply: false, root: _root));
|
||||
Assert.Equal(before, File.ReadAllBytes(CatalogPath));
|
||||
Assert.Empty(Read().Pirates);
|
||||
|
||||
Assert.Equal(0, Program.PiratesFaction(apply: true, root: _root));
|
||||
var landed = File.ReadAllBytes(CatalogPath);
|
||||
var (pirates, products) = Read();
|
||||
var faction = Assert.Single(pirates);
|
||||
Assert.Equal("Pirates", faction.ShortName);
|
||||
Assert.StartsWith("A loose coalition of crews and hidden docks", faction.Description);
|
||||
Assert.Equal(3, faction.InfluenceDistance);
|
||||
Assert.Equal(new CultMath.float3(.42f, .40f, .37f), faction.PrimaryColor);
|
||||
Assert.Equal(new CultMath.float3(1f, .45f, .05f), faction.SecondaryColor);
|
||||
Assert.Equal(12, faction.Allegiance.Count);
|
||||
Assert.All(faction.Allegiance.Values, value => Assert.Equal(1f, value));
|
||||
|
||||
var db = AetherDb.Open(root: _root);
|
||||
try
|
||||
{
|
||||
Assert.Equal("pleiades", db.Cache.Get(faction.GeonameFile).Name);
|
||||
var expected = new (string Design, string Name, string Description)[]
|
||||
{
|
||||
("Autocannon", "🫳🔫", "Serial number filed off. Still shoots."),
|
||||
("Earp", "🪦🤠", "The previous owner had no further use for it."),
|
||||
("FastBlast+-", "🧾🚫", "Warranty void where prohibited, which is everywhere."),
|
||||
("6k Shooter", "🎨🙈", "The logo underneath is somebody else's problem."),
|
||||
("scorched void policy", "🔥", "Turns out we did start the fire after all."),
|
||||
("Targeting Computer", "👀🎯", "Somebody else's eyes. They still work."),
|
||||
("Small Drive", "🔑🏃💨", "Hotwired. Do not ask about the ignition."),
|
||||
("Store-All Plus", "📦🤫", "Contents not as declared."),
|
||||
};
|
||||
Assert.Equal(expected.Select(e => e.Name).OrderBy(n => n, StringComparer.Ordinal), products.Select(p => p.Name).OrderBy(n => n, StringComparer.Ordinal));
|
||||
foreach (var (designName, name, description) in expected)
|
||||
{
|
||||
var product = products.Single(p => p.Name == name);
|
||||
var design = (CraftedItemData) db.Cache.Get(product.Design);
|
||||
Assert.Equal(designName, design.Name);
|
||||
Assert.Equal(description, product.Description);
|
||||
Assert.Equal((design.Roles ?? new List<ItemRole>()).Select(role => role.Name), (product.Roles ?? new List<ProductRole>()).Select(role => role.Role));
|
||||
Assert.All(product.Roles, role => { Assert.Equal(.45f, role.Mean); Assert.Equal(.22f, role.StandardDeviation); });
|
||||
}
|
||||
}
|
||||
finally { db.Cache.Dispose(); }
|
||||
|
||||
// A second apply finds the faction and changes nothing.
|
||||
Assert.Equal(0, Program.PiratesFaction(apply: true, root: _root));
|
||||
Assert.Equal(landed, File.ReadAllBytes(CatalogPath));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void An_existing_Pirates_faction_is_left_as_it_is()
|
||||
{
|
||||
var db = AetherDb.Open(catalogWritable: true, root: _root);
|
||||
db.Cache.Commit(batch => batch.Upsert(typeof(Faction), new Faction { Name = "Pirates", ShortName = "Mine", Description = "authored by hand" }));
|
||||
db.Cache.Dispose();
|
||||
|
||||
Assert.Equal(0, Program.PiratesFaction(apply: true, root: _root));
|
||||
var (pirates, products) = Read();
|
||||
Assert.Equal("authored by hand", Assert.Single(pirates).Description);
|
||||
Assert.Empty(products);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_missing_design_refuses_and_lands_nothing()
|
||||
{
|
||||
var db = AetherDb.Open(catalogWritable: true, root: _root);
|
||||
var autocannon = db.Cache.GetAll<WeaponItemData>().Single(weapon => weapon.Name == "Autocannon");
|
||||
autocannon.Name = "Autocannon (renamed)";
|
||||
db.Cache.Commit(batch => batch.Upsert(typeof(WeaponItemData), autocannon, db.Cache.RefOf(autocannon).Key));
|
||||
db.Cache.Dispose();
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() => Program.PiratesFaction(apply: true, root: _root));
|
||||
Assert.Empty(Read().Pirates);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_missing_name_file_refuses_and_lands_nothing()
|
||||
{
|
||||
var db = AetherDb.Open(catalogWritable: true, root: _root);
|
||||
var pleiades = db.Cache.GetAll<NameFile>().Single(file => file.Name == "pleiades");
|
||||
Assert.True(db.Cache.Remove(db.Cache.RefOf(pleiades).Key));
|
||||
db.Cache.FlushAsync().Wait();
|
||||
db.Cache.Dispose();
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() => Program.PiratesFaction(apply: true, root: _root));
|
||||
Assert.Empty(Read().Pirates);
|
||||
}
|
||||
}
|
||||
67
tests/Aetheria.Shared.Tests/PiratesRecordTests.cs
Normal file
67
tests/Aetheria.Shared.Tests/PiratesRecordTests.cs
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/* 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 System;
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
|
||||
// The Pirates record (aetheria-release, cut pirates-record): the shipped catalog's faction of rebrands, named in emoji.
|
||||
public sealed partial class RunStartTests
|
||||
{
|
||||
private Faction ShippedPirates() => _cache.GetAll<Faction>().Single(faction => faction.Name == "Pirates");
|
||||
|
||||
private FactionProductData[] PiratesProducts()
|
||||
{
|
||||
var pirates = _cache.RefOf(ShippedPirates());
|
||||
return _cache.GetAll<FactionProductData>().Where(product => product.Manufacturer.Equals(pirates)).ToArray();
|
||||
}
|
||||
|
||||
// The demo's allied faction exists as catalog data with eight generatable rebrands of other makers' designs.
|
||||
[Fact]
|
||||
public void PiratesAreInTheShippedCatalog()
|
||||
{
|
||||
var pirates = ShippedPirates();
|
||||
var others = _cache.GetAll<Faction>().Where(faction => faction != pirates).Select(faction => _cache.RefOf(faction)).ToArray();
|
||||
Assert.NotEmpty(others);
|
||||
Assert.All(others, other => Assert.True(pirates.Allegiance.ContainsKey(other)));
|
||||
Assert.NotNull(_cache.Get(pirates.GeonameFile));
|
||||
|
||||
var products = PiratesProducts();
|
||||
Assert.Equal(8, products.Length);
|
||||
var hulls = _cache.GetAll<HullData>().ToArray();
|
||||
foreach (var product in products)
|
||||
{
|
||||
var design = _cache.Get(product.Design) as EquippableItemData;
|
||||
Assert.NotNull(design);
|
||||
Assert.True(LoadoutGenerator.HasHome(design, hulls), $"{design.Name} has no home");
|
||||
Assert.True(design.Price > 0, $"{design.Name} has no price");
|
||||
Assert.Contains(_cache.GetAll<FactionProductData>(), other =>
|
||||
other.Design.Key.Equals(product.Design.Key) && !other.Manufacturer.Equals(product.Manufacturer));
|
||||
}
|
||||
}
|
||||
|
||||
// The Pirates' products are named in emoji and nothing else: no ASCII letter or digit survives in a name.
|
||||
[Fact]
|
||||
public void PiratesProductsAreNamedInEmoji()
|
||||
{
|
||||
foreach (var product in PiratesProducts())
|
||||
{
|
||||
Assert.False(string.IsNullOrEmpty(product.Name));
|
||||
Assert.DoesNotContain(product.Name, character => character < 128 && char.IsLetterOrDigit(character));
|
||||
Assert.Contains(product.Name.EnumerateRunes(), rune => rune.Value >= 0x1F000);
|
||||
}
|
||||
}
|
||||
|
||||
// Brand finds a lot's product by (maker, design), so a maker may sell one product per design.
|
||||
[Fact]
|
||||
public void NoMakerSellsTwoProductsOfOneDesign()
|
||||
{
|
||||
var twice = _cache.GetAll<FactionProductData>()
|
||||
.GroupBy(product => (Maker: product.Manufacturer.Key.Value, Design: product.Design.Key.Value))
|
||||
.Where(group => group.Count() > 1)
|
||||
.Select(group => string.Join(", ", group.Select(product => product.Name)))
|
||||
.ToArray();
|
||||
Assert.Empty(twice);
|
||||
}
|
||||
}
|
||||
|
|
@ -201,6 +201,23 @@ public sealed class RestoredHullsTests
|
|||
}
|
||||
}
|
||||
|
||||
// The dock intro dereferences the ship's VelocityLimit unguarded (ActionGameManager), so every ship hull the catalog
|
||||
// ships carries exactly one, with a top speed that is a finite positive number. After the retirement
|
||||
// (ruling retire-longinusx) the shipped ship hulls are the Longinus and the Djinni.
|
||||
[Fact]
|
||||
public void EveryShippedShipHullHasATopSpeed()
|
||||
{
|
||||
using var cache = OpenCatalog();
|
||||
var ships = cache.GetAll<HullData>().Where(h => h.HullType == HullType.Ship).OrderBy(h => h.Name, StringComparer.Ordinal).ToArray();
|
||||
Assert.Equal(new[] { "Djinni", "Longinus" }, ships.Select(h => h.Name));
|
||||
foreach (var hull in ships)
|
||||
{
|
||||
Assert.Single(hull.Behaviors.OfType<VelocityLimitData>());
|
||||
var limit = BuildThrustedShip(cache, hull.Name).GetBehavior<VelocityLimit>().Limit;
|
||||
Assert.True(float.IsFinite(limit) && limit > 0f, $"{hull.Name}'s top speed is {limit}");
|
||||
}
|
||||
}
|
||||
|
||||
// A restored hull with every thruster hardpoint (and its reactor) filled, activated and warmed up: the
|
||||
// rotation thrusters the helm tests need. The caller owns the cache.
|
||||
internal static Ship BuildThrustedShip(CultCache cache, string name)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void Boss_spawns_once_in_boss_zone()
|
||||
{
|
||||
AddPirates();
|
||||
foreach (var seed in DemoSeeds.Take(3))
|
||||
{
|
||||
var galaxy = DemoGalaxy(seed);
|
||||
|
|
@ -65,7 +64,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void Boss_spawns_in_a_zone_that_is_not_ambient()
|
||||
{
|
||||
AddPirates();
|
||||
var galaxy = DemoGalaxy(1);
|
||||
var pack = BossZonePack(galaxy, _items, galaxy.Exit, ambient: false);
|
||||
Assert.Single(pack.Entities, entity => entity.Boss);
|
||||
|
|
@ -75,7 +73,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void Boss_hull_from_BossHull_else_fallback()
|
||||
{
|
||||
AddPirates();
|
||||
var galaxy = DemoGalaxy(1);
|
||||
var antagonist = Zhestokost(galaxy);
|
||||
var hulls = SoldShipHulls().OrderByDescending(hull => hull.Price).ThenBy(hull => hull.Name, StringComparer.Ordinal).ToArray();
|
||||
|
|
@ -103,7 +100,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void Boss_hull_nobody_sells_falls_back()
|
||||
{
|
||||
AddPirates();
|
||||
var galaxy = DemoGalaxy(1);
|
||||
var antagonist = Zhestokost(galaxy);
|
||||
var sold = SoldShipHulls();
|
||||
|
|
@ -121,7 +117,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void Exit_sealed_until_boss_dies()
|
||||
{
|
||||
AddPirates();
|
||||
var galaxy = DemoGalaxy(1);
|
||||
var exit = ZoneOf(galaxy, galaxy.Exit);
|
||||
var boss = Assert.Single(exit.Entities, entity => entity.IsBoss);
|
||||
|
|
@ -143,7 +138,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void Boss_mark_survives_continue()
|
||||
{
|
||||
AddPirates();
|
||||
var (galaxy, arena, staged, failures) = Launch(new DemoTerminus(), Inputs(() => 1));
|
||||
Assert.True(failures.Count == 0, string.Join("; ", failures));
|
||||
galaxy.Entrance.Contents = arena;
|
||||
|
|
@ -185,7 +179,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void Exit_sealed_and_logged_when_the_boss_cannot_be_generated()
|
||||
{
|
||||
AddPirates();
|
||||
var galaxy = DemoGalaxy(1);
|
||||
galaxy.BossZones.Clear();
|
||||
var log = new List<string>();
|
||||
|
|
@ -201,7 +194,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void Exit_open_after_save_of_a_slain_boss()
|
||||
{
|
||||
AddPirates();
|
||||
var galaxy = DemoGalaxy(1);
|
||||
var exit = ZoneOf(galaxy, galaxy.Exit);
|
||||
Assert.Single(exit.Entities, entity => entity.IsBoss).HeatstrokeDeath.OnNext(Unit.Default);
|
||||
|
|
@ -215,7 +207,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void Exit_gate_shares_no_point_with_a_wormhole()
|
||||
{
|
||||
AddPirates();
|
||||
var ratio = float.Parse(File.ReadLines(Path.Combine(FindRepoRoot(), "Assets", "Resources", "Settings.asset"))
|
||||
.Select(line => Regex.Match(line, @"^ WormholeDistanceRatio: (.+)$")).First(match => match.Success).Groups[1].Value.Trim(),
|
||||
System.Globalization.CultureInfo.InvariantCulture);
|
||||
|
|
@ -244,7 +235,6 @@ public sealed partial class RunStartTests
|
|||
[InlineData(new[] { 0.0, 45.0, 90.0, 135.0, 180.0, -135.0, -90.0, -45.0 })]
|
||||
public void Exit_gate_sits_in_the_widest_gap_at_the_wormhole_radius(double[] neighbourDegrees)
|
||||
{
|
||||
AddPirates();
|
||||
var galaxy = DemoGalaxy(1);
|
||||
var zone = ZoneOf(galaxy, galaxy.Exit);
|
||||
const float ratio = 0.75f;
|
||||
|
|
|
|||
134
tests/Aetheria.Shared.Tests/RunStartGearTests.cs
Normal file
134
tests/Aetheria.Shared.Tests/RunStartGearTests.cs
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
/* 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 System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using GameCult.Caching;
|
||||
using Xunit;
|
||||
|
||||
// Gear does not need its maker present: LoadoutGenerator.IsAvailable reaches by allegiance alone, and an absent
|
||||
// maker only weighs less (operator, 2026-10-06: a faction need not be present in the galaxy for its gear to be
|
||||
// available). Every galaxy reaches the same way, the prelude included.
|
||||
public sealed partial class RunStartTests
|
||||
{
|
||||
// A maker the galaxy does not carry, with one product made from a real design, and a generator for a fresh
|
||||
// faction whose allegiance names exactly the makers given (the absent one among them, or not).
|
||||
private (FactionProductData product, Faction absent) AbsentMaker(string name)
|
||||
{
|
||||
var absent = new Faction { Name = name, ShortName = name };
|
||||
_cache.Upsert(absent);
|
||||
var design = _cache.GetAll<FactionProductData>().First(p => p.Manufacturer.IsSet()).Design;
|
||||
var product = new FactionProductData { Name = name + " Product", Design = design, Manufacturer = _cache.RefOf(absent) };
|
||||
_cache.Upsert(product);
|
||||
return (product, absent);
|
||||
}
|
||||
|
||||
private LoadoutGenerator GeneratorFor(Galaxy galaxy, string name, params Faction[] allies)
|
||||
{
|
||||
var faction = new Faction { Name = name, ShortName = name };
|
||||
_cache.Upsert(faction);
|
||||
foreach (var ally in allies) faction.Allegiance[_cache.RefOf(ally)] = 1;
|
||||
return new LoadoutGenerator(ref _items.Random, _items, galaxy, galaxy.Entrance, faction, .5f);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AnAbsentMakersGearIsAvailableThroughAllegiance()
|
||||
{
|
||||
var galaxy = MainSectorGalaxy();
|
||||
var (product, absent) = AbsentMaker("AbsentAlly");
|
||||
Assert.DoesNotContain(galaxy.Factions, f => f == absent);
|
||||
Assert.True(GeneratorFor(galaxy, "Friend", absent).IsAvailable(product));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AnAbsentMakerOutsideAllegianceIsNot()
|
||||
{
|
||||
var galaxy = MainSectorGalaxy();
|
||||
var (product, _) = AbsentMaker("AbsentStranger");
|
||||
Assert.False(GeneratorFor(galaxy, "Loner").IsAvailable(product));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AFactionlessGeneratorReachesEveryMaker()
|
||||
{
|
||||
var galaxy = MainSectorGalaxy();
|
||||
AbsentMaker("AbsentToAll");
|
||||
var generator = new LoadoutGenerator(ref _items.Random, _items, galaxy, galaxy.Entrance, null, .5f);
|
||||
var products = _cache.GetAll<FactionProductData>().Where(p => p.Manufacturer.IsSet()).ToArray();
|
||||
Assert.NotEmpty(products);
|
||||
Assert.All(products, product => Assert.True(generator.IsAvailable(product), product.Name));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AnAbsentMakerWeighsAsTheFarthest()
|
||||
{
|
||||
var galaxy = MainSectorGalaxy();
|
||||
var (product, absent) = AbsentMaker("AbsentFar");
|
||||
var zone = galaxy.Entrance;
|
||||
var farthest = galaxy.Factions
|
||||
.Where(f => galaxy.HomeZones.TryGetValue(f, out var home) && zone.Distance.ContainsKey(home))
|
||||
.OrderByDescending(f => zone.Distance[galaxy.HomeZones[f]]).First();
|
||||
var generator = GeneratorFor(galaxy, "Trader", absent, farthest);
|
||||
var absentWeight = generator.ManufacturerPreference(product.Manufacturer);
|
||||
var farthestWeight = generator.ManufacturerPreference(_cache.RefOf(farthest));
|
||||
Assert.True(absentWeight > 0, "an absent ally is reachable");
|
||||
Assert.True(absentWeight < farthestWeight, $"absent {absentWeight} must weigh below the farthest present maker {farthestWeight}");
|
||||
Assert.Equal(1f / (2 + zone.Distance.Values.Max()), absentWeight);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void APreludeNoLongerOffersEverything()
|
||||
{
|
||||
Assert.True(_galaxy.IsPrelude);
|
||||
var (absentProduct, _) = AbsentMaker("AbsentToPrelude");
|
||||
var generator = GeneratorFor(_galaxy, "PreludeLoner");
|
||||
Assert.False(generator.IsAvailable(absentProduct));
|
||||
var present = _cache.GetAll<FactionProductData>().Where(p => p.Manufacturer.IsSet() &&
|
||||
_galaxy.Factions.Any(f => _cache.RefOf(f).Key.Equals(p.Manufacturer.Key))).ToArray();
|
||||
Assert.NotEmpty(present);
|
||||
Assert.All(present, product => Assert.False(generator.IsAvailable(product), product.Name));
|
||||
}
|
||||
|
||||
// Preference only weighs by distance when there is a galaxy and a faction to weigh for.
|
||||
[Fact]
|
||||
public void PreferenceIsNeutralWithoutAGalaxyOrAFaction()
|
||||
{
|
||||
var galaxy = MainSectorGalaxy();
|
||||
var (product, absent) = AbsentMaker("AbsentNeutral");
|
||||
var faction = galaxy.Factions.First();
|
||||
var noGalaxy = new LoadoutGenerator(ref _items.Random, _items, null, null, faction, .5f);
|
||||
var noFaction = new LoadoutGenerator(ref _items.Random, _items, galaxy, galaxy.Entrance, null, .5f);
|
||||
Assert.Equal(1f, noGalaxy.ManufacturerPreference(product.Manufacturer));
|
||||
Assert.Equal(1f, noFaction.ManufacturerPreference(product.Manufacturer));
|
||||
}
|
||||
|
||||
// A maker the generator's faction does not name weighs nothing, present or not.
|
||||
[Fact]
|
||||
public void AMakerOutsideAllegianceWeighsNothing()
|
||||
{
|
||||
var galaxy = MainSectorGalaxy();
|
||||
var (product, _) = AbsentMaker("AbsentUnnamed");
|
||||
var generator = GeneratorFor(galaxy, "Hermit");
|
||||
var stranger = galaxy.Factions.First();
|
||||
Assert.Equal(0f, generator.ManufacturerPreference(product.Manufacturer));
|
||||
Assert.Equal(0f, generator.ManufacturerPreference(_cache.RefOf(stranger)));
|
||||
}
|
||||
|
||||
// The distance table decides: a present maker whose home the table does not reach adds no distance, an absent
|
||||
// maker is one jump past the table's farthest zone, and an empty table adds none either way.
|
||||
[Fact]
|
||||
public void ADistanceTableOnlyDistancesTheMakersItNames()
|
||||
{
|
||||
var galaxy = MainSectorGalaxy();
|
||||
var (product, absent) = AbsentMaker("AbsentOffTable");
|
||||
var present = galaxy.Factions.First(f => galaxy.HomeZones.TryGetValue(f, out var home) && home != galaxy.Entrance);
|
||||
var friend = GeneratorFor(galaxy, "Ally", absent, present);
|
||||
var table = new GalaxyZone { Distance = new Dictionary<GalaxyZone, int> { { galaxy.Entrance, 0 } } };
|
||||
var generator = new LoadoutGenerator(ref _items.Random, _items, galaxy, table, friend.Faction, .5f);
|
||||
Assert.Equal(1f, generator.ManufacturerPreference(_cache.RefOf(present))); // home not in the table: distance 0
|
||||
Assert.Equal(.5f, generator.ManufacturerPreference(product.Manufacturer)); // absent: 0 + 1
|
||||
var empty = new LoadoutGenerator(ref _items.Random, _items, galaxy, new GalaxyZone { Distance = new Dictionary<GalaxyZone, int>() }, friend.Faction, .5f);
|
||||
Assert.Equal(1f, empty.ManufacturerPreference(product.Manufacturer));
|
||||
}
|
||||
}
|
||||
|
|
@ -119,8 +119,8 @@ public sealed partial class RunStartTests : IDisposable
|
|||
|
||||
private const float Freezing = 273.15f;
|
||||
|
||||
// A main-sector galaxy (not the prelude, which offers every product): each station's gear must come from
|
||||
// manufacturers its faction can reach, the galaxy's factions its allegiance names.
|
||||
// A main-sector galaxy: each station's gear must come from manufacturers its faction can reach, the makers its
|
||||
// allegiance names, present in the galaxy or not.
|
||||
private Galaxy MainSectorGalaxy()
|
||||
{
|
||||
var authored = AuthoredSettings.Load(FindRepoRoot());
|
||||
|
|
@ -670,7 +670,7 @@ public sealed partial class RunStartTests : IDisposable
|
|||
public void TheRealHullsMaterializeBareFromABrandedProduct()
|
||||
{
|
||||
var available = new LoadoutGenerator(ref _items.Random, _items, _galaxy, _galaxy.Entrance, null, 2);
|
||||
foreach (var hull in new[] { Hull("Djinni"), Hull("LonginusX"), TurretHull() })
|
||||
foreach (var hull in new[] { Hull("Djinni"), Hull("Longinus"), TurretHull() })
|
||||
{
|
||||
var failures = new List<string>();
|
||||
var entity = Loadouts.Materialize(_items, null, BareLoadout(hull), available.IsAvailable, failures);
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void EveryScenarioStages()
|
||||
{
|
||||
AddPirates();
|
||||
Assert.Equal(EveryScenario.Count(), EveryScenario.Select(scenario => scenario.Name).Distinct().Count());
|
||||
foreach (var scenario in EveryScenario)
|
||||
{
|
||||
|
|
@ -130,7 +129,7 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void ModesMatchOldNewGame()
|
||||
{
|
||||
Assert.Equal("LonginusX", _startingHull);
|
||||
Assert.Equal("Longinus", _startingHull);
|
||||
|
||||
var tutorial = Launch(new TutorialGalaxy(), Inputs(() => GalaxySeed));
|
||||
Assert.Empty(tutorial.failures);
|
||||
|
|
@ -286,8 +285,8 @@ public sealed partial class RunStartTests
|
|||
var failures = Refused(Arena(true), new Scripted(true, stage =>
|
||||
{
|
||||
stage.Player(stage.Bare("Djinni"), float2(0, 0));
|
||||
stage.Place(stage.Generated("LonginusX"), float2(300, 0), stance: ScenarioStance.Hostile, piloted: true);
|
||||
stage.Place(stage.Fit("LonginusX", ("No Such Gun", int2(1, 8), ItemRotation.None)), float2(-300, 0));
|
||||
stage.Place(stage.Generated("Longinus"), float2(300, 0), stance: ScenarioStance.Hostile, piloted: true);
|
||||
stage.Place(stage.Fit("Longinus", ("No Such Gun", int2(1, 8), ItemRotation.None)), float2(-300, 0));
|
||||
}));
|
||||
Assert.Contains("No Such Gun", Assert.Single(failures));
|
||||
}
|
||||
|
|
@ -302,8 +301,8 @@ public sealed partial class RunStartTests
|
|||
var staged = Stage(zone, new Scripted(true, stage =>
|
||||
{
|
||||
stage.Player(stage.Bare("Djinni"), float2(0, 0));
|
||||
stage.Place(stage.Generated("LonginusX"), float2(300, 0), stance: ScenarioStance.Hostile, piloted: true);
|
||||
stage.Place(stage.Bare("LonginusX"), float2(-300, 0), stance: ScenarioStance.Neutral, piloted: false);
|
||||
stage.Place(stage.Generated("Longinus"), float2(300, 0), stance: ScenarioStance.Hostile, piloted: true);
|
||||
stage.Place(stage.Bare("Longinus"), float2(-300, 0), stance: ScenarioStance.Neutral, piloted: false);
|
||||
}));
|
||||
var player = staged.Player;
|
||||
var hostile = staged.Entities[0];
|
||||
|
|
@ -337,8 +336,8 @@ public sealed partial class RunStartTests
|
|||
var staged = Stage(zone, new Scripted(true, stage =>
|
||||
{
|
||||
stage.Player(stage.Bare("Djinni"), float2(0, 0));
|
||||
stage.Place(stage.Bare("LonginusX"), float2(300, 0), stance: ScenarioStance.Hostile);
|
||||
stage.Place(stage.Bare("LonginusX"), float2(-300, 0), stance: ScenarioStance.Hostile);
|
||||
stage.Place(stage.Bare("Longinus"), float2(300, 0), stance: ScenarioStance.Hostile);
|
||||
stage.Place(stage.Bare("Longinus"), float2(-300, 0), stance: ScenarioStance.Hostile);
|
||||
}));
|
||||
var player = staged.Player;
|
||||
var hostile = staged.Entities[0];
|
||||
|
|
@ -523,7 +522,6 @@ public sealed partial class RunStartTests
|
|||
[Fact]
|
||||
public void EveryUnsoldDesignIsAScenarioTestDesign()
|
||||
{
|
||||
AddPirates();
|
||||
var runs = EveryScenario.Select(scenario => Launch(scenario, Inputs(() => GalaxySeed)).staged).ToList();
|
||||
Assert.Empty(UnsoldAndUnplaced(runs));
|
||||
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ public sealed class ShipAuthoringTests
|
|||
[Theory]
|
||||
[InlineData(HardpointType.Hull), InlineData(HardpointType.Tool), InlineData(HardpointType.Thermal), InlineData(HardpointType.WarpDrive),
|
||||
InlineData(HardpointType.Reactor), InlineData(HardpointType.Shield), InlineData(HardpointType.Sensors),
|
||||
InlineData(HardpointType.ControlModule), InlineData(HardpointType.AetherDrive)]
|
||||
InlineData(HardpointType.ControlModule)]
|
||||
public void AnInternalHardpointCarriesNoAnchor(HardpointType type)
|
||||
{
|
||||
WithOnly(type).Validate();
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public sealed class ShipValidationTests
|
|||
var ship = ShipAuthoringTests.Fixture();
|
||||
ship.Hull.Hardpoints[0].Armor = 5;
|
||||
ship.Hull.Hardpoints[0].FiringArc = 360;
|
||||
ship.Hull.Hardpoints[0].Type = HardpointType.AetherDrive;
|
||||
ship.Hull.Hardpoints[0].Type = HardpointType.ControlModule;
|
||||
ship.Visual.Anchors.RemoveAll(anchor => anchor.Id == "thruster.port");
|
||||
ship.Hull.Hardpoints[0].Rotation = ItemRotation.Clockwise;
|
||||
ship.Validate();
|
||||
|
|
|
|||
210
tests/Aetheria.Shared.Tests/SolutionTests.cs
Normal file
210
tests/Aetheria.Shared.Tests/SolutionTests.cs
Normal file
|
|
@ -0,0 +1,210 @@
|
|||
/* 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 CultMath;
|
||||
using Xunit;
|
||||
using static CultMath.math;
|
||||
using float2 = CultMath.float2;
|
||||
using float3 = CultMath.float3;
|
||||
|
||||
// Controls 2 (rulings fire-on-solutions, controls-solution-subject, controls-solution-trigger): FireControl.Solution is
|
||||
// each gun's one solution against the designated target, and ArcPermitsFire is the one trigger gate over it. The
|
||||
// fixture is FireControlCut124Tests': a forward mount at the origin facing +z, the designated target 100 ahead.
|
||||
public sealed partial class FireControlCut124Tests
|
||||
{
|
||||
private const float SolutionArc = 120f;
|
||||
|
||||
private static GunSolution SolutionOf(Engagement e) => FireControl.Solution(e.Weapon, e.Shooter, e.Shooter.Target.Value);
|
||||
|
||||
// A designated target in the arc is fired on whatever the aim says; the round goes to its intercept, not the aim.
|
||||
// Kills an aim-only gate (the astern aim holds) and a direction that ignores the subject.
|
||||
[Fact]
|
||||
public void ASolutionFiresWithoutTheAim()
|
||||
{
|
||||
var e = Build(TestSettings(), SolidShape(5, 4), hardpointArc: SolutionArc);
|
||||
Aim(e, float2(0, -1));
|
||||
|
||||
var solution = SolutionOf(e);
|
||||
|
||||
Assert.True(FireControl.ArcPermitsFire(e.Weapon, e.Shooter));
|
||||
Assert.True(solution.Bears);
|
||||
Assert.False(solution.Free);
|
||||
Assert.Same(e.Target, solution.Subject);
|
||||
Near(FireControl.TravelDirection(e.Weapon, e.Shooter, e.Target), solution.Direction);
|
||||
Near(float2(0, 1), solution.Direction);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FreeFireNeedsTheAimInArc()
|
||||
{
|
||||
var e = Build(TestSettings(), SolidShape(5, 4), hardpointArc: SolutionArc);
|
||||
e.Shooter.SetTarget(TargetRef.None);
|
||||
|
||||
Aim(e, float2(0, 1));
|
||||
Assert.True(FireControl.ArcPermitsFire(e.Weapon, e.Shooter));
|
||||
var free = SolutionOf(e);
|
||||
Assert.True(free.Free);
|
||||
Assert.False(free.Bears);
|
||||
Near(float2(0, 1), free.Direction);
|
||||
|
||||
Aim(e, float2(0, -1));
|
||||
Assert.False(FireControl.ArcPermitsFire(e.Weapon, e.Shooter));
|
||||
Assert.False(SolutionOf(e).Free);
|
||||
}
|
||||
|
||||
// A designated target 90 degrees off a 120 degree forward mount gives no solution. With the aim astern the gun
|
||||
// holds; with the aim ahead it fires free along the aim, and the price of that shot is zero.
|
||||
[Fact]
|
||||
public void ATargetOutOfArcGivesNoSolution()
|
||||
{
|
||||
var e = Build(TestSettings(), SolidShape(5, 4), hardpointArc: SolutionArc, weaponRange: 200f);
|
||||
e.Target.Position = e.Shooter.Position + float3(100, 0, 0);
|
||||
|
||||
Aim(e, float2(0, -1));
|
||||
Assert.False(SolutionOf(e).Bears);
|
||||
Assert.False(FireControl.ArcPermitsFire(e.Weapon, e.Shooter));
|
||||
|
||||
Aim(e, float2(0, 1));
|
||||
var solution = SolutionOf(e);
|
||||
Assert.False(solution.Bears);
|
||||
Assert.True(solution.Free);
|
||||
Assert.True(FireControl.ArcPermitsFire(e.Weapon, e.Shooter));
|
||||
Near(float2(0, 1), solution.Direction);
|
||||
Assert.True(ReferenceEquals(e.Target, solution.Subject), "a designated target out of arc is still the solution's subject");
|
||||
Assert.Equal(0f, FireControl.HitProbability(e.Weapon, e.Shooter, e.Target));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AFusedWeaponIgnoresTheGate()
|
||||
{
|
||||
var e = Build(TestSettings(), SolidShape(5, 4), fuse: WeaponFuse.Proximity, blastRadius: 4f, weaponRange: NoLockRange, hardpointArc: SolutionArc);
|
||||
e.Shooter.SetTarget(TargetRef.None);
|
||||
Aim(e, float2(0, -1));
|
||||
|
||||
var solution = SolutionOf(e);
|
||||
|
||||
Assert.False(solution.Bears);
|
||||
Assert.False(solution.Free);
|
||||
Assert.True(FireControl.ArcPermitsFire(e.Weapon, e.Shooter));
|
||||
}
|
||||
|
||||
// HitProbability above zero implies Bears and no Bears means no price, over bearings, ranges and visibility around
|
||||
// a weapon of range 100: the price's gate and the solution's are the one Bears. The grid is checked to price
|
||||
// something, so a gate that closed everything could not pass it.
|
||||
[Fact]
|
||||
public void BearsIsThePricesGate()
|
||||
{
|
||||
var e = Build(TestSettings(), SolidShape(5, 4), hardpointArc: SolutionArc, weaponRange: 100f);
|
||||
var priced = 0;
|
||||
foreach (var degrees in new[] { 0f, 30f, 59f, 61f, 90f, 135f, 180f })
|
||||
foreach (var range in new[] { 20f, 99f, 101f, 150f })
|
||||
foreach (var visible in new[] { true, false })
|
||||
{
|
||||
var at = radians(degrees);
|
||||
e.Target.Position = e.Shooter.Position + float3(sin(at), 0, cos(at)) * range;
|
||||
if (visible && !e.Shooter.VisibleEntities.Contains(e.Target)) e.Shooter.VisibleEntities.Add(e.Target);
|
||||
if (!visible) e.Shooter.VisibleEntities.Remove(e.Target);
|
||||
|
||||
var bears = FireControl.Bears(e.Weapon, e.Shooter, e.Target, out _);
|
||||
var price = FireControl.HitProbability(e.Weapon, e.Shooter, e.Target);
|
||||
|
||||
Assert.Equal(bears, SolutionOf(e).Bears);
|
||||
if (price > 0f) Assert.True(bears, $"priced {price} at {degrees} degrees, {range} out, visible {visible}, without bearing");
|
||||
if (!bears) Assert.Equal(0f, price);
|
||||
if (price > 0f) priced++;
|
||||
}
|
||||
Assert.True(priced > 0, "fixture: nothing on the grid was priced");
|
||||
}
|
||||
|
||||
// Each branch of what a round does flies along Solution.Direction as it stood at fire time: a target that bears
|
||||
// (aim ignored), an unfused round at a designated target out of arc (the clamped aim), a fused round with no lock.
|
||||
[Fact]
|
||||
public void SolveFliesAlongTheSolution()
|
||||
{
|
||||
var bearing = Build(TestSettings(), SolidShape(5, 4), hardpointArc: SolutionArc);
|
||||
Aim(bearing, float2(0, -1));
|
||||
Assert.True(SolutionOf(bearing).Bears);
|
||||
AssertFlies(bearing);
|
||||
|
||||
var outOfArc = Build(TestSettings(), SolidShape(5, 4), hardpointArc: SolutionArc, weaponRange: 200f);
|
||||
outOfArc.Target.Position = outOfArc.Shooter.Position + float3(100, 0, 0);
|
||||
Aim(outOfArc, float2(1, 4));
|
||||
Assert.False(SolutionOf(outOfArc).Bears);
|
||||
AssertFlies(outOfArc);
|
||||
|
||||
var fused = Build(TestSettings(), SolidShape(5, 4), fuse: WeaponFuse.Proximity, blastRadius: 4f, weaponRange: NoLockRange, hardpointArc: SolutionArc);
|
||||
fused.Shooter.SetTarget(TargetRef.None);
|
||||
Aim(fused, float2(0, -1));
|
||||
AssertFlies(fused);
|
||||
}
|
||||
|
||||
private static void AssertFlies(Engagement e)
|
||||
{
|
||||
var direction = SolutionOf(e).Direction;
|
||||
FireControl.Fire(e.Weapon, e.WeaponItem, e.Shooter);
|
||||
Near(direction, SafeAssert.OnlyShot(e.Zone).TravelDirection);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AFullArcTracksTheAimAllRound()
|
||||
{
|
||||
var settings = TestSettings();
|
||||
settings.FiringArc = 360;
|
||||
var e = Build(settings, SolidShape(5, 4));
|
||||
e.Shooter.SetTarget(TargetRef.None);
|
||||
for (var degrees = 0; degrees < 360; degrees += 30)
|
||||
{
|
||||
var aim = float2(sin(radians(degrees)), cos(radians(degrees)));
|
||||
Aim(e, aim);
|
||||
Assert.True(FireControl.ArcPermitsFire(e.Weapon, e.Shooter));
|
||||
Near(aim, SolutionOf(e).Direction);
|
||||
}
|
||||
}
|
||||
|
||||
// An agent's aim is its intercept (Combat sets it), so an in-arc target is a solution and the free aim both: its
|
||||
// fire is the same with or without the aim.
|
||||
[Fact]
|
||||
public void TheAgentStillFiresAtItsIntercept()
|
||||
{
|
||||
var e = Build(TestSettings(), SolidShape(5, 4), hardpointArc: SolutionArc);
|
||||
var intercept = FireControl.TravelDirection(e.Weapon, e.Shooter, e.Target);
|
||||
Aim(e, intercept);
|
||||
|
||||
var solution = SolutionOf(e);
|
||||
|
||||
Assert.True(solution.Bears && solution.Free);
|
||||
Assert.True(FireControl.ArcPermitsFire(e.Weapon, e.Shooter));
|
||||
Assert.True(FireControl.AgentFires(e.Weapon, e.Shooter, e.Target));
|
||||
Near(intercept, solution.Direction);
|
||||
}
|
||||
|
||||
// Solve flies along the solution against the target it is given, not the shooter's designated one (the HUD forecast
|
||||
// and an agent's burst ask about other entities). A decoy 40 degrees off, in the same zone, is passed while the
|
||||
// designated target sits dead ahead; the round goes to the decoy's intercept. Kills a Solve that reads the shooter's
|
||||
// target, a constant, or a swapped argument; the fixture checks the two intercepts differ.
|
||||
[Fact]
|
||||
public void SolveFliesToTheTargetItIsGiven()
|
||||
{
|
||||
var e = Build(TestSettings(), SolidShape(5, 4), hardpointArc: SolutionArc, weaponRange: 200f);
|
||||
var hull = e.Items.ItemData.RefOf<ItemData>(e.HullData);
|
||||
var decoy = new Ship(e.Items, e.Zone, new EquippableItem { Data = hull, Durability = 1000000, Lot = 400 }, new EntitySettings());
|
||||
e.Zone.Entities.Add(decoy);
|
||||
decoy.Activate();
|
||||
var at = radians(40f);
|
||||
decoy.Position = e.Shooter.Position + float3(sin(at), 0, cos(at)) * 100f;
|
||||
e.Shooter.VisibleEntities.Add(decoy);
|
||||
e.Shooter.EntityInfoGathered[decoy] = 1f;
|
||||
e.Shooter.SetIff(decoy, true);
|
||||
Aim(e, float2(0, -1));
|
||||
|
||||
var designated = FireControl.Solution(e.Weapon, e.Shooter, e.Target).Direction;
|
||||
var other = FireControl.Solution(e.Weapon, e.Shooter, decoy).Direction;
|
||||
Assert.True(FireControl.Bears(e.Weapon, e.Shooter, decoy, out _));
|
||||
Assert.True(length(designated - other) > .3f, "fixture: the two intercepts must differ");
|
||||
Assert.Same(e.Target, e.Shooter.Target.Value.Entity);
|
||||
|
||||
Near(other, FireControl.Solve(e.Weapon, e.WeaponItem, e.Shooter, decoy).TravelDirection);
|
||||
Near(designated, FireControl.Solve(e.Weapon, e.WeaponItem, e.Shooter, e.Target).TravelDirection);
|
||||
}
|
||||
}
|
||||
|
|
@ -241,7 +241,7 @@ public sealed class SteeringTests
|
|||
}
|
||||
|
||||
// The turn bound has one owner, the actuators: Ship.Update hands Turn to them unclamped, Thruster.Axis saturates to
|
||||
// 0..1 and AetherDrive.Axis clamps to -1..1. A Turn of 3 therefore rotates the hull as a Turn of 1.
|
||||
// 0..1. A Turn of 3 therefore rotates the hull as a Turn of 1.
|
||||
[Fact]
|
||||
public void TheActuatorsBoundATurnBeyondOne()
|
||||
{
|
||||
|
|
@ -276,13 +276,6 @@ public sealed class SteeringTests
|
|||
thruster.Axis = -3f;
|
||||
Assert.Equal(0f, thruster.Axis);
|
||||
}
|
||||
|
||||
// Axis is a pure property; no catalog hull carries a drive, so the instance is made without its item.
|
||||
var drive = (AetherDrive)System.Runtime.CompilerServices.RuntimeHelpers.GetUninitializedObject(typeof(AetherDrive));
|
||||
drive.Axis = float3(3f, -3f, 3f);
|
||||
Assert.Equal(float3(1f, -1f, 1f), drive.Axis);
|
||||
drive.Axis = float3(0f, 0f, -3f);
|
||||
Assert.Equal(-1f, drive.Axis.z);
|
||||
}
|
||||
|
||||
// The size of a turn, computed from the hull and not read back from the code under test: each rotation thruster
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ UNITY_EXE = r"C:\Program Files\Unity\Hub\Editor\6000.3.24f1\Editor\Unity.exe"
|
|||
ITEM_DATA_CS = REPO_ROOT / "Assets" / "Scripts" / "ServerShared" / "ItemData.cs"
|
||||
DIRECTORY_BUILD_PROPS = REPO_ROOT / "Directory.Build.props"
|
||||
|
||||
# A known-good record to mutate: HullData "LonginusX", whose Prefab already resolves (see the Cut 2
|
||||
# A known-good record to mutate: HullData "Longinus", whose Prefab already resolves (see the Cut 2
|
||||
# migration report). Texture2D guid is its own Schematic (schema_Longinus.png), still a real,
|
||||
# addressable asset, just the wrong type for Prefab (which wants a GameObject+EntityInstance).
|
||||
TEXTURE_GUID = "51702555e534a7a4fb39eb105b80bbaf"
|
||||
|
|
@ -109,7 +109,7 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using GameCult.Caching;
|
||||
|
||||
// Scratch-only (not landed): sets HullData "LonginusX".Prefab to an arbitrary string in a copy of
|
||||
// Scratch-only (not landed): sets HullData "Longinus".Prefab to an arbitrary string in a copy of
|
||||
// the catalog, for tests/mutation_tests.py to feed to EngineAssetCheck and prove it fails.
|
||||
internal static class Program
|
||||
{
|
||||
|
|
@ -122,12 +122,12 @@ internal static class Program
|
|||
{
|
||||
var stored = cache.AllStoredDocuments.First(s =>
|
||||
s.Descriptor.DocumentType.Name == "HullData" &&
|
||||
(string)s.Descriptor.DocumentType.GetField("Name").GetValue(s.Document) == "LonginusX");
|
||||
(string)s.Descriptor.DocumentType.GetField("Name").GetValue(s.Document) == "Longinus");
|
||||
var field = stored.Descriptor.DocumentType.GetField("Prefab", BindingFlags.Public | BindingFlags.Instance);
|
||||
field.SetValue(stored.Document, newValue);
|
||||
cache.UpsertAsync(stored.Descriptor.DocumentType, stored.Document, stored.Key).Wait();
|
||||
cache.FlushAllBackingStores();
|
||||
Console.WriteLine($"Set HullData \"LonginusX\".Prefab = \"{newValue}\"");
|
||||
Console.WriteLine($"Set HullData \"Longinus\".Prefab = \"{newValue}\"");
|
||||
return 0;
|
||||
}
|
||||
finally
|
||||
|
|
@ -217,11 +217,11 @@ def main():
|
|||
if code == 0:
|
||||
failures.append(f"{name}: EngineAssetCheck exited 0; the mutation was not caught")
|
||||
continue
|
||||
if "LonginusX" not in text:
|
||||
failures.append(f"{name}: failure did not name the record (LonginusX)")
|
||||
if "Longinus" not in text:
|
||||
failures.append(f"{name}: failure did not name the record (Longinus)")
|
||||
continue
|
||||
assert_contains(text, expect, name)
|
||||
print(f"OK: caught, exit {code}, named LonginusX, mentioned {expect!r}")
|
||||
print(f"OK: caught, exit {code}, named Longinus, mentioned {expect!r}")
|
||||
except SystemExit as exc:
|
||||
failures.append(f"{name}: {exc}")
|
||||
finally:
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using CultMath;
|
||||
using GameCult.Caching;
|
||||
using GameCult.Caching.MessagePack;
|
||||
using MessagePack;
|
||||
using Random = CultMath.Random;
|
||||
|
||||
// Commands over the game database, run with: dotnet run --project tools/AetherDb -- <command>
|
||||
|
|
@ -38,9 +40,13 @@ public static class Program
|
|||
case "targeting-catalog-6d": return TargetingCatalog6d(args.Contains("apply"));
|
||||
case "ship-authoring": return ShipAuthoringCommands.Run(args.Skip(1).ToArray());
|
||||
case "field-kinds": return FieldKindsCatalog(args.Contains("apply"));
|
||||
case "pd-gear": return PdGearCatalog(args.Contains("apply"));
|
||||
case "mine-launcher": return MineLauncherCatalog(args.Contains("apply"));
|
||||
case "pirates-faction":
|
||||
Console.OutputEncoding = new System.Text.UTF8Encoding(false);
|
||||
return PiratesFaction(args.Contains("apply"));
|
||||
default:
|
||||
Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, loadout [seed], save, settings, settings-dump, dangling [clear <Type.Member>]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply], ship-authoring create|inspect|validate|compose, field-kinds [apply], mine-launcher [apply]");
|
||||
Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, loadout [seed], save, settings, settings-dump, dangling [clear <Type.Member>]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply], ship-authoring create|inspect|validate|compose, field-kinds [apply], mine-launcher [apply], pd-gear [apply], pirates-faction [apply]");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -202,12 +208,6 @@ public static class Program
|
|||
["Heat"] = "injector", ["EnergyUsage"] = "injector",
|
||||
};
|
||||
|
||||
private static readonly Dictionary<string, string> AetherDriveRoles = new Dictionary<string, string>
|
||||
{
|
||||
["MaximumRpm"] = "rotor", ["Torque"] = "rotor",
|
||||
["CouplingEfficiency"] = "coupling", ["PassiveCoupling"] = "coupling", ["EnergyDraw"] = "coupling",
|
||||
};
|
||||
|
||||
private static readonly Dictionary<string, string> HullShipRoles = new Dictionary<string, string>
|
||||
{
|
||||
["CrossSection"] = "plating",
|
||||
|
|
@ -250,7 +250,6 @@ public static class Program
|
|||
"Reactor" => ReactorRoles,
|
||||
"Sensors" => SensorRoles,
|
||||
"Thruster" => ThrusterRoles,
|
||||
"AetherDrive" => AetherDriveRoles,
|
||||
_ when kind == "Hull/Ship" => HullShipRoles,
|
||||
"Tool" => ToolRolesByDesign.TryGetValue(item.Name, out var byName) ? byName : null,
|
||||
_ => null,
|
||||
|
|
@ -744,19 +743,11 @@ public static class Program
|
|||
}
|
||||
|
||||
// Runs the real LoadoutGenerator against every hull, so a generation failure reproduces here instead of on a
|
||||
// flight to a populated sector. No galaxy by default, so this covers placement, roles and products but NOT
|
||||
// flight to a populated sector. No galaxy, so this covers placement, roles and products but NOT
|
||||
// availability filtering or distance weighting, which need a real galaxy. Seeded: a failure repeats.
|
||||
//
|
||||
// Cut 6c, 6c.2 verification: "exclude-sellers Short1,Short2,..." builds a minimal one-zone Galaxy (the same
|
||||
// SavedGame/Galaxy round trip FireControlCut6cTests uses) whose faction roster is every catalog faction
|
||||
// EXCEPT the named ones, so IsAvailable actually rejects their products instead of the null-Galaxy "every
|
||||
// product is on offer" shortcut this command otherwise takes. That is the one way to reproduce the single
|
||||
// point of failure 6c.2 fixed: a null-galaxy run can never exercise Galaxy.ContainsFaction at all.
|
||||
private static int Loadout(string[] args)
|
||||
{
|
||||
var seedArgument = args.FirstOrDefault(a => !a.StartsWith("exclude-sellers"));
|
||||
var excludeArg = args.FirstOrDefault(a => a.StartsWith("exclude-sellers"));
|
||||
var seed = uint.TryParse(seedArgument, out var parsed) ? parsed : 1u;
|
||||
var seed = uint.TryParse(args.FirstOrDefault(), out var parsed) ? parsed : 1u;
|
||||
var db = AetherDb.Open();
|
||||
var settings = new GameplaySettings
|
||||
{
|
||||
|
|
@ -765,45 +756,6 @@ public static class Program
|
|||
QualityPriceModifier = new ExponentialLerp()
|
||||
};
|
||||
|
||||
Galaxy galaxy = null;
|
||||
CultCache galaxyCache = null;
|
||||
if (excludeArg != null)
|
||||
{
|
||||
var excludedShortNames = excludeArg.Contains(':')
|
||||
? excludeArg.Substring(excludeArg.IndexOf(':') + 1).Split(',', StringSplitOptions.RemoveEmptyEntries)
|
||||
: Array.Empty<string>();
|
||||
var excluded = new HashSet<string>(excludedShortNames);
|
||||
|
||||
// A second, scratch-run-store cache over the SAME catalog file, read-only on the catalog side --
|
||||
// RunSave.Commit only ever touches run-store record types (SavedGame, SavedZone, ProvenanceLedger),
|
||||
// but it needs a store that is "home" to them, which the plain read-only db.Cache above is not.
|
||||
// The scratch run.cc lives in the OS temp directory, never under GameData, so this command cannot
|
||||
// leave behind or corrupt a real save. Factions are looked up through THIS cache instance, not
|
||||
// db.Cache -- CultCache.RefOf needs the document to be one this specific instance's identity map
|
||||
// tracks, and two Open() calls over the same file do not share object identity.
|
||||
var scratchRun = Path.Combine(Path.GetTempPath(), $"aetherdb-loadout-exclude-{Guid.NewGuid():N}.cc");
|
||||
galaxyCache = AetheriaStores.Open(Path.Combine(db.Root, "GameData", "Aetheria.cc"), runPath: scratchRun);
|
||||
var includedFactions = galaxyCache.GetAll<Faction>().Where(f => !excluded.Contains(f.ShortName)).ToArray();
|
||||
Console.WriteLine($"Excluding sellers [{string.Join(", ", excluded)}] -- galaxy carries {includedFactions.Length} of {galaxyCache.GetAll<Faction>().Count()} factions.\n");
|
||||
|
||||
var game = new SavedGame
|
||||
{
|
||||
Factions = includedFactions.Select(f => galaxyCache.RefOf(f)).ToArray(),
|
||||
Relationships = includedFactions.Select(_ => FactionRelationship.Neutral).ToArray(),
|
||||
HomeZones = new Dictionary<int, int> { { 0, 0 } },
|
||||
BossZones = new Dictionary<int, int>(),
|
||||
DiscoveredZones = new[] { 0 },
|
||||
ActionBarBindings = new SavedActionBarBinding[0],
|
||||
Exit = -1
|
||||
};
|
||||
var zones = new[]
|
||||
{
|
||||
new SavedZone { Name = "Zone 0", Position = new float2(0, 0), AdjacentZones = Array.Empty<int>(), Factions = new[] { 0 }, Owner = 0, Contents = null }
|
||||
};
|
||||
RunSave.Commit(galaxyCache, game, zones, new ProvenanceLedger());
|
||||
galaxy = new Galaxy(galaxyCache, galaxyCache.GetGlobal<SavedGame>(), _ => { });
|
||||
}
|
||||
|
||||
var log = new List<string>();
|
||||
var itemManager = new ItemManager(db.Cache, new ProvenanceLedger(), settings, log.Add);
|
||||
var failures = 0;
|
||||
|
|
@ -812,7 +764,7 @@ public static class Program
|
|||
foreach (var hull in db.Cache.GetAll<HullData>().OrderBy(h => h.HullType).ThenBy(h => h.Name))
|
||||
{
|
||||
var random = new Random(seed);
|
||||
var generator = new LoadoutGenerator(ref random, itemManager, galaxy, null, null, .5f);
|
||||
var generator = new LoadoutGenerator(ref random, itemManager, null, null, null, .5f);
|
||||
log.Clear();
|
||||
string outcome;
|
||||
try
|
||||
|
|
@ -838,7 +790,6 @@ public static class Program
|
|||
}
|
||||
|
||||
Console.WriteLine($"\n{failures} hulls failed to generate a loadout (seed {seed}), {targetingGaps} armed hulls generated with no targeting system (fired unaided)");
|
||||
galaxyCache?.Dispose();
|
||||
return failures;
|
||||
}
|
||||
|
||||
|
|
@ -935,11 +886,11 @@ public static class Program
|
|||
// only has anything to curve if some shipped stat actually declares a PowerSupply term -- otherwise every
|
||||
// one of those stats keeps answering PowerSupplyFactor's identity (Entity.cs), and removing the gates makes
|
||||
// a partial grant read exactly like a full one instead of a reduced one. This authors the term, once, on the
|
||||
// one performance stat each of the four curve-eligible behaviours (EnergyDraw has none -- see EnergyDraw.cs)
|
||||
// actually reads for its continuous effect: ThrusterData.Thrust, AetherDriveData.Torque,
|
||||
// RadiatorData.PumpedHeat, ConstantWeaponData.Damage. Two of the four (AetherDriveData.Torque,
|
||||
// RadiatorData.PumpedHeat) are ALSO power-request fields (StatValidation.PowerRequestFields) -- at the time
|
||||
// this tool authored the shipped catalog's curves that briefly made those two records illegal under F6's
|
||||
// one performance stat each of the three curve-eligible behaviours (EnergyDraw has none -- see EnergyDraw.cs)
|
||||
// actually reads for its continuous effect: ThrusterData.Thrust,
|
||||
// RadiatorData.PumpedHeat, ConstantWeaponData.Damage. One of the three (RadiatorData.PumpedHeat)
|
||||
// is ALSO a power-request field (StatValidation.PowerRequestFields) -- at the time
|
||||
// this tool authored the shipped catalog's curves that briefly made that record illegal under F6's
|
||||
// now-deleted static check (StatValidation.ValidateNoPowerSupplyOnRequest); the nominal-request ruling
|
||||
// (docs/stats-and-power-cut.md, operator ruling 2026-09-19, see ItemData.cs's PowerRequestFields comment)
|
||||
// resolved that by having PowerRequest read request fields nominally instead of forbidding the term, so
|
||||
|
|
@ -952,12 +903,11 @@ public static class Program
|
|||
var db = AetherDb.Open(catalogWritable: apply);
|
||||
const float gentleExponent = 1f;
|
||||
|
||||
// (behaviour type, target performance-stat field, short label) -- two of these are also request fields
|
||||
// (behaviour type, target performance-stat field, short label) -- one of these is also a request field
|
||||
// (StatValidation.PowerRequestFields); that is legal under the nominal-request ruling above.
|
||||
var targets = new (Type BehaviorType, string Field, string Label)[]
|
||||
{
|
||||
(typeof(ThrusterData), nameof(ThrusterData.Thrust), "thrust"),
|
||||
(typeof(AetherDriveData), nameof(AetherDriveData.Torque), "torque"),
|
||||
(typeof(RadiatorData), nameof(RadiatorData.PumpedHeat), "pumpedHeat"),
|
||||
(typeof(ConstantWeaponData), nameof(WeaponData.Damage), "damage"),
|
||||
};
|
||||
|
|
@ -1407,7 +1357,7 @@ public static class Program
|
|||
// and are meaningless as written under the new one -- re-authored here on the sigma-reciprocal scale
|
||||
// instead, same convention as 6c.1's Resolution fix.
|
||||
//
|
||||
// Both ranges are chosen against real hull scale (GameData/Aetheria.cc's own hulls: LonginusX 6x17,
|
||||
// Both ranges are chosen against real hull scale (GameData/Aetheria.cc's own hulls: Longinus 6x17,
|
||||
// Zenith 12x12, Turret 8x8) and the unaided floor this cut adds alongside them
|
||||
// (GameplaySettings.UnaidedPrecision, .3 -> sigma 3.33 cells): a design that did not clear the unaided
|
||||
// floor by a wide margin would make the required Tool item pointless to equip.
|
||||
|
|
@ -1507,6 +1457,144 @@ public static class Program
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Aetheria release, cut pd-gear (ruling catalog-grows-generic-designs-branded-products): the catalog's first
|
||||
// point-defence class guns. Nothing in data marks a gun as PD (ruling pd-who-engages); these are PD by their
|
||||
// stats: a hose of light rounds, a quick light beam, and a small pellet volley. Each design is a deep copy of a
|
||||
// template weapon (so roles, effect, sound and temperatures are inherited) with only the stats below overridden;
|
||||
// each carries several products, and branding lives in the products alone. Dry run unless passed "apply".
|
||||
private static int PdGearCatalog(bool apply)
|
||||
{
|
||||
var db = AetherDb.Open(catalogWritable: apply);
|
||||
var weapons = db.Cache.GetAll<WeaponItemData>().ToArray();
|
||||
|
||||
var designNames = new[] { "Point Defense Gun", "Point Defense Laser", "Flak Gun" };
|
||||
var already = designNames.Count(name => weapons.Any(w => w.Name == name));
|
||||
if (already == designNames.Length)
|
||||
{
|
||||
Console.WriteLine("Point-defence gear is already authored; nothing to do.");
|
||||
return 0;
|
||||
}
|
||||
if (already != 0) throw new InvalidOperationException("Point-defence gear is partly authored; the catalog needs a human.");
|
||||
|
||||
WeaponItemData Template(string name) =>
|
||||
weapons.FirstOrDefault(w => w.Name == name) ?? throw new InvalidOperationException($"No weapon design named \"{name}\".");
|
||||
Faction Maker(string shortName) =>
|
||||
db.Cache.GetAll<Faction>().FirstOrDefault(f => f.ShortName == shortName) ?? throw new InvalidOperationException($"No faction with short name \"{shortName}\".");
|
||||
|
||||
var ammoRef = Template("Autocannon").Behaviors.OfType<InstantWeaponData>().Single().AmmoType;
|
||||
var ammunition = db.Cache.Get<SimpleCommodityData>(ammoRef.Key) ?? throw new InvalidOperationException("Autocannon's ammunition commodity is not in the catalog.");
|
||||
|
||||
var options = CultDocumentMessagePackSerialization.OptionsFor(typeof(WeaponItemData).Assembly);
|
||||
WeaponItemData Copy(WeaponItemData template, string name, string description, float mass, int price, float durability, int width, int height, WeaponModifiers modifiers)
|
||||
{
|
||||
var design = MessagePackSerializer.Deserialize<WeaponItemData>(MessagePackSerializer.Serialize(template, options), options);
|
||||
design.Name = name;
|
||||
design.Description = description;
|
||||
design.Mass = mass;
|
||||
design.Price = price;
|
||||
design.Durability = durability;
|
||||
design.Shape = new Shape(width, height);
|
||||
for (var x = 0; x < width; x++)
|
||||
for (var y = 0; y < height; y++) design.Shape.Cells[x, y] = true;
|
||||
design.WeaponModifiers = modifiers;
|
||||
return design;
|
||||
}
|
||||
|
||||
// The stat keeps the template's terms (so quality still moves it as it moves the template); only Min and Max are authored.
|
||||
static void Set(PerformanceStat stat, float min, float max) { stat.Min = min; stat.Max = max; }
|
||||
static void Track(WeaponData data, float rate) => data.Tracking = new PerformanceStat { Min = rate, Max = rate, Terms = new List<StatTerm>() };
|
||||
|
||||
var gun = Copy(Template("ClearPath"), designNames[0], "Close-in defence gun: a hose of light rounds.", 40f, 80000, 60f, 1, 1, WeaponModifiers.RapidFire);
|
||||
var gunData = gun.Behaviors.OfType<InstantWeaponData>().Single();
|
||||
Set(gunData.Damage, 1.5f, 4f); Set(gunData.Range, 300f, 550f); Set(gunData.MinRange, 0f, 0f);
|
||||
Set(gunData.Cooldown, .06f, .025f); Set(gunData.Count, 1f, 1f); Set(gunData.Spread, 1f, .3f);
|
||||
Set(gunData.Velocity, 1100f, 1600f); Set(gunData.Energy, .4f, .2f); Set(gunData.Heat, 40f, 15f); Set(gunData.Visibility, 400f, 150f);
|
||||
gunData.AmmoType = db.Cache.RefOf(ammunition); gunData.MagazineSize = 250; gunData.ReloadTime = 3f;
|
||||
Track(gunData, 40f);
|
||||
|
||||
var laser = Copy(Template("Spectra"), designNames[1], "Close-in defence beam: quick, light, instant.", 30f, 110000, 30f, 1, 1, Template("Spectra").WeaponModifiers);
|
||||
var laserData = laser.Behaviors.OfType<InstantWeaponData>().Single();
|
||||
Set(laserData.Damage, 5f, 12f); Set(laserData.Range, 400f, 750f); Set(laserData.MinRange, 0f, 0f);
|
||||
Set(laserData.Cooldown, .2f, .1f); Set(laserData.Count, 1f, 1f); Set(laserData.Spread, .05f, 0f);
|
||||
Set(laserData.Velocity, 0f, 0f); Set(laserData.Energy, 6f, 10f); Set(laserData.Heat, 300f, 150f); Set(laserData.Visibility, 300f, 100f);
|
||||
Track(laserData, 40f);
|
||||
|
||||
var flak = Copy(Template("DeathCluster"), designNames[2], "Small flak gun: a short-range pellet volley.", 120f, 180000, 80f, 1, 2, WeaponModifiers.Cluster);
|
||||
var flakData = flak.Behaviors.OfType<InstantWeaponData>().Single();
|
||||
Set(flakData.Damage, 30f, 70f); Set(flakData.Count, 6f, 8f); Set(flakData.Range, 350f, 800f); Set(flakData.MinRange, 0f, 0f);
|
||||
Set(flakData.Cooldown, .6f, .35f); Set(flakData.Spread, 4f, 2f); Set(flakData.Velocity, 900f, 1300f);
|
||||
Set(flakData.Energy, 1f, .5f); Set(flakData.Heat, 300f, 150f); Set(flakData.Visibility, 800f, 300f);
|
||||
flakData.AmmoType = db.Cache.RefOf(ammunition); flakData.MagazineSize = 40; flakData.ReloadTime = 4f;
|
||||
Track(flakData, 20f);
|
||||
|
||||
var makers = new Dictionary<string, (float Mean, float Dev)>
|
||||
{
|
||||
["Zhestokost"] = (.50f, .08f), ["AU"] = (.50f, .12f), ["Lightsail"] = (.55f, .10f), ["R&D"] = (.60f, .15f),
|
||||
["Lucent"] = (.60f, .15f), ["NiteLife"] = (.55f, .12f), ["Finch"] = (.65f, .20f), ["Alakrita"] = (.60f, .14f),
|
||||
["DME"] = (.55f, .20f), ["Adrasteia"] = (.60f, .10f),
|
||||
};
|
||||
var products = new (WeaponItemData Design, string Name, string Maker, string Description)[]
|
||||
{
|
||||
(gun, "Waykeeper", "Lightsail", "Freight first, questions later. Keeps a hauler's paint unscratched through a full salvo."),
|
||||
(gun, "Rampart", "Zhestokost", "A column does not dodge. It does not need to."),
|
||||
(gun, "Swatter", "AU", "Keeps the rocks and the rockets off your back while you work."),
|
||||
(gun, "Catch-All", "R&D", "Guaranteed to stop the missile!* *Missile defined as whatever it stops."),
|
||||
(laser, "Glare", "Lucent", "Every missile gets its moment in the spotlight. A short one."),
|
||||
(laser, "Nightlight", "NiteLife", "Lights out for anything with a warhead. Shares the bus with your blasters, so mind the meter."),
|
||||
(laser, "Wren", "Finch", "Small, quiet and quicker than it looks, most days."),
|
||||
(laser, "Gnat", "Alakrita", "Weighs less than your conscience and keeps the fast pass fast."),
|
||||
(flak, "MFer", "Zhestokost", "Our shrapnel turns your enemies into scrapnel."),
|
||||
(flak, "Hailstorm", "AU", "A wall of steel for crews who would rather not count missiles."),
|
||||
(flak, "sky full of teeth", "DME", "light it up/ shake it loose/ nothing gets through tonight"),
|
||||
};
|
||||
foreach (var product in products) Maker(product.Maker);
|
||||
|
||||
void Describe(WeaponItemData design)
|
||||
{
|
||||
var data = design.Behaviors.OfType<InstantWeaponData>().Single();
|
||||
Console.WriteLine($" {design.Name,-20} {design.HardpointType,-9} {design.Shape.Width}x{design.Shape.Height} mass {design.Mass:0.##} price {design.Price} durability {design.Durability:0.##} modifiers {design.WeaponModifiers}");
|
||||
Console.WriteLine($" damage {data.Damage.Min:0.##}-{data.Damage.Max:0.##} count {data.Count.Min:0.##}-{data.Count.Max:0.##} range {data.Range.Min:0.##}-{data.Range.Max:0.##} cooldown {data.Cooldown.Min:0.###}-{data.Cooldown.Max:0.###} spread {data.Spread.Min:0.##}-{data.Spread.Max:0.##} velocity {data.Velocity.Min:0.##}-{data.Velocity.Max:0.##}");
|
||||
Console.WriteLine($" energy {data.Energy.Min:0.##}-{data.Energy.Max:0.##} heat {data.Heat.Min:0.##}-{data.Heat.Max:0.##} visibility {data.Visibility.Min:0.##}-{data.Visibility.Max:0.##} ammo {(data.AmmoType.IsSet() ? ammunition.Name : "none")} magazine {data.MagazineSize} reload {data.ReloadTime:0.##} tracking {data.Tracking.Min:0.##} roles [{string.Join(", ", design.Roles.Select(r => r.Name))}]");
|
||||
Console.WriteLine($" \"{design.Description}\"");
|
||||
}
|
||||
|
||||
Console.WriteLine("New designs:");
|
||||
foreach (var design in new[] { gun, laser, flak }) Describe(design);
|
||||
Console.WriteLine("\nNew products:");
|
||||
foreach (var (design, name, maker, description) in products)
|
||||
{
|
||||
var (mean, dev) = makers[maker];
|
||||
Console.WriteLine($" {design.Name} -> \"{name}\" by {maker}, every role mean {mean:0.##} dev {dev:0.##}: {description}");
|
||||
}
|
||||
|
||||
if (!apply)
|
||||
{
|
||||
Console.WriteLine($"\nDry run. Pass \"apply\" to author 3 designs and {products.Length} products.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
foreach (var design in new[] { gun, laser, flak }) CultRecordRefs.Validate(design);
|
||||
db.Cache.Commit(batch =>
|
||||
{
|
||||
var keys = new Dictionary<WeaponItemData, CultRecordKey>();
|
||||
foreach (var design in new[] { gun, laser, flak }) keys[design] = batch.Upsert(typeof(WeaponItemData), design);
|
||||
foreach (var (design, name, maker, description) in products)
|
||||
{
|
||||
var (mean, dev) = makers[maker];
|
||||
batch.Upsert(typeof(FactionProductData), new FactionProductData
|
||||
{
|
||||
Name = name,
|
||||
Description = description,
|
||||
Design = new CultRecordRef<CraftedItemData>(keys[design]),
|
||||
Manufacturer = db.Cache.RefOf(Maker(maker)),
|
||||
Roles = design.Roles.Select(r => new ProductRole { Role = r.Name, Mean = mean, StandardDeviation = dev }).ToList(),
|
||||
});
|
||||
}
|
||||
});
|
||||
Console.WriteLine($"\nAuthored 3 designs and {products.Length} products in Aetheria.cc");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// sim-mines-presenter: the Mine Launcher item, so a ship can be fitted with the sim's mine layer. Its numbers
|
||||
// are the 2021 record's (GameData/Legacy/AetherDB.2021-03-05.msgpack, recovered in 8c71a637: mass 75, price
|
||||
// 125000, damage 50, range 2000, energy 15, heat 500, visibility 10, magazine 6, reload 5, spread 5, velocity
|
||||
|
|
@ -1617,4 +1705,111 @@ public static class Program
|
|||
Console.WriteLine($"\nAuthored \"{name}\" in Aetheria.cc");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Aetheria release, cut pirates-record (rulings pirates-record-content, catalog-grows-generic-designs-branded-products):
|
||||
// the Pirates faction and eight rebrands of other makers' designs, named in emoji. The Pirates own no design: their range
|
||||
// is what they took, so every product points at a design someone else also makes. Each product carries one ProductRole per
|
||||
// role its design declares, middling and inconsistent (mean .45, sd .22, against makers' .15). Names are stored as the emoji
|
||||
// only, written here as \U escapes so no editor or shell mangles them; the dry run prints them raw and as code points.
|
||||
//
|
||||
// Dry run unless passed "apply", same contract as the other *-migrate commands.
|
||||
public static int PiratesFaction(bool apply, string root = null)
|
||||
{
|
||||
var db = AetherDb.Open(catalogWritable: apply, root: root);
|
||||
|
||||
var existing = db.Cache.GetAll<Faction>().FirstOrDefault(f => f.Name == "Pirates");
|
||||
if (existing != null)
|
||||
{
|
||||
Console.WriteLine("A faction named \"Pirates\" already exists; nothing to do.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
CraftedItemData DesignByName(string name)
|
||||
{
|
||||
var matches = db.Cache.GetAll<CraftedItemData>().Where(i => i.Name == name).ToArray();
|
||||
if (matches.Length != 1) throw new InvalidOperationException($"Expected exactly one design named \"{name}\", found {matches.Length}.");
|
||||
return matches[0];
|
||||
}
|
||||
|
||||
string CodePoints(string text) => string.Join(" ", text.EnumerateRunes().Select(r => $"U+{r.Value:X4}"));
|
||||
|
||||
var nameFile = db.Cache.GetAll<NameFile>().FirstOrDefault(n => n.Name == "pleiades");
|
||||
if (nameFile == null) throw new InvalidOperationException("No name file named \"pleiades\".");
|
||||
|
||||
var others = db.Cache.GetAll<Faction>().ToArray();
|
||||
var pirates = new Faction
|
||||
{
|
||||
Name = "Pirates",
|
||||
ShortName = "Pirates",
|
||||
Description = "A loose coalition of crews and hidden docks moving people and goods outside official control. No command, no common law: possession has a maintenance schedule.",
|
||||
PrimaryColor = new float3(.42f, .40f, .37f),
|
||||
SecondaryColor = new float3(1f, .45f, .05f),
|
||||
GeonameFile = db.Cache.RefOf(nameFile),
|
||||
InfluenceDistance = 3,
|
||||
};
|
||||
foreach (var other in others) pirates.Allegiance[db.Cache.RefOf(other)] = 1f;
|
||||
|
||||
var rebrands = new (string Design, string Name, string Description)[]
|
||||
{
|
||||
("Autocannon", "\U0001FAF3\U0001F52B", "Serial number filed off. Still shoots."),
|
||||
("Earp", "\U0001FAA6\U0001F920", "The previous owner had no further use for it."),
|
||||
("FastBlast+-", "\U0001F9FE\U0001F6AB", "Warranty void where prohibited, which is everywhere."),
|
||||
("6k Shooter", "\U0001F3A8\U0001F648", "The logo underneath is somebody else's problem."),
|
||||
("scorched void policy", "\U0001F525", "Turns out we did start the fire after all."),
|
||||
("Targeting Computer", "\U0001F440\U0001F3AF", "Somebody else's eyes. They still work."),
|
||||
("Small Drive", "\U0001F511\U0001F3C3\U0001F4A8", "Hotwired. Do not ask about the ignition."),
|
||||
("Store-All Plus", "\U0001F4E6\U0001F92B", "Contents not as declared."),
|
||||
};
|
||||
|
||||
var products = rebrands.Select(r =>
|
||||
{
|
||||
var design = DesignByName(r.Design);
|
||||
return (Design: design, r.Name, r.Description,
|
||||
Roles: (design.Roles ?? new List<ItemRole>()).Select(role => new ProductRole { Role = role.Name, Mean = .45f, StandardDeviation = .22f }).ToList());
|
||||
}).ToArray();
|
||||
|
||||
Console.WriteLine($"New faction \"{pirates.Name}\": influence {pirates.InfluenceDistance}, names \"{nameFile.Name}\", allegiance 1.0 to {pirates.Allegiance.Count} factions.");
|
||||
Console.WriteLine($" colours: primary ({pirates.PrimaryColor.x:0.00}, {pirates.PrimaryColor.y:0.00}, {pirates.PrimaryColor.z:0.00}) primer grey, secondary ({pirates.SecondaryColor.x:0.00}, {pirates.SecondaryColor.y:0.00}, {pirates.SecondaryColor.z:0.00}) hazard orange");
|
||||
Console.WriteLine($" {pirates.Description}");
|
||||
Console.WriteLine($"\nNew products ({products.Length}):");
|
||||
foreach (var (design, name, description, roles) in products)
|
||||
{
|
||||
var makers = db.Cache.GetAll<FactionProductData>()
|
||||
.Where(p => p.Design.Key.Equals(db.Cache.RefOf(design).Key))
|
||||
.Select(p => db.Cache.Get(p.Manufacturer)?.ShortName).OrderBy(n => n, StringComparer.Ordinal);
|
||||
Console.WriteLine($" {name} [{CodePoints(name)}]");
|
||||
Console.WriteLine($" design {design.GetType().Name} \"{design.Name}\" (made by {string.Join(", ", makers)}), roles [{string.Join(", ", roles.Select(r => r.Role))}]");
|
||||
Console.WriteLine($" \"{description}\"");
|
||||
}
|
||||
|
||||
CultRecordRefs.Validate(pirates);
|
||||
foreach (var (design, name, description, roles) in products)
|
||||
CultRecordRefs.Validate(new FactionProductData
|
||||
{
|
||||
Name = name, Description = description, Roles = roles,
|
||||
Design = new CultRecordRef<CraftedItemData>(db.Cache.RefOf(design).Key),
|
||||
Manufacturer = db.Cache.RefOf(others[0]),
|
||||
});
|
||||
|
||||
if (!apply)
|
||||
{
|
||||
Console.WriteLine($"\nDry run. Pass \"apply\" to land the Pirates faction and {products.Length} products.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
db.Cache.Commit(batch =>
|
||||
{
|
||||
var piratesKey = batch.Upsert(typeof(Faction), pirates);
|
||||
foreach (var (design, name, description, roles) in products)
|
||||
batch.Upsert(typeof(FactionProductData), new FactionProductData
|
||||
{
|
||||
Name = name, Description = description, Roles = roles,
|
||||
Design = new CultRecordRef<CraftedItemData>(db.Cache.RefOf(design).Key),
|
||||
Manufacturer = new CultRecordRef<Faction>(piratesKey),
|
||||
});
|
||||
});
|
||||
|
||||
Console.WriteLine($"\nLanded the Pirates faction and {products.Length} products in Aetheria.cc");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ HARDPOINT_MEMBERS = ("Type", "Position", "Shape", "Transform", "Rotation", "Armo
|
|||
ANCHOR_MEMBERS = ("Id", "Role", "ModelNodeId", "ParentId", "Order")
|
||||
# Enum member names in value order (HardpointType, ItemRotation).
|
||||
HARDPOINT_TYPE_NAMES = ("Hull", "Tool", "Thermal", "Thruster", "WarpDrive", "Reactor", "Radiator",
|
||||
"Shield", "Sensors", "Energy", "Ballistic", "Launcher", "ControlModule", "AetherDrive")
|
||||
"Shield", "Sensors", "Energy", "Ballistic", "Launcher", "ControlModule")
|
||||
ROTATION_NAMES = ("None", "CounterClockwise", "Reversed", "Clockwise")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue