incursions.py (3601B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\behaviors\trees\groups\incursions.py 2 from behaviors.actions import WaitAction 3 from behaviors.behaviortree import BehaviorTree 4 from behaviors.composites import Sequence, PrioritySelector 5 from behaviors.conditions.blackboards import IsBlackboardValueNone 6 from behaviors.const.blackboardchannels import GUARD_OBJECT_ITEM_ID 7 from behaviors.decorators.modifiers import ForceSuccess 8 from behaviors.monitors.ballparks import MonitorSpecificProximitySensorForGroupMembers 9 from behaviors.monitors.blackboards import BlackboardMessageMonitor 10 from behaviors.monitors.groups import GroupMembershipMonitor 11 from behaviors.monitors.navigation import GroupMemberWarpModeChangedMonitor 12 from behaviors.trees.combat import COMBAT_TARGETS_SET 13 from behaviors.trees.groups.combat import CreateManageTargetCombatSetBehavior 14 from behaviors.trees.groups.threatManagement import CreateThreatManagementBehavior 15 from behaviors.trees.incursions.const import AMARR_NAVY_OWNERS, DRIFTER_OWNERS 16 from behaviors.trees.reinforcements import CreateRequestReinforcements 17 from brennivin.itertoolsext import Bundle 18 from inventorycommon.const import groupCapsule, categoryShip, categoryDrone, categoryEntity, categoryFighter 19 PRUNE_TIMEOUT_SECONDS = 120 20 21 def CreateIncursionGroupBehavior(friendlyOwnerIds = None, hostileOwnerIds = None, isAutomaticallyAggressive = False): 22 root = Sequence(Bundle(name='root')) 23 root.AddSubTask(GroupMembershipMonitor(Bundle(name='Monitor changes in membership'))) 24 root.AddSubTask(GroupMemberWarpModeChangedMonitor(Bundle(name='Tracking movement that can result in bubbles changing.'))) 25 root.AddSubTask(BlackboardMessageMonitor(Bundle(messageAddress=COMBAT_TARGETS_SET))) 26 root.AddSubTask(ForceSuccess().AddSubTask(CreateRequestReinforcements())) 27 root.AddSubTask(CreateThreatManagementBehavior(friendlyOwnerIds=friendlyOwnerIds, hostileOwnerIds=hostileOwnerIds, isAutomaticallyAggressive=isAutomaticallyAggressive)) 28 root.AddSubTask(CreateManageTargetCombatSetBehavior(PRUNE_TIMEOUT_SECONDS)) 29 root.AddSubTask(CreateGroupGuardBehavior(friendlyOwnerIds=friendlyOwnerIds, hostileOwnerIds=hostileOwnerIds, isAutomaticallyAggressive=isAutomaticallyAggressive)) 30 root.AddSubTask(WaitAction(Bundle(name='Wait for some action'))) 31 return root 32 33 34 def CreateGroupBehaviorTree(friendlyOwnerIds = None, hostileOwnerIds = None, isAutomaticallyAggressive = False): 35 root = CreateIncursionGroupBehavior(friendlyOwnerIds=friendlyOwnerIds, hostileOwnerIds=hostileOwnerIds, isAutomaticallyAggressive=isAutomaticallyAggressive) 36 behaviorTree = BehaviorTree() 37 behaviorTree.StartRootTask(root) 38 return behaviorTree 39 40 41 def CreateDrifterGroupBehaviorTree(): 42 return CreateGroupBehaviorTree(friendlyOwnerIds=DRIFTER_OWNERS, hostileOwnerIds=AMARR_NAVY_OWNERS, isAutomaticallyAggressive=True) 43 44 45 def CreateGroupGuardBehavior(friendlyOwnerIds = None, hostileOwnerIds = None, isAutomaticallyAggressive = False): 46 root = PrioritySelector(Bundle(name='guard monitoring')) 47 root.AddSubTask(IsBlackboardValueNone(Bundle(valueAddress=GUARD_OBJECT_ITEM_ID))) 48 root.AddSubTask(MonitorSpecificProximitySensorForGroupMembers(Bundle(objectListAddress=COMBAT_TARGETS_SET, proximitySensorAddress=GUARD_OBJECT_ITEM_ID, includedCategories=[categoryShip, 49 categoryDrone, 50 categoryEntity, 51 categoryFighter], excludedGroups=[groupCapsule], validOwnerIds=None if isAutomaticallyAggressive else hostileOwnerIds, invalidOwnerIds=friendlyOwnerIds if isAutomaticallyAggressive else None))) 52 return root