scalableSpaceObject.py (1741B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\environment\spaceObject\scalableSpaceObject.py 2 from destructionEffect import destructionType 3 from eve.client.script.environment.spaceObject.spaceObject import SpaceObject 4 from evegraphics.utils import BuildSOFDNAFromGraphicID 5 from evetypes import GetGraphicID 6 from fsdBuiltData.client.groupGraphics import GetGraphicIdsFromTypeID 7 from fsdBuiltData.common.graphicIDs import GetGraphic, GetExplosionBucketID 8 9 class ScalableSpaceObject(SpaceObject): 10 11 def _GetGraphicID(self): 12 typeID = self.typeData.get('typeID') 13 graphics = GetGraphicIdsFromTypeID(typeID) 14 if graphics is None or len(graphics) == 0: 15 graphicid = GetGraphicID(typeID) 16 if graphicid is None: 17 raise RuntimeError('Error adding scalable object %d it has no graphicId or groupGraphic information', typeID) 18 return graphicid 19 return graphics[self.id % len(graphics)] 20 21 def GetDNA(self): 22 graphicID = self._GetGraphicID() 23 return BuildSOFDNAFromGraphicID(graphicID) 24 25 def Assemble(self): 26 if self.model is None: 27 self.logger.error('Cannot Assemble ScalableObject, model failed to load') 28 return 29 self.model.modelScale = self.radius 30 graphicInfo = GetGraphic(self._GetGraphicID()) 31 self.explosionBucketID = GetExplosionBucketID(graphicInfo) 32 self.ActivateExplodeOnRemove() 33 34 def ActivateExplodeOnRemove(self): 35 if self.explosionBucketID is not None: 36 self.destructionEffectId = destructionType.EXPLOSION_OVERRIDE 37 38 def DeactivateExplodeOnRemove(self): 39 self.destructionEffectId = destructionType.NONE