diff --git a/toontown/fishing/DistributedFishingTarget.py b/toontown/fishing/DistributedFishingTarget.py index de6f2314..e6b4905c 100755 --- a/toontown/fishing/DistributedFishingTarget.py +++ b/toontown/fishing/DistributedFishingTarget.py @@ -7,6 +7,7 @@ from direct.fsm import ClassicFSM from direct.fsm import State from direct.directutil import Mopath from toontown.toonbase import ToontownGlobals +from toontown.hood import FishAnimatedProp from direct.actor import Actor import FishingTargetGlobals import random @@ -37,6 +38,8 @@ class DistributedFishingTarget(DistributedNode.DistributedNode): self.bubbles = Bubbles.Bubbles(self, render) self.bubbles.renderParent.setDepthWrite(0) self.bubbles.start() + self.fish = FishAnimatedProp.FishAnimatedProp(self) + self.fish.enter() DistributedNode.DistributedNode.generate(self) def disable(self): @@ -45,6 +48,9 @@ class DistributedFishingTarget(DistributedNode.DistributedNode): self.track = None self.bubbles.destroy() del self.bubbles + self.fish.exit() + self.fish.delete() + del self.fish if self.pond: self.pond.removeTarget(self) self.pond = None @@ -84,4 +90,4 @@ class DistributedFishingTarget(DistributedNode.DistributedNode): self.track.start() def getRadius(self): - return self.radius + return self.radius \ No newline at end of file diff --git a/toontown/hood/FishAnimatedProp.py b/toontown/hood/FishAnimatedProp.py index 439d1b2b..796a3794 100755 --- a/toontown/hood/FishAnimatedProp.py +++ b/toontown/hood/FishAnimatedProp.py @@ -5,19 +5,13 @@ from toontown.effects.Splash import * from toontown.effects.Ripples import * import random -class FishAnimatedProp(AnimatedProp.AnimatedProp): +class FishAnimatedProp: def __init__(self, node): - AnimatedProp.AnimatedProp.__init__(self, node) - parent = node.getParent() - self.fish = Actor.Actor(node, copy=0) - self.fish.reparentTo(parent) - self.fish.setTransform(node.getTransform()) - node.clearMat() - self.fish.loadAnims({'jump': 'phase_4/models/props/SZ_fish-jump', - 'swim': 'phase_4/models/props/SZ_fish-swim'}) + self.fish = Actor.Actor('phase_4/models/props/SZ_fish-mod', {'jump': 'phase_4/models/props/SZ_fish-jump', 'swim': 'phase_4/models/props/SZ_fish-swim'}, copy=0) + self.fish.hide() + self.fish.reparentTo(node) self.splashSfxList = (loader.loadSfx('phase_4/audio/sfx/TT_splash1.ogg'), loader.loadSfx('phase_4/audio/sfx/TT_splash2.ogg')) - self.node = self.fish self.geom = self.fish.getGeomNode() self.exitRipples = Ripples(self.geom) self.exitRipples.setBin('fixed', 25, 1) @@ -25,7 +19,7 @@ class FishAnimatedProp(AnimatedProp.AnimatedProp): self.splash = Splash(self.geom, wantParticles=0) self.splash.setPosHprScale(-1, 0.0, 1.23, 0.0, 0.0, 0.0, 0.7, 0.7, 0.7) randomSplash = random.choice(self.splashSfxList) - self.track = Sequence(FunctionInterval(self.randomizePosition), Func(self.node.unstash), Parallel(self.fish.actorInterval('jump'), Sequence(Wait(0.25), Func(self.exitRipples.play, 0.75)), Sequence(Wait(1.14), Func(self.splash.play), SoundInterval(randomSplash, volume=0.8, node=self.node))), Wait(1), Func(self.node.stash), Wait(4 + 10 * random.random()), name=self.uniqueName('Fish')) + self.track = Sequence(Parallel(Func(self.fish.show), self.fish.actorInterval('jump'), Sequence(Wait(0.25), Func(self.exitRipples.play, 0.75)), Sequence(Wait(1.13), Func(self.splash.play), SoundInterval(randomSplash, volume = 0.8, node = self.fish), Func(self.fish.hide))), Wait(5 + 10 * random.random())) def delete(self): self.exitRipples.destroy() @@ -35,22 +29,12 @@ class FishAnimatedProp(AnimatedProp.AnimatedProp): del self.track self.fish.removeNode() del self.fish - del self.node del self.geom - def randomizePosition(self): - x = 5 * (random.random() - 0.5) - y = 5 * (random.random() - 0.5) - h = 360 * random.random() - self.geom.setPos(x, y, 0) - self.geom.setHpr(h, 0, 0) - def enter(self): - AnimatedProp.AnimatedProp.enter(self) self.track.loop() def exit(self): - AnimatedProp.AnimatedProp.exit(self) self.track.finish() self.splash.stop() - self.exitRipples.stop() + self.exitRipples.stop() \ No newline at end of file