generate() and announceGenerate() doubt

So, I’m still working around the code I downloaded from [url]DistributedNode]

According to the comments from that code generate() and announceGenerate() works as follows:

    def generate(self):
        """ This method is called when the object is generated: when it
        manifests for the first time on a particular client, or when it
        is pulled out of the cache after a previous manifestation.  At
        the time of this call, the object has been created, but its
        required fields have not yet been filled in. """ 

    def announceGenerate(self):
        """ This method is called after generate(), after all of the
        required fields have been filled in.  At the time of this call,
        the distributed object is ready for use. """

       

So, when one of the actors gets “killed” I want them to respawn completely healed in some random position.
My respawn method is:

    def respawn(self):
        # Disable follow cam and remove healthGUI
        self.healthGUI.destroy()
        self.followCam.disable()
        taskMgr.remove("moveActor")
        self.actor.stopPosHprBroadcast()
        # Disable our current avatar. Actor is cacheable
        self.actor.disable()

        # Generate random respawn position
        x = uniform(-150, 150)
        y = uniform(-150, 150)
        self.actor.generate()
        self.actor.setupLocalActor()
        # Set position in local client
        self.actor.setPos(x,y,0)
        # And let the other clients now my new position
        self.actor.d_setPos(x,y,0)
        # Set health, both for ourselves and the rest of the clients
        self.actor.b_setHealth(100)
        # Look forward
        self.actor.setH(180)
        self.actor.d_setH(180)
        self.actor.announceGenerate()
        self.followCam = FollowCam(base.camera, self.actor)
        self.healthGUI = OnscreenText("Health " + str(self.actor.health),\
                            bg=Vec4(1,1,0,1), fg=(0,0,0,1), pos=Vec2(-1.0,-0.8))
        self.moveTask = taskMgr.add(self.moveActor, 'moveActor')
        self.actor.startPosHprBroadcast()

I have set the DistributedSmoothActor class as cacheable so that when I call disable it doesn’t call delete (at least that’s what I assume has to be done from reading code documentation)

Here are the overriden generate() and announceGenerate
for the DistributedSmoothActor class:

    def generate(self):
        DistributedSmoothNode.generate(self)
        # We can start smoothing right-away
        self.activateSmoothing(True, False)
        #self.startSmooth()
        taskMgr.add(self.doSmoothTask, "smooth task")

    def announceGenerate(self):
        DistributedSmoothNode.announceGenerate(self)
        self.reparentTo(render)
        self.actor.pose("walk", 5)
        if (self.getStanding()==0):
            self.b_loop("run")

So, a few weird things going on here:
1- The actor indeed respawns in a random position. However is almost instantly “teleported” to position (0,0,0).
2- The smoothing is not being done
3- Even though I call setHealth and it’s distributed flavor in respawn(), the actor’s health remains 0. I know this as I get an error when I “shoot” at him saying I’m calling setHealth() inside the function that’s called when an actor is hit by a bullet with an invalid value of -5 (each bullet drains 5 health from the actor).

Any thought on what am I missing here? I still don’t quite fully understand when and how are generate() and announceGenerate() are called. Furthermore, if got this right, announceGenerate() is supossed to be called when all required fields have been set: do these need to be explicitely set by the client or can they be set in the distributed class constructor.