impactEffect.py (2199B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\environment\effects\impactEffect.py 2 ONESHOT_EVENTS = ['shieldboost', 'shieldhardening'] 3 __author__ = 'stevem' 4 from eve.client.script.environment.effects.GenericEffect import GenericEffect, STOP_REASON_DEFAULT 5 import evetypes 6 animationNameMappings = {'armorhardening': 0.0, 7 'armorrepair': 1.0, 8 'shieldhardening': 2.0, 9 'shieldboost': 3.0, 10 'hullrepair': 4.0} 11 12 class ImpactEffect(GenericEffect): 13 __guid__ = 'effects.ImpactEffect' 14 15 def SetAudioControllerVariables(self, model, audioState): 16 stateVariable = 'impactEffectPlay' if audioState > 0.0 else 'impactEffectStop' 17 model.SetControllerVariable('impactEffectType', animationNameMappings[self.animationName]) 18 model.SetControllerVariable('boundingSphereRadius', model.boundingSphereRadius) 19 model.SetControllerVariable(stateVariable, 1.0) 20 21 def Start(self, duration): 22 shipBall = self.GetEffectShipBall() 23 model = getattr(shipBall, 'model', None) 24 if model is not None: 25 if self.animationName is not None: 26 self.AddSoundToEffect(scaler=4.0, model=model) 27 model.SetImpactAnimation(self.animationName, True, self.duration / 1000.0) 28 self.SetAudioControllerVariables(model, 1.0) 29 30 def Stop(self, reason = STOP_REASON_DEFAULT): 31 shipBall = self.GetEffectShipBall() 32 model = getattr(shipBall, 'model', None) 33 if model is not None: 34 if self.animationName is not None: 35 model.SetImpactAnimation(self.animationName, False, self.duration / 1000.0) 36 self.SetAudioControllerVariables(model, 0.0) 37 if self.observer is not None: 38 self.observer = None 39 40 def Repeat(self, duration): 41 shipBall = self.GetEffectShipBall() 42 model = getattr(shipBall, 'model', None) 43 if model is not None: 44 if self.animationName is not None: 45 model.SetImpactAnimation(self.animationName, True, self.duration / 1000.0) 46 if self.animationName in ONESHOT_EVENTS: 47 self.SetAudioControllerVariables(model, 1.0)