Ejemplo n.º 1
0
 def Assemble(self):
     timecurves.ScaleTime(self.model, 0.9 + random.random() * 0.2)
     self.SetStaticRotation()
     raceName = self.typeData.get('sofRaceName', None)
     if raceName is not None:
         self.turretTypeID = TURRET_TYPE_ID.get(raceName,
                                                TURRET_FALLBACK_TYPE_ID)
     if gfxsettings.Get(gfxsettings.UI_TURRETS_ENABLED):
         self.FitHardpoints()
Ejemplo n.º 2
0
 def Assemble(self):
     timecurves.ScaleTime(self.model, 0.9 + random.random() * 0.2)
     self.SetStaticRotation()
     slimItem = sm.StartService('michelle').GetBallpark().GetInvItem(self.id)
     self.typeID = slimItem.typeID
     to = cfg.invtypes.Get(self.typeID)
     g = cfg.graphics.GetIfExists(to.graphicID)
     raceID = getattr(g, 'gfxRaceID', None)
     if raceID is not None:
         self.turretTypeID = TURRET_TYPE_ID.get(raceID, TURRET_FALLBACK_TYPE_ID)
     if settings.user.ui.Get('turretsEnabled', 1):
         self.FitHardpoints()
Ejemplo n.º 3
0
 def Assemble(self):
     timecurves.ResetTimeCurves(self.model, self.id * 12345L)
     timecurves.ScaleTime(self.model, 5.0 + self.id % 20 / 20.0)
     x = 0.8 + 0.2 * random.random()
     y = 0.8 + 0.2 * random.random()
     z = 0.8 + 0.2 * random.random()
     self.model.scaling.SetXYZ(self.model.scaling.x * x,
                               self.model.scaling.y * y,
                               self.model.scaling.z * z)
     selfPos = trinity.TriVector(self.x * 1e-05, self.y * 1e-05,
                                 self.z * 1e-05)
     fwd = trinity.TriVector(0.0, 0.0, 1.0)
     selfPos.Normalize()
     self.model.rotationCurve = None
     self.model.rotation.SetRotationArc(fwd, selfPos)
Ejemplo n.º 4
0
    def Assemble(self):
        if self.model is None:
            self.LogError('Cannot Assemble Asteroid, model failed to load')
            return
        if self.HasBlueInterface(self.model, 'IEveSpaceObject2'):
            self.model.modelScale = self.radius
            pi = math.pi
            id = trinity.TriQuaternion()
            cleanRotation = trinity.TriQuaternion()
            preRotation = trinity.TriQuaternion()
            postRotation = trinity.TriQuaternion()
            rotKey = trinity.TriQuaternion()
            preRotation.SetYawPitchRoll(random.random() * pi,
                                        random.random() * pi,
                                        random.random() * pi)
            postRotation.SetYawPitchRoll(random.random() * pi,
                                         random.random() * pi,
                                         random.random() * pi)
            curve = trinity.TriRotationCurve()
            curve.extrapolation = trinity.TRIEXT_CYCLE
            duration = 50.0 + random.random() * 50.0 * math.log(self.radius)
            for i in [0.0, 0.5, 1.0, 1.5, 2.0]:
                cleanRotation.SetYawPitchRoll(0.0, pi * i, 0.0)
                rotKey.SetIdentity()
                rotKey.MultiplyQuaternion(preRotation)
                rotKey.MultiplyQuaternion(cleanRotation)
                rotKey.MultiplyQuaternion(postRotation)
                curve.AddKey(duration * i, rotKey, id, id,
                             trinity.TRIINT_SLERP)

            curve.Sort()
            self.model.modelRotationCurve = curve
        else:
            self.model.rotation.SetYawPitchRoll(random.random() * 6.28,
                                                random.random() * 6.28,
                                                random.random() * 6.28)
            timecurves.ResetTimeCurves(self.model, self.id * 12345L)
            timecurves.ScaleTime(self.model, 5.0 + self.id % 20 / 20.0)
            self.model.scaling.SetXYZ(self.radius, self.radius, self.radius)
            self.model.boundingSphereRadius = 1.0