def __init__(self, parent = hidden): NodePath.__init__(self) self.assign(globalPropPool.getProp('wake')) self.reparentTo(parent) tformNode = self.getChild(0) tformNode.setZ(0.1) self.startNodePath = self.find('**/+SequenceNode') self.startSeqNode = self.startNodePath.node() self.startSeqNode.setName('start') self.startSeqNode.setPlayRate(0) self.cycleNodePath = NodePath(SequenceNode(0, 'cycle')) self.cycleNodePath.reparentTo(tformNode) self.cycleSeqNode = self.cycleNodePath.node() self.endNodePath = NodePath(SequenceNode(0, 'end')) self.endNodePath.reparentTo(tformNode) self.endSeqNode = self.endNodePath.node() children = self.startNodePath.getChildren() for child in children[12:16]: child.reparentTo(self.cycleNodePath) for child in children[16:]: child.reparentTo(self.endNodePath) self.tracks = [] self.rate = None self.trackId = Wake.wakeCount Wake.wakeCount += 1 self.setBin('fixed', 10, 1) self.hide() return
def __init__(self, parent = hidden): NodePath.__init__(self) self.assign(globalPropPool.getProp('ripples')) self.reparentTo(parent) self.getChild(0).setZ(0.1) self.seqNode = self.find('**/+SequenceNode').node() self.seqNode.setPlayRate(0) self.track = None self.trackId = Ripples.rippleCount Ripples.rippleCount += 1 self.setBin('fixed', 100, 1) self.hide() return
def load(self): self.root = NodePath('PartyCog-%d' % self.id) self.root.reparentTo(self.parentNode) path = 'phase_13/models/parties/cogPinata_' self.actor = Actor(path + 'actor', {'idle': path + 'idle_anim', 'down': path + 'down_anim', 'up': path + 'up_anim', 'bodyHitBack': path + 'bodyHitBack_anim', 'bodyHitFront': path + 'bodyHitFront_anim', 'headHitBack': path + 'headHitBack_anim', 'headHitFront': path + 'headHitFront_anim'}) self.actor.reparentTo(self.root) self.temp_transform = Mat4() self.head_locator = self.actor.attachNewNode('temphead') self.bodyColl = CollisionTube(0, 0, 1, 0, 0, 5.75, 0.75) self.bodyColl.setTangible(1) self.bodyCollNode = CollisionNode('PartyCog-%d-Body-Collision' % self.id) self.bodyCollNode.setCollideMask(ToontownGlobals.PieBitmask) self.bodyCollNode.addSolid(self.bodyColl) self.bodyCollNodePath = self.root.attachNewNode(self.bodyCollNode) self.headColl = CollisionTube(0, 0, 3, 0, 0, 3.0, 1.5) self.headColl.setTangible(1) self.headCollNode = CollisionNode('PartyCog-%d-Head-Collision' % self.id) self.headCollNode.setCollideMask(ToontownGlobals.PieBitmask) self.headCollNode.addSolid(self.headColl) self.headCollNodePath = self.root.attachNewNode(self.headCollNode) self.arm1Coll = CollisionSphere(1.65, 0, 3.95, 1.0) self.arm1Coll.setTangible(1) self.arm1CollNode = CollisionNode('PartyCog-%d-Arm1-Collision' % self.id) self.arm1CollNode.setCollideMask(ToontownGlobals.PieBitmask) self.arm1CollNode.addSolid(self.arm1Coll) self.arm1CollNodePath = self.root.attachNewNode(self.arm1CollNode) self.arm2Coll = CollisionSphere(-1.65, 0, 3.45, 1.0) self.arm2Coll.setTangible(1) self.arm2CollNode = CollisionNode('PartyCog-%d-Arm2-Collision' % self.id) self.arm2CollNode.setCollideMask(ToontownGlobals.PieBitmask) self.arm2CollNode.addSolid(self.arm2Coll) self.arm2CollNodePath = self.root.attachNewNode(self.arm2CollNode) splatName = 'splat-creampie' self.splat = globalPropPool.getProp(splatName) self.splat.setBillboardPointEye() self.splatType = globalPropPool.getPropType(splatName) self.pieHitSound = globalBattleSoundCache.getSound('AA_wholepie_only.ogg') self.upSound = globalBattleSoundCache.getSound('AV_jump_to_side.ogg') self.hole = loader.loadModel('phase_13/models/parties/cogPinataHole') self.hole.setTransparency(True) self.hole.setP(-90.0) self.hole.setScale(3) self.hole.setBin('ground', 3) self.hole.reparentTo(self.parentNode)
def leftHand(prop=None): """ parents the optional <prop> to the target's left hand node. """ target = spellbook.getTarget() leftHand = target.find('**/leftHand') if prop is None: for child in leftHand.getChildren(): child.removeNode() else: for child in leftHand.getChildren(): child.removeNode() requestedProp = globalPropPool.getProp(prop) requestedProp.reparentTo(leftHand)
def __init__(self, parent = hidden, target = hidden): NodePath.__init__(self) self.assign(parent.attachNewNode('wake')) self.target = target self.ripples = globalPropPool.getProp('ripples') tformNode = self.ripples.getChild(0) tformNode.setZ(0.01) self.seqNodePath = self.ripples.find('**/+SequenceNode') self.seqNode = self.seqNodePath.node() self.sortBase = 10 self.rippleCount = 0 self.doLaters = [None] * 20 self.trackId = Wake.wakeCount Wake.wakeCount += 1 return
def __init__(self, activity, toon, position, team): self.activity = activity self.position = position self.toon = toon self.team = team self.netTimeSentToStartByHit = 0 self.kaboomTrack = None self.locator = None self.teamSpot = self.activity.getIndex(self.toon.doId, self.team) splatName = 'splat-creampie' self.splat = globalPropPool.getProp(splatName) self.splat.setBillboardPointEye() self.splatType = globalPropPool.getPropType(splatName) self.pieHitSound = globalBattleSoundCache.getSound('AA_wholepie_only.ogg') return
def __init__(self, parent = hidden, fBillboard = 1, wantSound = 0): NodePath.__init__(self) self.assign(globalPropPool.getProp('suit_explosion_dust')) if fBillboard: self.setBillboardAxis() self.reparentTo(parent) self.seqNode = self.find('**/+SequenceNode').node() self.seqNode.setFrameRate(0) self.wantSound = wantSound if self.wantSound and not DustCloud.sounds: DustCloud.sounds[SFX.poof] = loader.loadSfx(SFXPATHS[SFX.poof]) self.track = None self.trackId = DustCloud.dustCloudCount DustCloud.dustCloudCount += 1 self.setBin('fixed', 100, 1) self.hide() return
def __init__(self, cogIndex, suitType, game, cogSpeed): self.cogIndex = cogIndex self.suitType = suitType self.game = game self.cogSpeed = cogSpeed suit = Suit.Suit() d = SuitDNA.SuitDNA() d.newSuit(suitType) suit.setDNA(d) suit.pose("walk", 0) self.suit = suit self.goal = CTGG.NoGoal self.goalId = CTGG.InvalidGoalId self.lastLocalTimeStampFromAI = 0 self.lastPosFromAI = Point3(0, 0, 0) self.lastThinkTime = 0 self.doneAdjust = False self.barrel = CTGG.NoBarrelCarried self.signalledAtReturnPos = False self.defaultPlayRate = 1.0 self.netTimeSentToStartByHit = 0 self.velocity = Vec3(0, 0, 0) self.oldVelocity = Vec3(0, 0, 0) self.acceleration = Vec3(0, 0, 0) self.bodyLength = self.CollisionRadius * 2 self.cruiseDistance = 2 * self.bodyLength self.maxVelocity = self.cogSpeed self.maxAcceleration = 5.0 self.perceptionRange = 6 self.notify.debug("cogSpeed=%s" % self.cogSpeed) self.kaboomSound = loader.loadSfx("phase_4/audio/sfx/MG_cannon_fire_alt.ogg") self.kaboom = loader.loadModel("phase_4/models/minigames/ice_game_kaboom") self.kaboom.setScale(2.0) self.kaboom.setBillboardPointEye() self.kaboom.hide() self.kaboomTrack = None splatName = "splat-creampie" self.splat = globalPropPool.getProp(splatName) self.splat.setBillboardPointEye() self.splatType = globalPropPool.getPropType(splatName) self.pieHitSound = globalBattleSoundCache.getSound("AA_wholepie_only.ogg") return
def __showSplat(self, position): if self.kaboomTrack is not None and self.kaboomTrack.isPlaying(): self.kaboomTrack.finish() if not self.pieHitSound: self.notify.warning('Trying to play hit sound on destroyed player') return splatName = 'splat-creampie' self.splat = globalPropPool.getProp(splatName) self.splat.setBillboardPointEye() self.splat.reparentTo(render) self.splat.setPos(self.toon, position) self.splat.setY(self.toon, bound(self.splat.getY(), self.toon.getHeight() / 2.0, position.getY())) self.splat.setAlphaScale(1.0) targetscale = 0.75 def setSplatAlpha(amount): self.splat.setAlphaScale(amount) self.kaboomTrack = Parallel(SoundInterval(self.pieHitSound, node=self.toon, volume=1.0, cutOff=PartyGlobals.PARTY_COG_CUTOFF), Sequence(Func(self.splat.showThrough), Parallel(Sequence(LerpScaleInterval(self.splat, duration=0.175, scale=targetscale, startScale=Point3(0.1, 0.1, 0.1), blendType='easeOut'), Wait(0.175)), Sequence(Wait(0.1), LerpFunc(setSplatAlpha, duration=1.0, fromData=1.0, toData=0.0, blendType='easeOut'))), Func(self.splat.cleanup), Func(self.splat.removeNode))) self.kaboomTrack.start() return
def __init__(self, parent = hidden, wantParticles = 1): NodePath.__init__(self, parent) self.assign(parent.attachNewNode('splash')) self.splashdown = globalPropPool.getProp('splashdown') self.splashdown.reparentTo(self) self.splashdown.setZ(-0.01) self.splashdown.setScale(0.4) 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 = 1 if self.wantParticles: self.pSystem = BattleParticles.createParticleEffect('SplashLines') self.pSystem.setScale(0.4) self.pSystem.setBin('fixed', 150, 1) 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() return
def __showSplat(self, position, direction, hot = False): if self.kaboomTrack is not None and self.kaboomTrack.isPlaying(): self.kaboomTrack.finish() self.clearHitInterval() splatName = 'splat-creampie' self.splat = globalPropPool.getProp(splatName) self.splat.setBillboardPointEye() self.splat.reparentTo(render) self.splat.setPos(self.root, position) self.splat.setAlphaScale(1.0) if not direction == 1.0: self.splat.setColorScale(PartyGlobals.CogActivitySplatColors[0]) if self.currentFacing > 0.0: facing = 'HitFront' else: facing = 'HitBack' else: self.splat.setColorScale(PartyGlobals.CogActivitySplatColors[1]) if self.currentFacing > 0.0: facing = 'HitBack' else: facing = 'HitFront' if hot: targetscale = 0.75 part = 'head' else: targetscale = 0.5 part = 'body' def setSplatAlpha(amount): self.splat.setAlphaScale(amount) self.hitInterval = Sequence(ActorInterval(self.actor, part + facing, loop=0), Func(self.actor.loop, 'idle')) self.hitInterval.start() self.kaboomTrack = Parallel(SoundInterval(self.pieHitSound, volume=1.0, node=self.actor, cutOff=PartyGlobals.PARTY_COG_CUTOFF), Sequence(Func(self.splat.showThrough), Parallel(Sequence(LerpScaleInterval(self.splat, duration=0.175, scale=targetscale, startScale=Point3(0.1, 0.1, 0.1), blendType='easeOut'), Wait(0.175)), Sequence(Wait(0.1), LerpFunc(setSplatAlpha, duration=1.0, fromData=1.0, toData=0.0, blendType='easeOut'))), Func(self.splat.cleanup), Func(self.splat.removeNode))) self.kaboomTrack.start()