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

cloaking.py (3490B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\environment\effects\cloaking.py
      2 import random
      3 from eve.client.script.environment.effects.GenericEffect import GenericEffect, STOP_REASON_DEFAULT, STOP_REASON_BALL_REMOVED
      4 from eve.client.script.environment.effects.shipRenderEffect import ShipRenderEffect
      5 
      6 class Cloaking(GenericEffect):
      7     __guid__ = 'effects.Cloaking'
      8 
      9 
     10 class Cloak(ShipRenderEffect):
     11     __guid__ = 'effects.Cloak'
     12     __gfxName__ = 'Cloak'
     13 
     14     def Prepare(self):
     15         sourceObject = self.GetEffectShipBall().model
     16         for effect in sourceObject.overlayEffects:
     17             if effect.name == self.__gfxName__:
     18                 sourceObject.overlayEffects.remove(effect)
     19 
     20         self.GetEffectShipBall().CancelSkinChange()
     21         ball = self.GetEffectShipBall()
     22         self.sourceObject = ball.model
     23         self.AddSoundToEffect(scaler=1.0, model=self.sourceObject, guidOverride=Cloak.__guid__)
     24         ShipRenderEffect.Prepare(self)
     25         self.gfx.name = self.__gfxName__
     26         for binding in self.gfx.curveSet.bindings:
     27             if binding.name.startswith('self'):
     28                 binding.destinationObject = self.sourceObject
     29 
     30         shipBall = self.GetEffectShipBall()
     31         if shipBall is not None:
     32             if shipBall.id != session.shipid:
     33                 del self.gfx.additiveEffects[:]
     34                 del self.gfx.distortionEffects[:]
     35         damageLocators = self.sourceObject.locatorSets.FindByName('damage').locators
     36         self.sourceObject.clipSphereCenter = random.choice(damageLocators)[0]
     37 
     38     def Start(self, duration):
     39         ShipRenderEffect.Start(self, duration)
     40         self.SendAudioEvent(eventName='ship_cloak_play')
     41 
     42     def Stop(self, reason = STOP_REASON_DEFAULT):
     43         if reason == STOP_REASON_BALL_REMOVED:
     44             ShipRenderEffect.Stop(self, reason)
     45         self.gfx = None
     46 
     47     def ChangeModel(self, model):
     48         pass
     49 
     50 
     51 class CloakNoAnim(Cloak):
     52     __guid__ = 'effects.CloakNoAmim'
     53 
     54     def Start(self, duration):
     55         Cloak.Start(self, 6000)
     56         length = self.gfx.curveSet.GetMaxCurveDuration()
     57         self.gfx.curveSet.PlayFrom(length)
     58 
     59 
     60 class CloakRegardless(Cloak):
     61     __guid__ = 'effects.CloakRegardless'
     62 
     63 
     64 class Uncloak(Cloak):
     65     __guid__ = 'effects.Uncloak'
     66 
     67     def __init__(self, *args, **kwargs):
     68         Cloak.__init__(self, *args, **kwargs)
     69         self.fromTime = None
     70 
     71     def Prepare(self):
     72         ball = self.GetEffectShipBall()
     73         self.sourceObject = ball.model
     74         for effect in self.sourceObject.overlayEffects:
     75             if effect.name == self.__gfxName__:
     76                 self.gfx = effect
     77                 self.fromTime = self.gfx.curveSet.scaledTime
     78                 if self.observer is None:
     79                     self.AddSoundToEffect(scaler=1.0, model=self.sourceObject, guidOverride=Cloak.__guid__)
     80                 break
     81 
     82         if not self.gfx:
     83             Cloak.Prepare(self)
     84 
     85     def Start(self, duration):
     86         if self.gfx is None:
     87             return
     88         playFrom = duration / 1000.0
     89         if self.fromTime:
     90             playFrom = min(self.fromTime, playFrom)
     91         self.gfx.curveSet.scale = -1.0
     92         self.gfx.curveSet.PlayFrom(playFrom)
     93         self.SendAudioEvent(eventName='ship_uncloak_play')
     94 
     95     def Stop(self, reason = STOP_REASON_DEFAULT):
     96         self.sourceObject.clipSphereFactor = 0.0
     97         self.sourceObject.activationStrength = 1.0
     98         ShipRenderEffect.Stop(self, reason)