Entity: an equipped item keeps the hardpoint it occupies
The placement rule (HardpointAt) already finds the one hardpoint an item lies in at equip; TryEquip threw that answer away and eighteen readers recomputed it from the item's origin cell, which need not lie in the hardpoint (Soul's scenarios batch-4 P30). EquippedItem.Hardpoint now carries the answer, null for Tool gear and the hull, and every origin-cell lookup reads it instead: FireControl.ArcFor, the eleven weapon managers, EntityInstance, ShipInstance and ActionGameManager's articulation grouping. Entity.Hardpoints[,] stays the per-cell map for armour and display. TryFindSpace's hardpoint search tries every origin the fit rule can accept, including ones up and left of the hardpoint, so a design whose shape lacks its origin cell is found wherever ItemFits would place it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2d39c83504
commit
5ea59ac6b5
15 changed files with 45 additions and 33 deletions
|
|
@ -11,7 +11,7 @@ public class ChargeEffectManager : MonoBehaviour
|
|||
public void StartCharging(ChargedWeapon weapon, EquippedItem item, EntityInstance source)
|
||||
{
|
||||
var effect = EffectPrototype.Instantiate<WeaponChargeEffect>();
|
||||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var hp = item.Hardpoint;
|
||||
var barrel = source.GetBarrel(hp);
|
||||
var t = effect.transform;
|
||||
t.SetParent(barrel);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class ConstantLaserManager : ConstantWeaponEffectManager
|
|||
{
|
||||
var p = LaserPrototype.Instantiate<ConstantLaser>();
|
||||
p.SourceEntity = source.Entity;
|
||||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var hp = item.Hardpoint;
|
||||
var barrel = source.GetBarrel(hp);
|
||||
p.Range = item.Evaluate(data.Range);
|
||||
var t = p.transform;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class ConstantLightningManager : ConstantWeaponEffectManager
|
|||
{
|
||||
var p = LightningPrototype.Instantiate<ConstantLightning>();
|
||||
p.Source = source;
|
||||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var hp = item.Hardpoint;
|
||||
var barrel = source.GetBarrel(hp);
|
||||
p.Barrel = barrel;
|
||||
p.Range = item.Evaluate(data.Range);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class ConstantParticleWeaponManager : ConstantWeaponEffectManager
|
|||
var p = WeaponPrototype.Instantiate<ConstantParticleWeapon>();
|
||||
p.Source = source;
|
||||
p.Target = target;
|
||||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var hp = item.Hardpoint;
|
||||
var barrel = source.GetBarrel(hp);
|
||||
var t = p.transform;
|
||||
t.SetParent(barrel);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class GuidedProjectileManager : InstantWeaponEffectManager
|
|||
if (target != null) p.Target = target.transform;
|
||||
else p.TargetPosition = () => burst;
|
||||
p.Frequency = launcher.DodgeFrequency;
|
||||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var hp = item.Hardpoint;
|
||||
var barrel = source.GetBarrel(hp);
|
||||
p.StartPosition = (p.transform.position = barrel.position).ToCultMath();
|
||||
p.Range = weapon.Range;
|
||||
|
|
@ -66,7 +66,7 @@ public class GuidedProjectileManager : InstantWeaponEffectManager
|
|||
p.Source = source.transform;
|
||||
p.SourceEntity = source.Entity;
|
||||
p.Frequency = guidance.DodgeFrequency;
|
||||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var hp = item.Hardpoint;
|
||||
var barrel = source.GetBarrel(hp);
|
||||
p.StartPosition = (p.transform.position = barrel.position).ToCultMath();
|
||||
p.Range = weapon.Range;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ public class HitscanManager : InstantWeaponEffectManager
|
|||
{
|
||||
var p = Prototype.Instantiate<HitscanEffect>();
|
||||
p.SourceEntity = source.Entity;
|
||||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var hp = item.Hardpoint;
|
||||
var barrel = source.GetBarrel(hp);
|
||||
var t = p.transform;
|
||||
t.SetParent(barrel, false);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public class LaserManager : InstantWeaponEffectManager
|
|||
public override void Fire(InstantWeapon weapon, EquippedItem item, EntityInstance source, EntityInstance target, int shotId)
|
||||
{
|
||||
var p = ProjectilePrototype.Instantiate<Laser>();
|
||||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var hp = item.Hardpoint;
|
||||
var barrel = source.GetBarrel(hp);
|
||||
var t = p.transform;
|
||||
t.SetParent(barrel);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public class LightningGunManager : InstantWeaponEffectManager
|
|||
public override void Fire(InstantWeapon weapon, EquippedItem item, EntityInstance source, EntityInstance target, int shotId)
|
||||
{
|
||||
var p = Prototype.Instantiate<Lightning>();
|
||||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var hp = item.Hardpoint;
|
||||
var barrel = source.GetBarrel(hp);
|
||||
p.ShotId = shotId;
|
||||
p.Barrel = barrel;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class MineManager : InstantWeaponEffectManager
|
|||
public override void Fire(InstantWeapon weapon, EquippedItem item, EntityInstance source, EntityInstance target, int shotId)
|
||||
{
|
||||
var p = ProjectilePrototype.Instantiate<Mine>();
|
||||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var hp = item.Hardpoint;
|
||||
var barrel = source.GetBarrel(hp);
|
||||
var angle = weapon.Spread / 2;
|
||||
p.Source = source;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ public class ProjectileManager : InstantWeaponEffectManager
|
|||
public override void Fire(InstantWeapon weapon, EquippedItem item, EntityInstance source, EntityInstance target, int shotId)
|
||||
{
|
||||
var p = ProjectilePrototype.Instantiate<Projectile>();
|
||||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var hp = item.Hardpoint;
|
||||
var barrel = source.GetBarrel(hp);
|
||||
var angle = weapon.Spread / 2;
|
||||
p.ShotId = shotId;
|
||||
|
|
|
|||
Loading…
Reference in a new issue