MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / onAdd

Method onAdd

Engine/source/T3D/player.cpp:1673–1757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 14

warnfFunction · 0.85
clearTransitionMethod · 0.80
setPosMethod · 0.80
setMethod · 0.45
onNewDataBlockMethod · 0.45
registerObjectMethod · 0.45
getNameMethod · 0.45
destroySelfMethod · 0.45
getPointerMethod · 0.45
clearMethod · 0.45
getWorldMethod · 0.45
createPlayerMethod · 0.45

Tested by

no test coverage detected