| 1657 | //---------------------------------------------------------------------------- |
| 1658 | |
| 1659 | bool Player::onAdd() |
| 1660 | { |
| 1661 | ActionAnimation serverAnim = mActionAnimation; |
| 1662 | if(!Parent::onAdd() || !mDataBlock) |
| 1663 | return false; |
| 1664 | |
| 1665 | mWorkingQueryBox.minExtents.set(-1e9f, -1e9f, -1e9f); |
| 1666 | mWorkingQueryBox.maxExtents.set(-1e9f, -1e9f, -1e9f); |
| 1667 | |
| 1668 | addToScene(); |
| 1669 | |
| 1670 | // Make sure any state and animation passed from the server |
| 1671 | // in the initial update is set correctly. |
| 1672 | ActionState state = mState; |
| 1673 | mState = NullState; |
| 1674 | setState(state); |
| 1675 | setPose(StandPose); |
| 1676 | |
| 1677 | if (serverAnim.action != PlayerData::NullAnimation) |
| 1678 | { |
| 1679 | setActionThread(serverAnim.action, true, serverAnim.holdAtEnd, true, false, true); |
| 1680 | if (serverAnim.atEnd) |
| 1681 | { |
| 1682 | mShapeInstance->clearTransition(mActionAnimation.thread); |
| 1683 | mShapeInstance->setPos(mActionAnimation.thread, |
| 1684 | mActionAnimation.forward ? 1.0f : 0.0f); |
| 1685 | if (inDeathAnim()) |
| 1686 | mDeath.lastPos = 1.0f; |
| 1687 | } |
| 1688 | |
| 1689 | // We have to leave them sitting for a while since mounts don't come through right |
| 1690 | // away (and sometimes not for a while). Still going to let this time out because |
| 1691 | // I'm not sure if we're guaranteed another anim will come through and cancel. |
| 1692 | if (!isServerObject() && inSittingAnim()) |
| 1693 | mMountPending = (S32) sMountPendingTickWait; |
| 1694 | else |
| 1695 | mMountPending = 0; |
| 1696 | } |
| 1697 | if (mArmAnimation.action != PlayerData::NullAnimation) |
| 1698 | setArmThread(mArmAnimation.action); |
| 1699 | |
| 1700 | // |
| 1701 | if (isServerObject()) |
| 1702 | { |
| 1703 | scriptOnAdd(); |
| 1704 | } |
| 1705 | else |
| 1706 | { |
| 1707 | U32 i; |
| 1708 | for( i=0; i<PlayerData::NUM_SPLASH_EMITTERS; i++ ) |
| 1709 | { |
| 1710 | if ( mDataBlock->splashEmitterList[i] ) |
| 1711 | { |
| 1712 | mSplashEmitter[i] = new ParticleEmitter; |
| 1713 | mSplashEmitter[i]->onNewDataBlock( mDataBlock->splashEmitterList[i], false ); |
| 1714 | if( !mSplashEmitter[i]->registerObject() ) |
| 1715 | { |
| 1716 | Con::warnf( ConsoleLogEntry::General, "Could not register splash emitter for class: %s", mDataBlock->getName() ); |
nothing calls this directly
no test coverage detected