Delete HardpointTransforms; mount direction and arc become sim data
Entity.HardpointTransforms was written only by Unity (EntityInstance.cs), so the simulation's notion of where a gun points was a readback from a renderer that never runs headless -- Combat.cs threw KeyNotFoundException on the first combat tick outside Unity. Deletes the field, its writer, and the readback branch in Behavior.Direction, leaving the item-rotation path (the same convention reaction thrusters use, R6) as the only source of mount direction. Adds FireControl (ServerShared), a static class owning whether a weapon bears on a point: MountDirection (planar, from ItemRotation), ArcFor (the per-hardpoint HardpointData.FiringArc override, falling back to the new GameplaySettings.FiringArc default of 120), and InArc (the planar dot-cone test, R7 -- target height never enters it, and an arc of 360+ passes unconditionally so a turret hardpoint needs no new type, just a number). Combat.cs and TurretController.cs now gate AI fire through InArc instead of the old hardcoded 0.99 dot-product test against a live Unity transform. Settings.cs drops AgentFiringMinDot, which was declared and read by nothing. docs/fire-control-cut.md, Cut 1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
678c1ea99a
commit
2b98aaa762
9 changed files with 64 additions and 26 deletions
|
|
@ -27,16 +27,8 @@ public abstract class Behavior
|
|||
{
|
||||
if(Item != null)
|
||||
{
|
||||
var hardpoint = Entity.Hardpoints[Item.Position.x, Item.Position.y];
|
||||
if (hardpoint != null && Entity.HardpointTransforms.ContainsKey(hardpoint))
|
||||
{
|
||||
return normalize(Entity.HardpointTransforms[hardpoint].direction);
|
||||
}
|
||||
else
|
||||
{
|
||||
var itemDirection = Entity.Direction.Rotate(Item.EquippableItem.Rotation);
|
||||
return float3(itemDirection.x, 0, itemDirection.y);
|
||||
}
|
||||
var itemDirection = Entity.Direction.Rotate(Item.EquippableItem.Rotation);
|
||||
return float3(itemDirection.x, 0, itemDirection.y);
|
||||
}
|
||||
|
||||
return float3(Entity.Direction.x, 0, Entity.Direction.y);
|
||||
|
|
|
|||
|
|
@ -78,9 +78,7 @@ public class TurretController : Behavior, IInitializableBehavior
|
|||
foreach (var x in _weapons)
|
||||
{
|
||||
var data = x.Data as WeaponData;
|
||||
var fire = dot(
|
||||
x.Direction,
|
||||
Entity.LookDirection) > .99f;
|
||||
var fire = FireControl.InArc(x.Item, Entity.LookDirection);
|
||||
if (x.Evaluate(data.Range) > dist && fire)
|
||||
{
|
||||
x.Activate();
|
||||
|
|
|
|||
Loading…
Reference in a new issue