NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

DeployableSpaceObject.py (2472B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\environment\spaceObject\DeployableSpaceObject.py
      2 import blue
      3 from eve.client.script.environment.spaceObject.spaceObject import SpaceObject
      4 from eve.client.script.environment.model.turretSet import TurretSet
      5 import evegraphics.settings as gfxsettings
      6 import eve.common.lib.appConst as const
      7 from spacecomponents.client.messages import MSG_ON_ACTIVATE_TIMER_UPDATED
      8 from spacecomponents.common.helper import IsActiveComponent
      9 TURRET_TYPE_ID = {const.groupAutoLooter: 24348}
     10 
     11 class DeployableSpaceObject(SpaceObject):
     12 
     13     def __init__(self):
     14         SpaceObject.__init__(self)
     15         self.modules = {}
     16         self.fitted = False
     17 
     18     def Assemble(self):
     19         if self.ballpark is None:
     20             return
     21         registry = self._GetComponentRegistry()
     22         if not IsActiveComponent(registry, self.typeID, self.id):
     23             self.SetControllerVariable('IsDeployableActive', False)
     24             registry.SubscribeToItemMessage(self.id, MSG_ON_ACTIVATE_TIMER_UPDATED, self.ActivateTimerUpdate)
     25         else:
     26             self.SetControllerVariable('IsDeployableActive', True)
     27         if gfxsettings.Get(gfxsettings.UI_TURRETS_ENABLED):
     28             self.FitHardpoints()
     29         self.SetupSharedAmbientAudio()
     30 
     31     def ActivateTimerUpdate(self, component, slimItem):
     32         if component.isActive:
     33             self.SetControllerVariable('IsDeployableActive', True)
     34 
     35     def FitHardpoints(self, blocking = False):
     36         if self.fitted:
     37             return
     38         if self.model is None:
     39             self.logger.warning('FitHardpoints - No model')
     40             return
     41         if self.typeID is None:
     42             self.logger.warning('FitHardpoints - No typeID')
     43             return
     44         self.fitted = True
     45         self.modules = {}
     46         groupID = self.typeData.get('groupID', None)
     47         if groupID is not None:
     48             turretTypeID = TURRET_TYPE_ID.get(groupID, None)
     49             if turretTypeID is not None:
     50                 ts = TurretSet.FitTurret(self.model, turretTypeID, 1, self.typeData.get('sofFactionName', None))
     51                 if ts is not None:
     52                     self.modules[self.id] = ts
     53 
     54     def LookAtMe(self):
     55         if not self.model:
     56             return
     57         if not self.fitted:
     58             self.FitHardpoints()
     59 
     60     def Release(self):
     61         if self.released:
     62             return
     63         self.modules = None
     64         SpaceObject.Release(self)