def enterDie(self, ts = 0): self.show() self.clearStunnedIval() self.generateCog(isLose = 1) self.nametag.clearChatText() self.deleteNameTag() self.deathSound = base.audio3d.loadSfx("phase_3.5/audio/sfx/Cog_Death_Full.ogg") base.audio3d.attachSoundToObject(self.deathSound, self) trackName = self.uniqueName('enterDie') smallGears = ParticleLoader.loadParticleEffect('phase_3.5/etc/gearExplosionSmall.ptf') smallGears.getParticlesNamed('particles-1').setPoolSize(30) smallGears.setShaderOff(1) singleGear = ParticleLoader.loadParticleEffect('phase_3.5/etc/gearExplosion.ptf') singleGear.getParticlesNamed('particles-1').setPoolSize(1) singleGear.setShaderOff(1) smallGearExplosion = ParticleLoader.loadParticleEffect('phase_3.5/etc/gearExplosion.ptf') smallGearExplosion.getParticlesNamed('particles-1').setPoolSize(10) smallGearExplosion.setShaderOff(1) bigGearExplosion = ParticleLoader.loadParticleEffect('phase_3.5/etc/gearExplosionBig.ptf') bigGearExplosion.getParticlesNamed('particles-1').setPoolSize(30) bigGearExplosion.setShaderOff(1) smallGears.setDepthWrite(False) smallGears.hide(CIGlobals.ShadowCameraBitmask) singleGear.setDepthWrite(False) singleGear.hide(CIGlobals.ShadowCameraBitmask) smallGearExplosion.setDepthWrite(False) smallGearExplosion.hide(CIGlobals.ShadowCameraBitmask) bigGearExplosion.setDepthWrite(False) bigGearExplosion.hide(CIGlobals.ShadowCameraBitmask) self.smallGears = smallGears self.smallGears.setPos(self.find('**/joint_head').getPos() + (0,0, 2)) self.singleGear = singleGear self.smallGearExp = smallGearExplosion self.bigGearExp = bigGearExplosion gearTrack = Sequence(Wait(0.7), Func(self.doSingleGear), Wait(1.5), Func(self.doSmallGears), Wait(3.0), Func(self.doBigExp)) self.suitTrack = Parallel(Sequence(Wait(0.8), SoundInterval(self.deathSound, duration = 4.28)), Sequence(Wait(0.7), Func(self.doSingleGear), Wait(4.5), Func(self.suitExplode), Wait(1.0), Func(self.disableBodyCollisions)), gearTrack, Sequence(ActorInterval(self, 'lose', duration = 6), Func(self.getGeomNode().hide)), name = trackName) self.suitTrack.setDoneEvent(self.suitTrack.getName()) self.acceptOnce(self.suitTrack.getName(), self.exitDie) if self.isDistributed(): self.suitTrack.delayDelete = DelayDelete.DelayDelete(self, trackName) self.suitTrack.start(ts)
def load(self): DistributedEntity.load(self) ptfFile = self.getEntityValue("file") scale = self.getEntityValueFloat("scale") self.system = ParticleLoader.loadParticleEffect(ptfFile) self.system.setScale(scale)
def __init__(self, parent=hidden, wantParticles=1, tint=(1, 1, 1, 1)): NodePath.__init__(self, parent) self.assign(parent.attachNewNode('splash')) self.splashdown = Actor( 'phase_4/models/props/SZ_splashdown-mod.bam', {'splashdown': 'phase_4/models/props/SZ_splashdown-chan.bam'}) self.setLightOff() self.splashdown.reparentTo(self) self.splashdown.setZ(-0.01) self.splashdown.setScale(0.4) self.setColorScale(tint) ta = TransparencyAttrib.make(TransparencyAttrib.MBinary) self.splashdown.node().setAttrib(ta, 1) self.splashdown.setBin('fixed', 130, 1) self.ripples = Ripples(self) self.ripples.setBin('fixed', 120, 1) self.wantParticles = wantParticles if self.wantParticles: self.pSystem = ParticleLoader.loadParticleEffect( "phase_4/etc/splashlines.ptf") self.pSystem.setScale(0.40000000000000002) self.pSystem.setBin('fixed', 150, 1) self.pSystem.setColorScale(tint) self.particles = self.pSystem.particlesDict.get('particles-1') self.track = None self.trackId = Splash.splashCount Splash.splashCount += 1 self.setBin('fixed', 100, 1) self.hide()
def load(self): SafeZoneLoader.load(self) self.soundRain = base.loadSfx('phase_14/audio/sfx/rain_ambient.ogg') self.rain = ParticleLoader.loadParticleEffect('phase_14/etc/rain.ptf') self.rain.setPos(0, 0, 5) self.rainRender = self.geom.attachNewNode('snowRender') self.rainRender.setDepthWrite(0) self.rainRender.setBin('fixed', 1)
def __init__(self, loc = (0, 0, 0), parent = None): NodePath.__init__(self, 'explosion') if parent is None: parent = render self.reparentTo(parent) self.setPos(loc) self.poof = ParticleLoader.loadParticleEffect('resources/phase_14/etc/explosion_poof.ptf') self.poof.start(self) self.lines = ParticleLoader.loadParticleEffect('resources/phase_14/etc/explosion_sparks.ptf') self.lines.start(self) self.smoke = ParticleLoader.loadParticleEffect('resources/phase_14/etc/explosion_smoke.ptf') self.smoke.start(self) taskMgr.doMethodLater(4.0, self.__cleanupTask, "Explosion_cleanupTask")
def loadParticle(self): self.stopParticle() gag = self.gag if self.isLocal() and base.localAvatar.isFirstPerson(): gag = self.getVMGag() self.waterStreamParent = gag.find( "**/" + self.sprayJoint).attachNewNode("particleParent") self.sprayParticle = ParticleLoader.loadParticleEffect( self.sprayParticleFile) # Update now to prevent one particle spraying out the side when we begin. self.__updateParticleParent()
def __doFakeStuff(self): self.__cleanupFakeStuff() self.lightSound = base.audio3d.loadSfx("phase_14/audio/sfx/tnt_snap.ogg") base.audio3d.attachSoundToObject(self.lightSound, self.getVMGag()) self.lightSound.play() self.tntSound = base.audio3d.loadSfx("phase_14/audio/sfx/dynamite_loop.ogg") self.tntSound.setLoop(True) base.audio3d.attachSoundToObject(self.tntSound, self.getVMGag()) self.tntSound.play() self.particle = ParticleLoader.loadParticleEffect("phase_14/etc/tnt_spark.ptf") self.particle.start(self.getVMGag().find('**/joint_attachEmitter'), CIGlobals.getParticleRender())
def start(self): self.particles = ParticleLoader.loadParticleEffect( 'phase_8/etc/snowdisk.ptf') self.particles.setPos(0, 0, 5) self.particles.start(parent=camera, renderParent=self.particlesRender) # Only use the fog if it's christmas. # This class is used by the Brrrgh all the time, but # it will use the OutdoorLightingConfig fog. if base.cr.isChristmas() and not metadata.NO_FOG: base.render.setFog(self.fog) self.startWind()
def announceGenerate(self): self.tnt = Actor('phase_14/models/props/tnt.bam', {'chan': 'phase_5/models/props/tnt-chan.bam'}) self.tnt.reparentTo(self) self.tnt.play('chan') self.tnt.setP(97.492) self.tnt.setY(0.38) self.tntSound = base.audio3d.loadSfx( "phase_14/audio/sfx/dynamite_loop.ogg") self.tntSound.setLoop(True) base.audio3d.attachSoundToObject(self.tntSound, self.tnt) self.particle = ParticleLoader.loadParticleEffect( "phase_14/etc/tnt_spark.ptf") self.particle.start(self.tnt.find('**/joint_attachEmitter'), CIGlobals.getParticleRender()) DistributedPhysicsEntity.announceGenerate(self) self.tntSound.play()
def load(self): Entity.load(self) entnum = self.cEntity.getEntnum() loader = base.bspLoader ptfFile = loader.getEntityValue(entnum, "file") scale = loader.getEntityValueFloat(entnum, "scale") self.spawnflags = loader.getEntityValueInt(entnum, "spawnflags") self.system = ParticleLoader.loadParticleEffect(ptfFile) BSPUtility.applyUnlitOverride(self.system) self.system.setLightOff(1) self.system.setScale(scale) self.setPos(self.cEntity.getOrigin()) self.setHpr(self.cEntity.getAngles()) self.reparentTo(render) if self.spawnflags & self.StartsEnabled: self.Start()
def __init__(self, gui, collectable = True): NodePath.__init__(self, 'jellybean') self.gui = gui self.particle = ParticleLoader.loadParticleEffect('phase_4/etc/cmg_bean_sparkle.ptf') self.particle.reparentTo(self) self.mdl = loader.loadModel("phase_4/models/props/jellybean4.bam") self.mdl.setColor(VBase4(0.3, 0.3, 1.0, 1.0)) self.mdl.flattenLight() self.mdl.reparentTo(self) self.mdl.setScale(3.0) self.mdl.setZ(1.0) self.shadow = loader.loadModel("phase_3/models/props/drop_shadow.bam") self.shadow.setScale(.12) self.shadow.reparentTo(self) self.shadow.setBillboardAxis(2) self.shadow.setColor(0, 0, 0, 0.5, 1) self.jbCollNP = None self.spinIval = None self.pickupIval = None self.collectable = collectable if self.collectable: self.__initialiseCollisions() self.spinIval = LerpHprInterval( self, duration = 0.5, hpr = Vec3(360, 0, 0), startHpr = Vec3(0, 0, 0) ) self.spinIval.loop()
def loadParticleEffect(self, ptfPath): return ParticleLoader.loadParticleEffect(ptfPath)
def makeExplosion(pos=(0, 0, 0), scale=1, sound=True, shakeCam=True, duration=1.0, soundVol=1.0): explosion = loader.loadModel('phase_3.5/models/props/explosion.bam') explosion.setScale(scale) explosion.reparentTo(render) explosion.setBillboardPointEye() explosion.setLightOff(1) explosion.hide(ShadowCameraBitmask) explosion.setPos(pos) frames = 10.0 fps = 24.0 duration = frames / fps explosion.find("**/+SequenceNode").node().play() from src.coginvasion.toon import ParticleLoader smoke = ParticleLoader.loadParticleEffect( "phase_14/etc/explosion_smoke.ptf") smoke.setDepthWrite(False, 1) smoke.setScale(scale) smoke.setPos(pos) smoke.start(render, getParticleRender()) track = Parallel() if sound: import random hlsounds = base.config.GetBool('explosion-hlsounds', False) if hlsounds: hldir = "phase_14/audio/sfx/" snd = base.audio3d.loadSfx(hldir + random.choice( ['explode3_hl2', 'explode4_hl2', 'explode5_hl2']) + ".ogg") else: snd = base.audio3d.loadSfx( "phase_3.5/audio/sfx/ENC_cogfall_apart.ogg") base.audio3d.attachSoundToObject(snd, explosion) # explosion aftermaths debChoice = random.randint(1, 4) if debChoice <= 3: debris = base.audio3d.loadSfx( "phase_14/audio/sfx/debris{0}.ogg".format(debChoice)) else: debris = base.audio3d.loadSfx( "phase_4/audio/sfx/MG_crash_whizz.ogg") base.audio3d.attachSoundToObject(debris, explosion) track.append(SoundInterval(snd, volume=soundVol)) wait = 0.0791 if not hlsounds else 0.0 track.append( Sequence(Wait(wait), SoundInterval(debris, volume=soundVol))) if shakeCam: dist = camera.getDistance(explosion) maxDist = 100.0 * scale maxIntense = 1.4 * scale if dist <= maxDist: base.doCamShake(maxIntense - (maxIntense * (dist / maxDist)), duration) track.append(Sequence(Wait(duration), Func(explosion.removeNode))) track.append(Sequence(Wait(duration), Func(smoke.softStop))) track.start()
tornado.setX(150) tornado.setZ(6.8) tornado.setColorScale(1.0, 1.0, 1.0, 0.8) path = NURBSMopath('phase_14/models/paths/ci_twister_tt_path_1.egg') botbone = tornado.exposeJoint(None, 'modelRoot', 'bottom_bone') from src.coginvasion.toon import ParticleLoader renNode = botbone.attachNewNode('renNode') renNode.setP(-90) renNode.setScale(0.1) dirt = ParticleLoader.loadParticleEffect('phase_14/etc/ci_tw_dirt.ptf') dirt.setDepthWrite(False) dirt.setTransparency(TransparencyAttrib.MDual) dirt.start(parent = renNode, renderParent = render) from direct.interval.IntervalGlobal import * ts = TextureStage('tornado_ts') ts.setMode(TextureStage.MReplace) tex = loader.loadTexture('phase_14/maps/ci_twister.png') tornado.setTexture(ts, tex) tornado.setTransparency(True) def changeTask(task): tornado.setTexOffset(ts, task.time, 0) return task.cont