capitalHangarBehaviours.py (2055B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\view\hangarBehaviours\capitalHangarBehaviours.py 2 import math 3 import evetypes 4 import geo2 5 import trinity 6 from eve.client.script.ui.view.hangarBehaviours.baseHangarBehaviours import BaseHangarShipBehaviour, BaseHangarShipDroneBehaviour 7 from eve.common.lib import appConst as const 8 9 class CapitalHangarShipBehaviour(BaseHangarShipBehaviour): 10 11 def SetAnchorPoint(self, hangarModel, hangarScene): 12 if hangarModel is None: 13 self.log.error('CapitalHangarShipBehaviour.SetAnchorPoint: Setting anchor point when scene is None') 14 return 15 anchorPointLocatorSets = [ locatorSet for locatorSet in getattr(hangarModel, 'locatorSets', []) if locatorSet.name == 'anchorpoint' ] 16 if len(anchorPointLocatorSets) > 0: 17 if len(getattr(anchorPointLocatorSets[0], 'locators', [])) > 0: 18 self.shipAnchorPoint = anchorPointLocatorSets[0].locators[0][0] 19 return 20 self.log.warning('CapitalHangarShipBehaviour.SetAnchorPoint: Could not find anchor point') 21 22 def PlaceShip(self, model, typeID): 23 model.translationCurve = trinity.Tr2TranslationAdapter() 24 trinity.WaitForResourceLoads() 25 self.endPos = self.GetShipCenter(model, typeID) 26 model.translationCurve.value = self.endPos 27 28 def GetShipCenter(self, model, typeID): 29 localBB = model.GetLocalBoundingBox() 30 width = abs(localBB[0][0]) 31 if evetypes.GetGroupID(typeID) == const.groupTitan: 32 width += 2000 33 return geo2.Vec3Add(self.shipAnchorPoint, (width, 0.0, 0.0)) 34 35 def GetAnimEndPosition(self): 36 return self.endPos 37 38 def GetAnimStartPosition(self): 39 return self.endPos 40 41 42 class CapitalHangarDroneBehaviour(BaseHangarShipDroneBehaviour): 43 44 def SetRepairDroneCount(self, boundingRadius): 45 count = int(math.ceil(boundingRadius / 60.0)) 46 if self.repairDroneBehaviourGroup: 47 self.repairDroneBehaviourGroup.SetCount(count)