regroup.py (1783B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\behaviors\trees\regroup.py 2 from behaviors import composites 3 from behaviors.actions.ballparks import WarpToNewLocation, GetBallWarpToLocation, GetBallGotoPointAction 4 from behaviors.actions.entities import SelectGroupLeaderAction 5 from behaviors.blackboards.scopes import ScopeTypes 6 from behaviors.conditions.ballparks import IsBallPresentInMyBubbleCondition, IsBallInWarpCondition 7 from behaviors.const.blackboardchannels import WARP_SCRAMBLED_ADDRESS 8 from behaviors.decorators.modifiers import Not 9 from brennivin.itertoolsext import Bundle 10 GROUP_LEADER_ADDRESS = (ScopeTypes.EntityGroup, 'GROUP_LEADER') 11 REGROUP_LOCATION_ADDRESS = (ScopeTypes.EntityGroup, 'REGROUP_LOCATION') 12 13 def CreateReGroupBehavior(): 14 return composites.Sequence(Bundle(name='ReGroup root')).AddSubTask(SelectGroupLeaderAction(Bundle(groupLeaderIdAddress=GROUP_LEADER_ADDRESS))).AddSubTask(Not().AddSubTask(IsBallPresentInMyBubbleCondition(Bundle(ballIdAddress=GROUP_LEADER_ADDRESS)))).AddSubTask(CreateGetBallPositionAfterWarpBehavior(ballIdAddress=GROUP_LEADER_ADDRESS, locationAddress=REGROUP_LOCATION_ADDRESS)).AddSubTask(WarpToNewLocation(Bundle(locationMessage=REGROUP_LOCATION_ADDRESS, warpScrambledAddress=WARP_SCRAMBLED_ADDRESS))) 15 16 17 def CreateGetBallPositionAfterWarpBehavior(ballIdAddress = None, locationAddress = None): 18 return composites.PrioritySelector(Bundle(name='Get Position After Warp')).AddSubTask(composites.Sequence().AddSubTask(IsBallInWarpCondition(Bundle(ballIdAddress=ballIdAddress))).AddSubTask(GetBallGotoPointAction(Bundle(ballIdAddress=ballIdAddress, gotoPointAddress=locationAddress)))).AddSubTask(GetBallWarpToLocation(Bundle(ballIdAddress=ballIdAddress, locationAddress=locationAddress)))