AI pilots vent on a Track paint past half and overdrive to close (consumable-ai r3)
Re-land on master of the h1 cut with the s1 fixes: the vent rule reads one Track paint in the ship's own IncomingPaints, TryActivateConsumable refuses on an inactive ship, the AI holds while a consumable of the kind is active, and the top of the lock strength range is pinned. Not yet built or run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
533b301e49
commit
fcf1b46880
4 changed files with 387 additions and 1 deletions
|
|
@ -1350,8 +1350,20 @@ public abstract class Entity
|
|||
return data.Stackable || FindActiveConsumable(data) == null;
|
||||
}
|
||||
|
||||
// The first consumable design in cargo with a behaviour of the asked kind, or null. Callers ask by kind, never
|
||||
// by name: a design's name is a label and its behaviours are what it does.
|
||||
public ConsumableItemData FirstCarriedConsumable(Predicate<BehaviorData> kind) =>
|
||||
CargoBays.SelectMany(bay => bay.Cargo.Keys).OfType<ConsumableItem>()
|
||||
.Select(item => ItemManager.GetData(item) as ConsumableItemData)
|
||||
.FirstOrDefault(data => data != null && data.Behaviors.Any(b => kind(b)));
|
||||
|
||||
public bool HasActiveConsumable(Predicate<BehaviorData> kind) =>
|
||||
_activeConsumables.Any(e => e.Data.Behaviors.Any(b => kind(b)));
|
||||
|
||||
public bool TryActivateConsumable(ConsumableItemData data)
|
||||
{
|
||||
// Death and docking Remove and Deactivate the ship while its agent keeps ticking.
|
||||
if (!_active) return false;
|
||||
if (!CanActivateConsumable(data)) return false;
|
||||
|
||||
var key = ItemManager.ItemData.RefOf<ItemData>(data).Key;
|
||||
|
|
|
|||
Loading…
Reference in a new issue