shapeBase.cpp

Engine/source/T3D/shapeBase.cpp

More...

Classes:

Public Functions

ConsoleDocClass(ShapeBase , "@ingroup gameObjects" )
ConsoleDocClass(ShapeBaseData , "@brief Defines properties <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ShapeBase\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">gameObjects\n</a>" )
DefineEngineMethod(ShapeBase , applyDamage , void , (F32 amount) , "@brief Increment the current damage level by the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">amount.\n\n</a>" "@param amount <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> add <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> current damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" )
DefineEngineMethod(ShapeBase , applyImpulse , bool , (Point3F pos, Point3F vec) , "@brief Apply an impulse <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@param pos world position of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">impulse\n</a>" "@param vec impulse momentum (velocity * mass)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">true\n\n</a>" )
DefineEngineMethod(ShapeBase , applyRepair , void , (F32 amount) , "@brief Repair damage by the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">amount.\n\n</a>" "Note that the damage level is only reduced by repairRate per tick, so it may " "take several ticks <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the total repair <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">complete.\n</a>" " @param amount total repair <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a>(subtracted from damage level over time)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , blowUp , void , () , "@brief Explodes an object into pieces." )
DefineEngineMethod(ShapeBase , canCloak , bool , () , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> this object can <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">cloak.\n\n</a>" "@return <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">true\n</a>" "@note Not implemented as it always returns true." )
DefineEngineMethod(ShapeBase , changeMaterial , void , (const char *mapTo, Material *oldMat, Material *newMat) , "@brief Change one of the materials on the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "This method changes materials per mapTo with others. The material that " "is being replaced is mapped <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> unmapped_mat as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> part of this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transition.\n</a>" "@note Warning)
DefineEngineMethod(ShapeBase , destroyThread , bool , (S32 slot) , "@brief Destroy an animation thread, which prevents it from <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playing.\n\n</a>" " @param slot thread slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">destroy\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playThread\n</a>" )
DefineEngineMethod(ShapeBase , dumpMeshVisibility , void , () , "@brief Print <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> list of visible and hidden meshes in the shape <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the console " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> debugging <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">purposes.\n\n</a>" "@note Only in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> SHIPPING <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">build.\n</a>" )
DefineEngineMethod(ShapeBase , getAIRepairPoint , Point3F , () , "@brief Get the position at which the AI should stand <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> repair <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">things.\n\n</a>" "If the shape defines <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> node called \"AIRepairNode\" , this method will " "return the current world position of that node, otherwise \"0 0 0\".\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return the AI repair <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position\n\n</a>" )
DefineEngineMethod(ShapeBase , getCameraFov , F32 , () , "@brief Returns the vertical field of view in degrees <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this object <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> used as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@return current FOV as defined in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ShapeBaseData::cameraDefaultFov\n</a>" )
DefineEngineMethod(ShapeBase , getControllingClient , S32 , () , "@brief Get the client (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> any) that controls this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "The controlling client is the one that will send moves <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> us <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> act <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">on.\n</a>" "@return the ID of the controlling GameConnection, or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> this object is not " "controlled by any <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">client.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GameConnection\n</a>" )
DefineEngineMethod(ShapeBase , getControllingObject , S32 , () , "@brief Get the object (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> any) that controls this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@return the ID of the controlling <a href="/coding/class/classshapebase/">ShapeBase</a> object, or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> this object is " "not controlled by another <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n</a>" )
DefineEngineMethod(ShapeBase , getDamageFlash , F32 , () , "@brief Get the damage flash <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "@return flash <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setDamageFlash\n</a>" )
DefineEngineMethod(ShapeBase , getDamageLevel , F32 , () , "@brief Get the object's current damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "@return damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" "@see setDamageLevel()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , getDamagePercent , F32 , () , "@brief Get the object's current damage level as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> percentage of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">maxDamage.\n\n</a>" "@return damageLevel / <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">datablock.maxDamage\n</a>" "@see setDamageLevel()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , getDamageState , const char * , () , "@brief Get the object's damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "@return the damage state; one of \"Enabled\" , \"Disabled\" , \"Destroyed\"\n" "@see setDamageState()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , getDefaultCameraFov , F32 , () , "@brief Returns the default vertical field of view in degrees <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this object <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> used as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@return Default <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">FOV\n</a>" )
DefineEngineMethod(ShapeBase , getEnergyLevel , F32 , () , "@brief Get the object's current energy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "@return energy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" "@see setEnergyLevel()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , getEnergyPercent , F32 , () , "@brief Get the object's current energy level as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> percentage of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">maxEnergy.\n\n</a>" "@return energyLevel / <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">datablock.maxEnergy\n</a>" "@see setEnergyLevel()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , getEyePoint , Point3F , () , "@brief Get the position of the 'eye' <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "If the object model has <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> node called 'eye' , this method will return that " "node 's current world position, otherwise it will return the object 's current " "world <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @return the eye position <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getEyeVector\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getEyeTransform\n</a>" )
DefineEngineMethod(ShapeBase , getEyeTransform , TransformF , () , "@brief Get the 'eye' transform <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "If the object model has <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> node called 'eye' , this method will return that " "node 's current transform, otherwise it will return the object 's current " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform.\n</a>" " @return the eye transform <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getEyeVector\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getEyePoint\n</a>" )
DefineEngineMethod(ShapeBase , getEyeVector , VectorF , () , "@brief Get the forward direction of the 'eye' <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "If the object model has <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> node called 'eye' , this method will return that " "node 's current forward direction vector, otherwise it will return the " "object 's current forward direction <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" " @return the eye vector <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getEyePoint\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getEyeTransform\n</a>" )
DefineEngineMethod(ShapeBase , getImageAltTrigger , bool , (S32 slot) , "@brief Get the alt trigger state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the Image's current alt trigger <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )
DefineEngineMethod(ShapeBase , getImageAmmo , bool , (S32 slot) , "@brief Get the ammo state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the Image's current ammo <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )
DefineEngineMethod(ShapeBase , getImageGenericTrigger , bool , (S32 slot, S32 trigger) , "@brief Get the generic trigger state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@param trigger Generic trigger <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">number\n</a>" "@return the Image's current generic trigger <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )
DefineEngineMethod(ShapeBase , getImageLoaded , bool , (S32 slot) , "@brief Get the loaded state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the Image's current loaded <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )
DefineEngineMethod(ShapeBase , getImageScriptAnimPrefix , const char * , (S32 slot) , "@brief Get the script animation prefix of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the Image's current script animation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">prefix\n\n</a>" )
DefineEngineMethod(ShapeBase , getImageSkinTag , S32 , (S32 slot) , "@brief Get the skin tag ID <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the skinTag <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> passed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> mountImage when the image was " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mounted\n\n</a>" )
DefineEngineMethod(ShapeBase , getImageState , const char * , (S32 slot) , "@brief Get the name of the current state of the Image in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return name of the current Image state, or \"Error\" if slot is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">invalid\n\n</a>" )
DefineEngineMethod(ShapeBase , getImageTarget , bool , (S32 slot) , "@brief Get the target state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the Image's current target <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )
DefineEngineMethod(ShapeBase , getImageTrigger , bool , (S32 slot) , "@brief Get the trigger state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the Image's current trigger <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )
DefineEngineMethod(ShapeBase , getLookAtPoint , const char * , (F32 distance, U32 typeMask) , (2000, 0xFFFFFFFF) )
DefineEngineMethod(ShapeBase , getMaxDamage , F32 , () , "Get the object's maxDamage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n</a>" "@return <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">datablock.maxDamage\n</a>" )
DefineEngineMethod(ShapeBase , getModelFile , const char * , () , "@brief Get the model filename used by this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "@return the shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">filename\n\n</a>" )
DefineEngineMethod(ShapeBase , getMountedImage , S32 , (S32 slot) , "@brief Get the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return ID of the <a href="/coding/class/structshapebaseimagedata/">ShapeBaseImageData</a> datablock mounted in the slot, or 0 " "<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no Image is mounted <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">there.\n\n</a>" )
DefineEngineMethod(ShapeBase , getMountSlot , S32 , (ShapeBaseImageData *image) , "@brief Get the first slot the given datablock is mounted <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> on this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@param image <a href="/coding/class/structshapebaseimagedata/">ShapeBaseImageData</a> datablock <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return index of the first slot the Image is mounted in, or -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the Image " "is not mounted in any slot on this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" )
DefineEngineMethod(ShapeBase , getMuzzlePoint , Point3F , (S32 slot) , "@brief Get the muzzle position of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "If the Image shape contains <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> node called 'muzzlePoint' , then the muzzle " "position is the position of that node in world space. If no such node " "is specified, the slot 's mount node is used <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">instead.\n</a>" " @param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" " @return the muzzle position, or \"0 0 0\" <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the slot is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">invalid\n\n</a>" )
DefineEngineMethod(ShapeBase , getMuzzleVector , VectorF , (S32 slot) , "@brief Get the muzzle vector of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "If the Image shape contains <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> node called 'muzzlePoint' , then the muzzle " "vector is the forward direction vector of that node 's transform in world " "space. If no such node is specified, the slot 's mount node is used " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">instead.\n\n</a>" "If the correctMuzzleVector flag(correctMuzzleVectorTP in 3rd person) " "is set in the Image, the muzzle vector is computed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> point at whatever " "object is right in front of the object 's 'eye' <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" " @param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" " @return the muzzle vector, or \"0 1 0\" <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the slot is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">invalid\n\n</a>" )
DefineEngineMethod(ShapeBase , getPendingImage , S32 , (S32 slot) , "@brief Get the Image that will be mounted next in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "Calling mountImage when an Image is already mounted does one of two things: " "<ol><li>Mount the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> Image immediately, the old Image is discarded and " "whatever state it was in is ignored.</li >" "< li >If the current Image state does not allow Image changes, the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> " "Image is marked as pending, and will not be mounted until the current " "state completes. eg. <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the user changes weapons, you may wish <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> ensure " "that the current weapon firing state plays <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> completion first.</li ></ol >\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "This command retrieves the ID of the pending Image(2nd case above).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" " @return ID of the pending <a href="/coding/class/structshapebaseimagedata/">ShapeBaseImageData</a> datablock, or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">none.\n\n</a>" )
DefineEngineMethod(ShapeBase , getRechargeRate , F32 , () , "@brief Get the current recharge <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rate.\n\n</a>" "@return the recharge rate (per tick)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see setRechargeRate()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , getRepairRate , F32 , () , "@brief Get the per-tick repair <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">amount.\n\n</a>" "@return the current <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be subtracted from damage level each <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tick\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setRepairRate\n</a>" )
DefineEngineMethod(ShapeBase , getShapeName , const char * , () , "@brief Get the name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "@note This is the name of the shape object that is sent <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the client, " "not the DTS or DAE model <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">filename.\n</a>" " @return the name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape\n\n</a>" " @see setShapeName()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , getSkinName , const char * , () , "@brief Get the name of the skin applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "@return the name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">skin\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">skin\n</a>" "@see setSkinName()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , getSlotTransform , TransformF , (S32 slot) , "@brief Get the world transform of the specified mount <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the mount <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform\n\n</a>" )
DefineEngineMethod(ShapeBase , getTargetCount , S32 , () , "@brief Get the number of materials in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "@return the number of materials in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "@see getTargetName()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , getTargetName , const char * , (S32 index) , "@brief Get the name of the indexed shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">material.\n\n</a>" "@param index index of the material <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> get (valid range is 0 - getTargetCount()-1).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return the name of the indexed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">material.\n\n</a>" "@see getTargetCount()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , getVelocity , VectorF , () , "@brief Get the object's current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">velocity.\n\n</a>" "@return the current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">velocity\n\n</a>" )
DefineEngineMethod(ShapeBase , getWhiteOut , F32 , () , "@brief Get the white-out <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "@return white-out <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setWhiteOut\n</a>" )
DefineEngineMethod(ShapeBase , hasImageState , bool , (S32 slot, const char *state) , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the given state exists on the mounted <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@param state Image state <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> check <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">for\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the Image has the requested state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">defined.\n\n</a>" )
DefineEngineMethod(ShapeBase , isCloaked , bool , () , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> this object is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">cloaked.\n\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> cloaked, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not\n</a>" " @see setCloaked()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , isDestroyed , bool , () , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the object is in the Destroyed damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> damage state is \"Destroyed\" , false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not\n</a>" " @see isDisabled()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see isEnabled()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , isDisabled , bool , () , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the object is in the Disabled or Destroyed damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> damage state is not \"Enabled\" , false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is\n</a>" " @see isDestroyed()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see isEnabled()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , isEnabled , bool , () , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the object is in the Enabled damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> damage state is \"Enabled\" , false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not\n</a>" " @see isDestroyed()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see isDisabled()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , isHidden , bool , () , "Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the object is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">hidden.\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the object is hidden, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">visible.\n\n</a>" )
DefineEngineMethod(ShapeBase , isImageFiring , bool , (S32 slot) , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the current Image state is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">firing.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the current Image state in this slot has the 'stateFire' flag <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">set.\n</a>" )
DefineEngineMethod(ShapeBase , isImageMounted , bool , (ShapeBaseImageData *image) , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the given datablock is mounted <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> any slot on this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@param image <a href="/coding/class/structshapebaseimagedata/">ShapeBaseImageData</a> datablock <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the Image is mounted <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> any slot, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise.\n\n</a>" )
DefineEngineMethod(ShapeBase , mountImage , bool , (ShapeBaseImageData *image, S32 slot, bool loaded, const char *skinTag) , (true, "") , "@brief Mount <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image.\n\n</a>" "@param image the Image <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mount\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> mount into (valid range is 0 - 3)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param loaded initial loaded state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@param skinTag tagged string <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> reskin the mounted <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%player.mountImage(PistolImage, 1);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "%player.mountImage(CrossbowImage, 0, false);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "%player.mountImage(RocketLauncherImage, 0, true, 'blue');\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" " @see unmountImage()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see getMountedImage()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see getPendingImage()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see isImageMounted()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , pauseThread , bool , (S32 slot) , "@brief Pause an animation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">thread.\n\n</a>" "If restarted using playThread, the animation " "will resume from the paused <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @param slot thread slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">stop\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playThread\n</a>" )
DefineEngineMethod(ShapeBase , playAudio , bool , (S32 slot, SFXTrack *track) , "@brief Attach <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> sound <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> this shape and start playing <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it.\n\n</a>" "@param slot Audio slot index <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the sound (valid range is 0 - 3)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param track <a href="/coding/class/classsfxtrack/">SFXTrack</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">play\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the sound was attached successfully, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see stopAudio()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , playThread , bool , (S32 slot, const char *name) , ("") , "@brief Start <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> animation thread, or restart one that has been paused or " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">stopped.\n\n</a>" " @param slot thread slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play. Valid range is 0 - 3)
DefineEngineMethod(ShapeBase , setAllMeshesHidden , void , (bool hide) , "@brief Set the hidden state on all the shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">meshes.\n\n</a>" "This allows you <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> hide all meshes in the shape, <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> example, and then only " "enable <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">few.\n</a>" " @param hide <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> hidden state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> all <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">meshes\n\n</a>" )
DefineEngineMethod(ShapeBase , setCameraFov , void , (F32 fov) , "@brief Set the vertical field of view in degrees <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this object <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> used as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@param fov <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> FOV <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value\n</a>" )
DefineEngineMethod(ShapeBase , setCloaked , void , (bool cloak) , "@brief Set the cloaked state of this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "When an object is cloaked it is not <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rendered.\n</a>" "@param cloak true <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> cloak the object, false <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">uncloak\n</a>" " @see isCloaked()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , setDamageFlash , void , (F32 level) , "@brief Set the damage flash <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "Damage flash may be used as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> postfx effect <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> flash the screen when the " "client is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">damaged.\n</a>" "@note Relies on the flash <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">postFx.\n</a>" "@param level flash level (0-1)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see getDamageFlash()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , setDamageLevel , void , (F32 level) , "@brief Set the object's current damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "@param level <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" "@see getDamageLevel()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see getDamagePercent()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , setDamageState , bool , (const char *state) , "@brief Set the object's damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "@param state should be one of \"Enabled\" , \"Disabled\" , \"Destroyed\"\n" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n</a>" " @see getDamageState()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , setDamageVector , void , (Point3F vec) , "@brief Set the damage direction <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n\n</a>" "Currently this is only used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> initialise the explosion <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> this object " "is blown <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">up.\n</a>" "@param vec damage direction <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%obj.setDamageVector( \"0 0 1\" );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineEngineMethod(ShapeBase , setEnergyLevel , void , (F32 level) , "@brief Set this object's current energy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "@param level <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> energy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" "@see getEnergyLevel()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see getEnergyPercent()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , setHidden , void , (bool show) , "@brief Add or remove this object from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">scene.\n\n</a>" "When removed from the scene, the object will not be processed or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rendered.\n</a>" " @param show False <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> hide the object, true <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> re-show <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it\n\n</a>" )
DefineEngineMethod(ShapeBase , setImageAltTrigger , bool , (S32 slot, bool state) , "@brief Set the alt trigger state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param state <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> alt trigger state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@return the Image's <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> alt trigger <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )
DefineEngineMethod(ShapeBase , setImageAmmo , bool , (S32 slot, bool state) , "@brief Set the ammo state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param state <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> ammo state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@return the Image's <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> ammo <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )
DefineEngineMethod(ShapeBase , setImageGenericTrigger , S32 , (S32 slot, S32 trigger, bool state) , "@brief Set the generic trigger state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param trigger Generic trigger <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">number\n</a>" "@param state <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> generic trigger state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@return the Image's <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> generic trigger state or -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> there was <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">problem.\n\n</a>" )
DefineEngineMethod(ShapeBase , setImageLoaded , bool , (S32 slot, bool state) , "@brief Set the loaded state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param state <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> loaded state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@return the Image's <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> loaded <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )
DefineEngineMethod(ShapeBase , setImageScriptAnimPrefix , void , (S32 slot, const char *prefix) , "@brief Set the script animation prefix <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "This is used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> further modify the prefix used when deciding which animation sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> " "play <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> this image is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mounted.\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param prefix The prefix applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">image\n</a>" )
DefineEngineMethod(ShapeBase , setImageTarget , bool , (S32 slot, bool state) , "@brief Set the target state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param state <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> target state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@return the Image's <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> target <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )
DefineEngineMethod(ShapeBase , setImageTrigger , bool , (S32 slot, bool state) , "@brief Set the trigger state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param state <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> trigger state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@return the Image's <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> trigger <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )
DefineEngineMethod(ShapeBase , setMeshHidden , void , (const char *name, bool hide) , "@brief Set the hidden state on the named shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mesh.\n\n</a>" "@param name name of the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> hide/<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">show\n</a>" "@param hide <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> hidden state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mesh\n\n</a>" )
DefineEngineMethod(ShapeBase , setRechargeRate , void , (F32 rate) , "@brief Set the recharge <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rate.\n\n</a>" "The recharge rate is added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the object's current energy level each tick, " "up <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the maxEnergy level set in the <a href="/coding/class/structshapebasedata/">ShapeBaseData</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">datablock.\n</a>" " @param rate the recharge rate(per tick)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see getRechargeRate()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , setRepairRate , void , (F32 rate) , "@brief Set amount <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> repair damage by each <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tick.\n\n</a>" "Note that this <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> is separate <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the repairRate field in ShapeBaseData. " "This <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> will be subtracted from the damage level each tick, whereas the " "<a href="/coding/class/structshapebasedata/">ShapeBaseData</a> field limits how much of the applyRepair <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> is subtracted " "each tick. Both repair types can be active at the same <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">time.\n</a>" " @param rate <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> subtract from damage level each tick(must be > 0)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see getRepairRate()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , setShapeName , void , (const char *name) , "@brief Set the name of this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "@note This is the name of the shape object that is sent <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the client, " "not the DTS or DAE model <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">filename.\n</a>" " @param name <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> name <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape\n\n</a>" " @see getShapeName()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , setSkinName , void , (const char *name) , "@brief Apply <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> skin <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "'Skinning' the shape effectively renames the material targets, allowing " "different materials <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be used on different instances of the same <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n\n</a>" " @param name name of the skin <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">apply\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">skin\n</a>" " @see getSkinName()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , setThreadDir , bool , (S32 slot, bool fwd) , "@brief Set the playback direction of an animation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">thread.\n\n</a>" "@param slot thread slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param fwd true <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play the animation forwards, false <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">backwards\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see playThread()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , setThreadPosition , bool , (S32 slot, F32 pos) , "@brief Set the position within an animation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">thread.\n\n</a>" "@param slot thread slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param pos position within <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">thread\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playThread\n</a>" )
DefineEngineMethod(ShapeBase , setThreadTimeScale , bool , (S32 slot, F32 scale) , "@brief Set the playback time scale of an animation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">thread.\n\n</a>" "@param slot thread slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param scale <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> thread time scale (1=normal speed, 0.5=half speed etc)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playThread\n</a>" )
DefineEngineMethod(ShapeBase , setVelocity , bool , (Point3F vel) , "@brief Set the object's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">velocity.\n\n</a>" "@param vel <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> velocity <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@return <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">true\n\n</a>" )
DefineEngineMethod(ShapeBase , setWhiteOut , void , (F32 level) , "@brief Set the white-out <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "White-out may be used as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> postfx effect <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> brighten the screen in response " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> game <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">event.\n</a>" "@note Relies on the flash <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">postFx.\n</a>" "@param level flash level (0-1)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see getWhiteOut()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , startFade , void , (S32 time, S32 delay, bool fadeOut) , "@brief Fade the object in or out without removing it from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">scene.\n\n</a>" "A faded out object is still in the scene and can still be collided with, " "so <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> you want <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> disable collisions <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this shape after it fades out " "use setHidden <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> temporarily remove this shape from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">scene.\n</a>" " @note Items have the ability <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> light their surroundings. When an <a href="/coding/class/classitem/">Item</a> with " "an active light is fading out, the light it emits is correspondingly " "reduced until it goes out. Likewise, when the item fades in, the light is " "turned-up till it reaches it 's normal <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">brightntess.\n</a>" " @param time duration of the fade effect in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ms\n</a>" " @param delay delay in ms before the fade effect <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">begins\n</a>" " @param fadeOut true <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> fade-out <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> invisible, false <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> fade-in <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> full <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">visibility\n</a>" )
DefineEngineMethod(ShapeBase , stopAudio , bool , (S32 slot) , "@brief Stop <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> sound started with <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playAudio.\n\n</a>" "@param slot audio slot index (started with playAudio)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the sound was stopped successfully, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see playAudio()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBase , stopThread , bool , (S32 slot) , "@brief Stop an animation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">thread.\n\n</a>" "If restarted using playThread, the animation " "will start from the beginning <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">again.\n</a>" " @param slot thread slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">stop\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playThread\n</a>" )
DefineEngineMethod(ShapeBase , unmountImage , bool , (S32 slot) , "@brief Unmount the mounted Image in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">unmount\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see mountImage()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(ShapeBaseData , checkDeployPos , bool , (TransformF txfm) , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> there is the space at the given transform is free <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> spawn <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">into.\n\n</a>" "The shape's bounding box volume is used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> check <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> collisions at the given world " "transform. Only interior and static objects are checked <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">collision.\n</a>" "@param txfm Deploy transform <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the space is free, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> there is already something in " "the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">way.\n</a>" " @note This is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> server side only check, and is not actually limited <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">spawning.\n</a>" )
DefineEngineMethod(ShapeBaseData , getDeployTransform , TransformF , (Point3F pos, Point3F normal) , "@brief Helper method <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> get <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> transform from <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> position and vector (suitable <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> use with setTransform).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param pos Desired transform <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position\n</a>" "@param normal <a href="/coding/class/classvector/">Vector</a> of desired <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">direction\n</a>" "@return The deploy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform\n</a>" )
IMPLEMENT_CALLBACK(ShapeBase , validateCameraFov , F32 , (F32 fov) , (fov) , "@brief Called on the server when the client has requested <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> FOV <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">change.\n\n</a>" "When the client requests that its field of view should be changed (because " "they want <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> sniper scope, <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> example) this <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> FOV needs <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be validated " "by the server. This method is called <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it exists (it is optional) <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> validate " "the requested FOV, and modify it <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> necessary. This could be as simple as checking " "that the FOV falls within <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> correct range, <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> making sure that the FOV matches the " "capabilities of the current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">weapon.\n\n</a>" "Following this method, <a href="/coding/class/classshapebase/">ShapeBase</a> ensures that the given FOV still falls within " "the datablock 's cameraMinFov and cameraMaxFov. If that is good enough <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> your " " purposes, then you do not need <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> define the validateCameraFov() callback <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> " "your <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ShapeBase.\n\n</a>" " @param fov The FOV that has been requested by the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">client.\n</a>" " @return The FOV as validated by the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">server.\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ShapeBaseData\n\n</a>" )
IMPLEMENT_CALLBACK(ShapeBaseData , onCollision , void , (ShapeBase *obj, SceneObject *collObj, VectorF vec, F32 len) , (obj, collObj, vec, len) , "@brief Called when we collide with another <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param collObj The object we collided <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">with\n</a>" "@param vec <a href="/coding/class/structcollision/">Collision</a> impact <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1afed088663f8704004425cdae2120b9b3">len</a> Length of the impact <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector\n</a>" )
IMPLEMENT_CALLBACK(ShapeBaseData , onDamage , void , (ShapeBase *obj, F32 delta) , (obj, delta) , "@brief Called when the object is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">damaged.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param delta The amount of damage received." )
IMPLEMENT_CALLBACK(ShapeBaseData , onDestroyed , void , (ShapeBase *obj, const char *lastState) , (obj, lastState) , "@brief Called when the object damage state changes <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Destroyed.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param lastState The previous damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n</a>" )
IMPLEMENT_CALLBACK(ShapeBaseData , onDisabled , void , (ShapeBase *obj, const char *lastState) , (obj, lastState) , "@brief Called when the object damage state changes <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Disabled.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param lastState The previous damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n</a>" )
IMPLEMENT_CALLBACK(ShapeBaseData , onEnabled , void , (ShapeBase *obj, const char *lastState) , (obj, lastState) , "@brief Called when the object damage state changes <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Enabled.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param lastState The previous damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n</a>" )
IMPLEMENT_CALLBACK(ShapeBaseData , onEndSequence , void , (ShapeBase *obj, S32 slot, const char *name) , (obj, slot, name) , "@brief Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> thread playing <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> non-cyclic sequence reaches the end of the " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param slot <a href="/coding/class/classthread/">Thread</a> slot that finished <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playing\n</a>" "@param name <a href="/coding/class/classthread/">Thread</a> name that finished <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playing\n</a>" )
IMPLEMENT_CALLBACK(ShapeBaseData , onForceUncloak , void , (ShapeBase *obj, const char *reason) , (obj, reason) , "@brief Called when the object is forced <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">uncloak.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param reason <a href="/coding/class/classstring/">String</a> describing why the object was <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">uncloaked\n</a>" )
IMPLEMENT_CALLBACK(ShapeBaseData , onImpact , void , (ShapeBase *obj, SceneObject *collObj, VectorF vec, F32 len) , (obj, collObj, vec, len) , "@brief Called when we collide with another object beyond some impact <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">speed.\n\n</a>" "The <a href="/coding/class/classplayer/">Player</a> class makes use of this callback when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> collision speed is more than <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">PlayerData::minImpactSpeed.\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param collObj The object we collided <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">with\n</a>" "@param vec <a href="/coding/class/structcollision/">Collision</a> impact <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1afed088663f8704004425cdae2120b9b3">len</a> Length of the impact <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector\n</a>" )
IMPLEMENT_CALLBACK(ShapeBaseData , onTrigger , void , (ShapeBase *obj, S32 index, bool state) , (obj, index, state) , "@brief Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> move trigger input changes <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param index Index of the trigger that <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">changed\n</a>" "@param state New state of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">trigger\n</a>" )

Detailed Description

Public Variables

ShapeBaseDataProto gShapeBaseDataProto 
SimTime sAudioTimeout 
const char * sDamageStateName []
Chunker< ShapeBase::CollisionTimeout > sTimeoutChunker 

Public Functions

ConsoleDocClass(ShapeBase , "@ingroup gameObjects" )

ConsoleDocClass(ShapeBaseData , "@brief Defines properties <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ShapeBase\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">gameObjects\n</a>" )

DefineEngineMethod(ShapeBase , applyDamage , void , (F32 amount) , "@brief Increment the current damage level by the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">amount.\n\n</a>" "@param amount <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> add <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> current damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" )

DefineEngineMethod(ShapeBase , applyImpulse , bool , (Point3F pos, Point3F vec) , "@brief Apply an impulse <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@param pos world position of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">impulse\n</a>" "@param vec impulse momentum (velocity * mass)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">true\n\n</a>" )

DefineEngineMethod(ShapeBase , applyRepair , void , (F32 amount) , "@brief Repair damage by the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">amount.\n\n</a>" "Note that the damage level is only reduced by repairRate per tick, so it may " "take several ticks <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the total repair <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">complete.\n</a>" " @param amount total repair <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a>(subtracted from damage level over time)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , blowUp , void , () , "@brief Explodes an object into pieces." )

DefineEngineMethod(ShapeBase , canCloak , bool , () , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> this object can <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">cloak.\n\n</a>" "@return <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">true\n</a>" "@note Not implemented as it always returns true." )

DefineEngineMethod(ShapeBase , changeMaterial , void , (const char *mapTo, Material *oldMat, Material *newMat) , "@brief Change one of the materials on the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "This method changes materials per mapTo with others. The material that " "is being replaced is mapped <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> unmapped_mat as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> part of this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transition.\n</a>" "@note Warning)

DefineEngineMethod(ShapeBase , destroyThread , bool , (S32 slot) , "@brief Destroy an animation thread, which prevents it from <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playing.\n\n</a>" " @param slot thread slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">destroy\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playThread\n</a>" )

DefineEngineMethod(ShapeBase , dumpMeshVisibility , void , () , "@brief Print <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> list of visible and hidden meshes in the shape <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the console " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> debugging <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">purposes.\n\n</a>" "@note Only in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> SHIPPING <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">build.\n</a>" )

DefineEngineMethod(ShapeBase , getAIRepairPoint , Point3F , () , "@brief Get the position at which the AI should stand <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> repair <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">things.\n\n</a>" "If the shape defines <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> node called \"AIRepairNode\" , this method will " "return the current world position of that node, otherwise \"0 0 0\".\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return the AI repair <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position\n\n</a>" )

DefineEngineMethod(ShapeBase , getCameraFov , F32 , () , "@brief Returns the vertical field of view in degrees <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this object <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> used as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@return current FOV as defined in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ShapeBaseData::cameraDefaultFov\n</a>" )

DefineEngineMethod(ShapeBase , getControllingClient , S32 , () , "@brief Get the client (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> any) that controls this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "The controlling client is the one that will send moves <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> us <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> act <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">on.\n</a>" "@return the ID of the controlling GameConnection, or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> this object is not " "controlled by any <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">client.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GameConnection\n</a>" )

DefineEngineMethod(ShapeBase , getControllingObject , S32 , () , "@brief Get the object (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> any) that controls this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@return the ID of the controlling <a href="/coding/class/classshapebase/">ShapeBase</a> object, or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> this object is " "not controlled by another <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n</a>" )

DefineEngineMethod(ShapeBase , getDamageFlash , F32 , () , "@brief Get the damage flash <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "@return flash <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setDamageFlash\n</a>" )

DefineEngineMethod(ShapeBase , getDamageLevel , F32 , () , "@brief Get the object's current damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "@return damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" "@see setDamageLevel()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , getDamagePercent , F32 , () , "@brief Get the object's current damage level as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> percentage of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">maxDamage.\n\n</a>" "@return damageLevel / <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">datablock.maxDamage\n</a>" "@see setDamageLevel()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , getDamageState , const char * , () , "@brief Get the object's damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "@return the damage state; one of \"Enabled\" , \"Disabled\" , \"Destroyed\"\n" "@see setDamageState()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , getDefaultCameraFov , F32 , () , "@brief Returns the default vertical field of view in degrees <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this object <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> used as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@return Default <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">FOV\n</a>" )

DefineEngineMethod(ShapeBase , getEnergyLevel , F32 , () , "@brief Get the object's current energy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "@return energy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" "@see setEnergyLevel()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , getEnergyPercent , F32 , () , "@brief Get the object's current energy level as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> percentage of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">maxEnergy.\n\n</a>" "@return energyLevel / <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">datablock.maxEnergy\n</a>" "@see setEnergyLevel()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , getEyePoint , Point3F , () , "@brief Get the position of the 'eye' <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "If the object model has <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> node called 'eye' , this method will return that " "node 's current world position, otherwise it will return the object 's current " "world <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @return the eye position <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getEyeVector\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getEyeTransform\n</a>" )

DefineEngineMethod(ShapeBase , getEyeTransform , TransformF , () , "@brief Get the 'eye' transform <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "If the object model has <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> node called 'eye' , this method will return that " "node 's current transform, otherwise it will return the object 's current " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform.\n</a>" " @return the eye transform <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getEyeVector\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getEyePoint\n</a>" )

DefineEngineMethod(ShapeBase , getEyeVector , VectorF , () , "@brief Get the forward direction of the 'eye' <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "If the object model has <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> node called 'eye' , this method will return that " "node 's current forward direction vector, otherwise it will return the " "object 's current forward direction <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" " @return the eye vector <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getEyePoint\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getEyeTransform\n</a>" )

DefineEngineMethod(ShapeBase , getImageAltTrigger , bool , (S32 slot) , "@brief Get the alt trigger state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the Image's current alt trigger <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )

DefineEngineMethod(ShapeBase , getImageAmmo , bool , (S32 slot) , "@brief Get the ammo state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the Image's current ammo <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )

DefineEngineMethod(ShapeBase , getImageGenericTrigger , bool , (S32 slot, S32 trigger) , "@brief Get the generic trigger state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@param trigger Generic trigger <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">number\n</a>" "@return the Image's current generic trigger <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )

DefineEngineMethod(ShapeBase , getImageLoaded , bool , (S32 slot) , "@brief Get the loaded state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the Image's current loaded <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )

DefineEngineMethod(ShapeBase , getImageScriptAnimPrefix , const char * , (S32 slot) , "@brief Get the script animation prefix of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the Image's current script animation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">prefix\n\n</a>" )

DefineEngineMethod(ShapeBase , getImageSkinTag , S32 , (S32 slot) , "@brief Get the skin tag ID <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the skinTag <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> passed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> mountImage when the image was " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mounted\n\n</a>" )

DefineEngineMethod(ShapeBase , getImageState , const char * , (S32 slot) , "@brief Get the name of the current state of the Image in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return name of the current Image state, or \"Error\" if slot is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">invalid\n\n</a>" )

DefineEngineMethod(ShapeBase , getImageTarget , bool , (S32 slot) , "@brief Get the target state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the Image's current target <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )

DefineEngineMethod(ShapeBase , getImageTrigger , bool , (S32 slot) , "@brief Get the trigger state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the Image's current trigger <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )

DefineEngineMethod(ShapeBase , getLookAtPoint , const char * , (F32 distance, U32 typeMask) , (2000, 0xFFFFFFFF) )

DefineEngineMethod(ShapeBase , getMaxDamage , F32 , () , "Get the object's maxDamage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n</a>" "@return <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">datablock.maxDamage\n</a>" )

DefineEngineMethod(ShapeBase , getModelFile , const char * , () , "@brief Get the model filename used by this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "@return the shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">filename\n\n</a>" )

DefineEngineMethod(ShapeBase , getMountedImage , S32 , (S32 slot) , "@brief Get the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return ID of the <a href="/coding/class/structshapebaseimagedata/">ShapeBaseImageData</a> datablock mounted in the slot, or 0 " "<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no Image is mounted <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">there.\n\n</a>" )

DefineEngineMethod(ShapeBase , getMountSlot , S32 , (ShapeBaseImageData *image) , "@brief Get the first slot the given datablock is mounted <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> on this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@param image <a href="/coding/class/structshapebaseimagedata/">ShapeBaseImageData</a> datablock <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return index of the first slot the Image is mounted in, or -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the Image " "is not mounted in any slot on this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" )

DefineEngineMethod(ShapeBase , getMuzzlePoint , Point3F , (S32 slot) , "@brief Get the muzzle position of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "If the Image shape contains <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> node called 'muzzlePoint' , then the muzzle " "position is the position of that node in world space. If no such node " "is specified, the slot 's mount node is used <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">instead.\n</a>" " @param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" " @return the muzzle position, or \"0 0 0\" <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the slot is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">invalid\n\n</a>" )

DefineEngineMethod(ShapeBase , getMuzzleVector , VectorF , (S32 slot) , "@brief Get the muzzle vector of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "If the Image shape contains <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> node called 'muzzlePoint' , then the muzzle " "vector is the forward direction vector of that node 's transform in world " "space. If no such node is specified, the slot 's mount node is used " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">instead.\n\n</a>" "If the correctMuzzleVector flag(correctMuzzleVectorTP in 3rd person) " "is set in the Image, the muzzle vector is computed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> point at whatever " "object is right in front of the object 's 'eye' <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" " @param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" " @return the muzzle vector, or \"0 1 0\" <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the slot is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">invalid\n\n</a>" )

DefineEngineMethod(ShapeBase , getPendingImage , S32 , (S32 slot) , "@brief Get the Image that will be mounted next in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "Calling mountImage when an Image is already mounted does one of two things: " "<ol><li>Mount the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> Image immediately, the old Image is discarded and " "whatever state it was in is ignored.</li >" "< li >If the current Image state does not allow Image changes, the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> " "Image is marked as pending, and will not be mounted until the current " "state completes. eg. <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the user changes weapons, you may wish <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> ensure " "that the current weapon firing state plays <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> completion first.</li ></ol >\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "This command retrieves the ID of the pending Image(2nd case above).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" " @return ID of the pending <a href="/coding/class/structshapebaseimagedata/">ShapeBaseImageData</a> datablock, or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">none.\n\n</a>" )

DefineEngineMethod(ShapeBase , getRechargeRate , F32 , () , "@brief Get the current recharge <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rate.\n\n</a>" "@return the recharge rate (per tick)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see setRechargeRate()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , getRepairRate , F32 , () , "@brief Get the per-tick repair <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">amount.\n\n</a>" "@return the current <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be subtracted from damage level each <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tick\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setRepairRate\n</a>" )

DefineEngineMethod(ShapeBase , getShapeName , const char * , () , "@brief Get the name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "@note This is the name of the shape object that is sent <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the client, " "not the DTS or DAE model <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">filename.\n</a>" " @return the name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape\n\n</a>" " @see setShapeName()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , getSkinName , const char * , () , "@brief Get the name of the skin applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "@return the name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">skin\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">skin\n</a>" "@see setSkinName()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , getSlotTransform , TransformF , (S32 slot) , "@brief Get the world transform of the specified mount <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the mount <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform\n\n</a>" )

DefineEngineMethod(ShapeBase , getTargetCount , S32 , () , "@brief Get the number of materials in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "@return the number of materials in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "@see getTargetName()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , getTargetName , const char * , (S32 index) , "@brief Get the name of the indexed shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">material.\n\n</a>" "@param index index of the material <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> get (valid range is 0 - getTargetCount()-1).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return the name of the indexed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">material.\n\n</a>" "@see getTargetCount()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , getVelocity , VectorF , () , "@brief Get the object's current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">velocity.\n\n</a>" "@return the current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">velocity\n\n</a>" )

DefineEngineMethod(ShapeBase , getWhiteOut , F32 , () , "@brief Get the white-out <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "@return white-out <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setWhiteOut\n</a>" )

DefineEngineMethod(ShapeBase , hasImageState , bool , (S32 slot, const char *state) , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the given state exists on the mounted <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@param state Image state <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> check <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">for\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the Image has the requested state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">defined.\n\n</a>" )

DefineEngineMethod(ShapeBase , isCloaked , bool , () , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> this object is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">cloaked.\n\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> cloaked, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not\n</a>" " @see setCloaked()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , isDestroyed , bool , () , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the object is in the Destroyed damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> damage state is \"Destroyed\" , false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not\n</a>" " @see isDisabled()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see isEnabled()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , isDisabled , bool , () , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the object is in the Disabled or Destroyed damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> damage state is not \"Enabled\" , false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is\n</a>" " @see isDestroyed()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see isEnabled()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , isEnabled , bool , () , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the object is in the Enabled damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> damage state is \"Enabled\" , false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not\n</a>" " @see isDestroyed()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see isDisabled()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , isHidden , bool , () , "Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the object is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">hidden.\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the object is hidden, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">visible.\n\n</a>" )

DefineEngineMethod(ShapeBase , isImageFiring , bool , (S32 slot) , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the current Image state is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">firing.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the current Image state in this slot has the 'stateFire' flag <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">set.\n</a>" )

DefineEngineMethod(ShapeBase , isImageMounted , bool , (ShapeBaseImageData *image) , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the given datablock is mounted <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> any slot on this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@param image <a href="/coding/class/structshapebaseimagedata/">ShapeBaseImageData</a> datablock <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the Image is mounted <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> any slot, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise.\n\n</a>" )

DefineEngineMethod(ShapeBase , mountImage , bool , (ShapeBaseImageData *image, S32 slot, bool loaded, const char *skinTag) , (true, "") , "@brief Mount <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image.\n\n</a>" "@param image the Image <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mount\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> mount into (valid range is 0 - 3)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param loaded initial loaded state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@param skinTag tagged string <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> reskin the mounted <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%player.mountImage(PistolImage, 1);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "%player.mountImage(CrossbowImage, 0, false);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "%player.mountImage(RocketLauncherImage, 0, true, 'blue');\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" " @see unmountImage()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see getMountedImage()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see getPendingImage()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see isImageMounted()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , pauseThread , bool , (S32 slot) , "@brief Pause an animation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">thread.\n\n</a>" "If restarted using playThread, the animation " "will resume from the paused <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @param slot thread slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">stop\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playThread\n</a>" )

DefineEngineMethod(ShapeBase , playAudio , bool , (S32 slot, SFXTrack *track) , "@brief Attach <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> sound <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> this shape and start playing <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it.\n\n</a>" "@param slot Audio slot index <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the sound (valid range is 0 - 3)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param track <a href="/coding/class/classsfxtrack/">SFXTrack</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">play\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the sound was attached successfully, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see stopAudio()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , playThread , bool , (S32 slot, const char *name) , ("") , "@brief Start <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> animation thread, or restart one that has been paused or " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">stopped.\n\n</a>" " @param slot thread slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play. Valid range is 0 - 3)

DefineEngineMethod(ShapeBase , setAllMeshesHidden , void , (bool hide) , "@brief Set the hidden state on all the shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">meshes.\n\n</a>" "This allows you <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> hide all meshes in the shape, <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> example, and then only " "enable <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">few.\n</a>" " @param hide <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> hidden state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> all <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">meshes\n\n</a>" )

DefineEngineMethod(ShapeBase , setCameraFov , void , (F32 fov) , "@brief Set the vertical field of view in degrees <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this object <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> used as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@param fov <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> FOV <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value\n</a>" )

DefineEngineMethod(ShapeBase , setCloaked , void , (bool cloak) , "@brief Set the cloaked state of this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "When an object is cloaked it is not <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rendered.\n</a>" "@param cloak true <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> cloak the object, false <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">uncloak\n</a>" " @see isCloaked()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , setDamageFlash , void , (F32 level) , "@brief Set the damage flash <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "Damage flash may be used as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> postfx effect <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> flash the screen when the " "client is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">damaged.\n</a>" "@note Relies on the flash <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">postFx.\n</a>" "@param level flash level (0-1)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see getDamageFlash()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , setDamageLevel , void , (F32 level) , "@brief Set the object's current damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "@param level <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" "@see getDamageLevel()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see getDamagePercent()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , setDamageState , bool , (const char *state) , "@brief Set the object's damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "@param state should be one of \"Enabled\" , \"Disabled\" , \"Destroyed\"\n" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n</a>" " @see getDamageState()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , setDamageVector , void , (Point3F vec) , "@brief Set the damage direction <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n\n</a>" "Currently this is only used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> initialise the explosion <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> this object " "is blown <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">up.\n</a>" "@param vec damage direction <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%obj.setDamageVector( \"0 0 1\" );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )

DefineEngineMethod(ShapeBase , setEnergyLevel , void , (F32 level) , "@brief Set this object's current energy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "@param level <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> energy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" "@see getEnergyLevel()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see getEnergyPercent()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , setHidden , void , (bool show) , "@brief Add or remove this object from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">scene.\n\n</a>" "When removed from the scene, the object will not be processed or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rendered.\n</a>" " @param show False <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> hide the object, true <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> re-show <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it\n\n</a>" )

DefineEngineMethod(ShapeBase , setImageAltTrigger , bool , (S32 slot, bool state) , "@brief Set the alt trigger state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param state <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> alt trigger state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@return the Image's <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> alt trigger <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )

DefineEngineMethod(ShapeBase , setImageAmmo , bool , (S32 slot, bool state) , "@brief Set the ammo state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param state <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> ammo state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@return the Image's <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> ammo <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )

DefineEngineMethod(ShapeBase , setImageGenericTrigger , S32 , (S32 slot, S32 trigger, bool state) , "@brief Set the generic trigger state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param trigger Generic trigger <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">number\n</a>" "@param state <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> generic trigger state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@return the Image's <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> generic trigger state or -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> there was <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">problem.\n\n</a>" )

DefineEngineMethod(ShapeBase , setImageLoaded , bool , (S32 slot, bool state) , "@brief Set the loaded state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param state <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> loaded state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@return the Image's <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> loaded <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )

DefineEngineMethod(ShapeBase , setImageScriptAnimPrefix , void , (S32 slot, const char *prefix) , "@brief Set the script animation prefix <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "This is used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> further modify the prefix used when deciding which animation sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> " "play <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> this image is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mounted.\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param prefix The prefix applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">image\n</a>" )

DefineEngineMethod(ShapeBase , setImageTarget , bool , (S32 slot, bool state) , "@brief Set the target state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param state <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> target state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@return the Image's <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> target <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )

DefineEngineMethod(ShapeBase , setImageTrigger , bool , (S32 slot, bool state) , "@brief Set the trigger state of the Image mounted in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param state <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> trigger state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Image\n</a>" "@return the Image's <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> trigger <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n\n</a>" )

DefineEngineMethod(ShapeBase , setMeshHidden , void , (const char *name, bool hide) , "@brief Set the hidden state on the named shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mesh.\n\n</a>" "@param name name of the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> hide/<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">show\n</a>" "@param hide <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> hidden state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mesh\n\n</a>" )

DefineEngineMethod(ShapeBase , setRechargeRate , void , (F32 rate) , "@brief Set the recharge <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rate.\n\n</a>" "The recharge rate is added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the object's current energy level each tick, " "up <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the maxEnergy level set in the <a href="/coding/class/structshapebasedata/">ShapeBaseData</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">datablock.\n</a>" " @param rate the recharge rate(per tick)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see getRechargeRate()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , setRepairRate , void , (F32 rate) , "@brief Set amount <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> repair damage by each <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tick.\n\n</a>" "Note that this <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> is separate <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the repairRate field in ShapeBaseData. " "This <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> will be subtracted from the damage level each tick, whereas the " "<a href="/coding/class/structshapebasedata/">ShapeBaseData</a> field limits how much of the applyRepair <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> is subtracted " "each tick. Both repair types can be active at the same <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">time.\n</a>" " @param rate <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> subtract from damage level each tick(must be > 0)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @see getRepairRate()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , setShapeName , void , (const char *name) , "@brief Set the name of this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "@note This is the name of the shape object that is sent <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the client, " "not the DTS or DAE model <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">filename.\n</a>" " @param name <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> name <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape\n\n</a>" " @see getShapeName()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , setSkinName , void , (const char *name) , "@brief Apply <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> skin <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" "'Skinning' the shape effectively renames the material targets, allowing " "different materials <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be used on different instances of the same <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n\n</a>" " @param name name of the skin <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">apply\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">skin\n</a>" " @see getSkinName()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , setThreadDir , bool , (S32 slot, bool fwd) , "@brief Set the playback direction of an animation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">thread.\n\n</a>" "@param slot thread slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param fwd true <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play the animation forwards, false <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">backwards\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see playThread()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , setThreadPosition , bool , (S32 slot, F32 pos) , "@brief Set the position within an animation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">thread.\n\n</a>" "@param slot thread slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param pos position within <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">thread\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playThread\n</a>" )

DefineEngineMethod(ShapeBase , setThreadTimeScale , bool , (S32 slot, F32 scale) , "@brief Set the playback time scale of an animation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">thread.\n\n</a>" "@param slot thread slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param scale <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> thread time scale (1=normal speed, 0.5=half speed etc)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playThread\n</a>" )

DefineEngineMethod(ShapeBase , setVelocity , bool , (Point3F vel) , "@brief Set the object's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">velocity.\n\n</a>" "@param vel <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> velocity <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@return <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">true\n\n</a>" )

DefineEngineMethod(ShapeBase , setWhiteOut , void , (F32 level) , "@brief Set the white-out <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n\n</a>" "White-out may be used as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> postfx effect <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> brighten the screen in response " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> game <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">event.\n</a>" "@note Relies on the flash <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">postFx.\n</a>" "@param level flash level (0-1)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see getWhiteOut()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , startFade , void , (S32 time, S32 delay, bool fadeOut) , "@brief Fade the object in or out without removing it from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">scene.\n\n</a>" "A faded out object is still in the scene and can still be collided with, " "so <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> you want <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> disable collisions <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this shape after it fades out " "use setHidden <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> temporarily remove this shape from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">scene.\n</a>" " @note Items have the ability <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> light their surroundings. When an <a href="/coding/class/classitem/">Item</a> with " "an active light is fading out, the light it emits is correspondingly " "reduced until it goes out. Likewise, when the item fades in, the light is " "turned-up till it reaches it 's normal <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">brightntess.\n</a>" " @param time duration of the fade effect in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ms\n</a>" " @param delay delay in ms before the fade effect <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">begins\n</a>" " @param fadeOut true <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> fade-out <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> invisible, false <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> fade-in <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> full <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">visibility\n</a>" )

DefineEngineMethod(ShapeBase , stopAudio , bool , (S32 slot) , "@brief Stop <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> sound started with <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playAudio.\n\n</a>" "@param slot audio slot index (started with playAudio)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the sound was stopped successfully, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see playAudio()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBase , stopThread , bool , (S32 slot) , "@brief Stop an animation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">thread.\n\n</a>" "If restarted using playThread, the animation " "will start from the beginning <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">again.\n</a>" " @param slot thread slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">stop\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playThread\n</a>" )

DefineEngineMethod(ShapeBase , unmountImage , bool , (S32 slot) , "@brief Unmount the mounted Image in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">slot.\n\n</a>" "@param slot Image slot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">unmount\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @see mountImage()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(ShapeBaseData , checkDeployPos , bool , (TransformF txfm) , "@brief Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> there is the space at the given transform is free <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> spawn <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">into.\n\n</a>" "The shape's bounding box volume is used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> check <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> collisions at the given world " "transform. Only interior and static objects are checked <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">collision.\n</a>" "@param txfm Deploy transform <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the space is free, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> there is already something in " "the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">way.\n</a>" " @note This is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> server side only check, and is not actually limited <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">spawning.\n</a>" )

DefineEngineMethod(ShapeBaseData , getDeployTransform , TransformF , (Point3F pos, Point3F normal) , "@brief Helper method <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> get <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> transform from <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> position and vector (suitable <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> use with setTransform).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param pos Desired transform <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position\n</a>" "@param normal <a href="/coding/class/classvector/">Vector</a> of desired <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">direction\n</a>" "@return The deploy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform\n</a>" )

IMPLEMENT_CALLBACK(ShapeBase , validateCameraFov , F32 , (F32 fov) , (fov) , "@brief Called on the server when the client has requested <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> FOV <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">change.\n\n</a>" "When the client requests that its field of view should be changed (because " "they want <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> sniper scope, <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> example) this <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> FOV needs <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be validated " "by the server. This method is called <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it exists (it is optional) <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> validate " "the requested FOV, and modify it <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> necessary. This could be as simple as checking " "that the FOV falls within <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> correct range, <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> making sure that the FOV matches the " "capabilities of the current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">weapon.\n\n</a>" "Following this method, <a href="/coding/class/classshapebase/">ShapeBase</a> ensures that the given FOV still falls within " "the datablock 's cameraMinFov and cameraMaxFov. If that is good enough <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> your " " purposes, then you do not need <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> define the validateCameraFov() callback <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> " "your <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ShapeBase.\n\n</a>" " @param fov The FOV that has been requested by the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">client.\n</a>" " @return The FOV as validated by the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">server.\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ShapeBaseData\n\n</a>" )

IMPLEMENT_CALLBACK(ShapeBaseData , onCollision , void , (ShapeBase *obj, SceneObject *collObj, VectorF vec, F32 len) , (obj, collObj, vec, len) , "@brief Called when we collide with another <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param collObj The object we collided <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">with\n</a>" "@param vec <a href="/coding/class/structcollision/">Collision</a> impact <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1afed088663f8704004425cdae2120b9b3">len</a> Length of the impact <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector\n</a>" )

IMPLEMENT_CALLBACK(ShapeBaseData , onDamage , void , (ShapeBase *obj, F32 delta) , (obj, delta) , "@brief Called when the object is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">damaged.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param delta The amount of damage received." )

IMPLEMENT_CALLBACK(ShapeBaseData , onDestroyed , void , (ShapeBase *obj, const char *lastState) , (obj, lastState) , "@brief Called when the object damage state changes <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Destroyed.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param lastState The previous damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n</a>" )

IMPLEMENT_CALLBACK(ShapeBaseData , onDisabled , void , (ShapeBase *obj, const char *lastState) , (obj, lastState) , "@brief Called when the object damage state changes <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Disabled.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param lastState The previous damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n</a>" )

IMPLEMENT_CALLBACK(ShapeBaseData , onEnabled , void , (ShapeBase *obj, const char *lastState) , (obj, lastState) , "@brief Called when the object damage state changes <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Enabled.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param lastState The previous damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state\n</a>" )

IMPLEMENT_CALLBACK(ShapeBaseData , onEndSequence , void , (ShapeBase *obj, S32 slot, const char *name) , (obj, slot, name) , "@brief Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> thread playing <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> non-cyclic sequence reaches the end of the " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param slot <a href="/coding/class/classthread/">Thread</a> slot that finished <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playing\n</a>" "@param name <a href="/coding/class/classthread/">Thread</a> name that finished <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playing\n</a>" )

IMPLEMENT_CALLBACK(ShapeBaseData , onForceUncloak , void , (ShapeBase *obj, const char *reason) , (obj, reason) , "@brief Called when the object is forced <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">uncloak.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param reason <a href="/coding/class/classstring/">String</a> describing why the object was <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">uncloaked\n</a>" )

IMPLEMENT_CALLBACK(ShapeBaseData , onImpact , void , (ShapeBase *obj, SceneObject *collObj, VectorF vec, F32 len) , (obj, collObj, vec, len) , "@brief Called when we collide with another object beyond some impact <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">speed.\n\n</a>" "The <a href="/coding/class/classplayer/">Player</a> class makes use of this callback when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> collision speed is more than <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">PlayerData::minImpactSpeed.\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param collObj The object we collided <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">with\n</a>" "@param vec <a href="/coding/class/structcollision/">Collision</a> impact <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1afed088663f8704004425cdae2120b9b3">len</a> Length of the impact <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector\n</a>" )

IMPLEMENT_CALLBACK(ShapeBaseData , onTrigger , void , (ShapeBase *obj, S32 index, bool state) , (obj, index, state) , "@brief Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> move trigger input changes <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "@param obj The <a href="/coding/class/classshapebase/">ShapeBase</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "@param index Index of the trigger that <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">changed\n</a>" "@param state New state of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">trigger\n</a>" )

IMPLEMENT_CO_DATABLOCK_V1(ShapeBaseData )

IMPLEMENT_CO_NETOBJECT_V1(ShapeBase )

   1
   2//-----------------------------------------------------------------------------
   3// Copyright (c) 2012 GarageGames, LLC
   4//
   5// Permission is hereby granted, free of charge, to any person obtaining a copy
   6// of this software and associated documentation files (the "Software"), to
   7// deal in the Software without restriction, including without limitation the
   8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
   9// sell copies of the Software, and to permit persons to whom the Software is
  10// furnished to do so, subject to the following conditions:
  11//
  12// The above copyright notice and this permission notice shall be included in
  13// all copies or substantial portions of the Software.
  14//
  15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  21// IN THE SOFTWARE.
  22//-----------------------------------------------------------------------------
  23
  24//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  25// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
  26// Copyright (C) 2015 Faust Logic, Inc.
  27//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  28
  29#include "platform/platform.h"
  30#include "T3D/shapeBase.h"
  31
  32#include "core/dnet.h"
  33#include "sfx/sfxSystem.h"
  34#include "sfx/sfxSource.h"
  35#include "sfx/sfxTrack.h"
  36#include "sfx/sfxDescription.h"
  37#include "T3D/sfx/sfx3DWorld.h"
  38#include "T3D/gameBase/gameConnection.h"
  39#include "console/consoleTypes.h"
  40#include "console/engineAPI.h"
  41#include "core/stream/bitStream.h"
  42#include "ts/tsPartInstance.h"
  43#include "ts/tsShapeInstance.h"
  44#include "ts/tsMaterialList.h"
  45#include "scene/sceneManager.h"
  46#include "scene/sceneRenderState.h"
  47#include "scene/sceneObjectLightingPlugin.h"
  48#include "T3D/fx/explosion.h"
  49#include "T3D/fx/cameraFXMgr.h"
  50#include "environment/waterBlock.h"
  51#include "T3D/debris.h"
  52#include "T3D/physicalZone.h"
  53#include "T3D/containerQuery.h"
  54#include "math/mathUtils.h"
  55#include "math/mMatrix.h"
  56#include "math/mTransform.h"
  57#include "math/mRandom.h"
  58#include "platform/profiler.h"
  59#include "gfx/gfxCubemap.h"
  60#include "gfx/gfxDrawUtil.h"
  61#include "gfx/gfxTransformSaver.h"
  62#include "renderInstance/renderPassManager.h"
  63#include "collision/earlyOutPolyList.h"
  64#include "core/resourceManager.h"
  65#include "scene/reflectionManager.h"
  66#include "gfx/sim/cubemapData.h"
  67#include "materials/materialManager.h"
  68#include "materials/materialFeatureTypes.h"
  69#include "renderInstance/renderOcclusionMgr.h"
  70#include "core/stream/fileStream.h"
  71#include "T3D/accumulationVolume.h"
  72#include "console/persistenceManager.h"
  73
  74IMPLEMENT_CO_DATABLOCK_V1(ShapeBaseData);
  75
  76ConsoleDocClass( ShapeBaseData,
  77   "@brief Defines properties for a ShapeBase object.\n\n"
  78   "@see ShapeBase\n"
  79   "@ingroup gameObjects\n"
  80);
  81
  82IMPLEMENT_CALLBACK( ShapeBaseData, onEnabled, void, ( ShapeBase* obj, const char* lastState ), ( obj, lastState ),
  83   "@brief Called when the object damage state changes to Enabled.\n\n"
  84   "@param obj The ShapeBase object\n"
  85   "@param lastState The previous damage state\n" );
  86
  87IMPLEMENT_CALLBACK( ShapeBaseData, onDisabled, void, ( ShapeBase* obj, const char* lastState ), ( obj, lastState ),
  88   "@brief Called when the object damage state changes to Disabled.\n\n"
  89   "@param obj The ShapeBase object\n"
  90   "@param lastState The previous damage state\n" );
  91
  92IMPLEMENT_CALLBACK( ShapeBaseData, onDestroyed, void, ( ShapeBase* obj, const char* lastState ), ( obj, lastState ),
  93   "@brief Called when the object damage state changes to Destroyed.\n\n"
  94   "@param obj The ShapeBase object\n"
  95   "@param lastState The previous damage state\n" );
  96
  97IMPLEMENT_CALLBACK( ShapeBaseData, onImpact, void, ( ShapeBase* obj, SceneObject *collObj, VectorF vec, F32 len ), ( obj, collObj, vec, len ),
  98   "@brief Called when we collide with another object beyond some impact speed.\n\n"
  99   "The Player class makes use of this callback when a collision speed is more than PlayerData::minImpactSpeed.\n"
 100   "@param obj The ShapeBase object\n"
 101   "@param collObj The object we collided with\n"
 102   "@param vec Collision impact vector\n"
 103   "@param len Length of the impact vector\n" );
 104
 105IMPLEMENT_CALLBACK( ShapeBaseData, onCollision, void, ( ShapeBase* obj, SceneObject *collObj, VectorF vec, F32 len ), ( obj, collObj, vec, len ),
 106   "@brief Called when we collide with another object.\n\n"
 107   "@param obj The ShapeBase object\n"
 108   "@param collObj The object we collided with\n"
 109   "@param vec Collision impact vector\n"
 110   "@param len Length of the impact vector\n" );
 111
 112IMPLEMENT_CALLBACK( ShapeBaseData, onDamage, void, ( ShapeBase* obj, F32 delta ), ( obj, delta ),
 113   "@brief Called when the object is damaged.\n\n"
 114   "@param obj The ShapeBase object\n"
 115   "@param obj The ShapeBase object\n"
 116   "@param delta The amount of damage received." );
 117
 118IMPLEMENT_CALLBACK( ShapeBaseData, onTrigger, void, ( ShapeBase* obj, S32 index, bool state ), ( obj, index, state ),
 119   "@brief Called when a move trigger input changes state.\n\n"
 120   "@param obj The ShapeBase object\n"
 121   "@param index Index of the trigger that changed\n"
 122   "@param state New state of the trigger\n" );
 123
 124IMPLEMENT_CALLBACK(ShapeBaseData, onEndSequence, void, (ShapeBase* obj, S32 slot, const char* name), (obj, slot, name),
 125   "@brief Called when a thread playing a non-cyclic sequence reaches the end of the "
 126   "sequence.\n\n"
 127   "@param obj The ShapeBase object\n"
 128   "@param slot Thread slot that finished playing\n"
 129   "@param name Thread name that finished playing\n");
 130
 131IMPLEMENT_CALLBACK( ShapeBaseData, onForceUncloak, void, ( ShapeBase* obj, const char* reason ), ( obj, reason ),
 132   "@brief Called when the object is forced to uncloak.\n\n"
 133   "@param obj The ShapeBase object\n"
 134   "@param reason String describing why the object was uncloaked\n" );
 135
 136//----------------------------------------------------------------------------
 137// Timeout for non-looping sounds on a channel
 138static SimTime sAudioTimeout = 500;
 139F32  ShapeBase::sWhiteoutDec = 0.007f;
 140F32  ShapeBase::sDamageFlashDec = 0.02f;
 141F32  ShapeBase::sFullCorrectionDistance = 0.5f;
 142F32  ShapeBase::sCloakSpeed = 0.5;
 143U32  ShapeBase::sLastRenderFrame = 0;
 144
 145static const char *sDamageStateName[] =
 146{
 147   // Index by enum ShapeBase::DamageState
 148   "Enabled",
 149   "Disabled",
 150   "Destroyed"
 151};
 152
 153
 154//----------------------------------------------------------------------------
 155
 156ShapeBaseData::ShapeBaseData()
 157 : shadowEnable( false ),
 158   shadowSize( 128 ),
 159   shadowMaxVisibleDistance( 80.0f ),
 160   shadowProjectionDistance( 10.0f ),
 161   shadowSphereAdjust( 1.0f ),
 162   cloakTexName( StringTable->EmptyString() ),
 163   cubeDescId( 0 ),
 164   reflectorDesc( NULL ),
 165   debris( NULL ),
 166   debrisID( 0 ),
 167   debrisShapeName( StringTable->EmptyString() ),
 168   explosion( NULL ),
 169   explosionID( 0 ),
 170   underwaterExplosion( NULL ),
 171   underwaterExplosionID( 0 ),
 172   mass( 1.0f ),
 173   drag( 0.0f ),
 174   density( 1.0f ),
 175   maxEnergy( 0.0f ),
 176   maxDamage( 1.0f ),
 177   repairRate( 0.0033f ),
 178   disabledLevel( 1.0f ),
 179   destroyedLevel( 1.0f ),
 180   cameraMaxDist( 0.0f ),
 181   cameraMinDist( 0.2f ),
 182   cameraDefaultFov( 75.0f ),
 183   cameraMinFov( 5.0f ),
 184   cameraMaxFov( 120.f ),
 185   cameraCanBank( false ),
 186   mountedImagesBank( false ),
 187   mCRC( 0 ),
 188   computeCRC( false ),
 189   eyeNode( -1 ),
 190   earNode( -1 ),
 191   cameraNode( -1 ),
 192   debrisDetail( -1 ),
 193   damageSequence( -1 ),
 194   hulkSequence( -1 ),
 195   observeThroughObject( false ),
 196   firstPersonOnly( false ),
 197   useEyePoint( false ),
 198   isInvincible( false ),
 199   renderWhenDestroyed( true ),
 200   inheritEnergyFromMount( false )
 201{
 202   initShapeAsset(Shape);
 203   dMemset( mountPointNode, -1, sizeof( S32 ) * SceneObject::NumMountPoints );
 204   remap_txr_tags = NULL;
 205   remap_buffer = NULL;
 206   silent_bbox_check = false;
 207}
 208
 209ShapeBaseData::ShapeBaseData(const ShapeBaseData& other, bool temp_clone) : GameBaseData(other, temp_clone)
 210{
 211   shadowEnable = other.shadowEnable;
 212   shadowSize = other.shadowSize;
 213   shadowMaxVisibleDistance = other.shadowMaxVisibleDistance;
 214   shadowProjectionDistance = other.shadowProjectionDistance;
 215   shadowSphereAdjust = other.shadowSphereAdjust;
 216   cloakTexName = other.cloakTexName;
 217   cloneShapeAsset(Shape);
 218   cubeDescName = other.cubeDescName;
 219   cubeDescId = other.cubeDescId;
 220   reflectorDesc = other.reflectorDesc;
 221   debris = other.debris;
 222   debrisID = other.debrisID; // -- for pack/unpack of debris ptr
 223   debrisShapeName = other.debrisShapeName;
 224   debrisShape = other.debrisShape; // -- TSShape loaded using debrisShapeName
 225   explosion = other.explosion;
 226   explosionID = other.explosionID; // -- for pack/unpack of explosion ptr
 227   underwaterExplosion = other.underwaterExplosion;
 228   underwaterExplosionID = other.underwaterExplosionID; // -- for pack/unpack of underwaterExplosion ptr
 229   mass = other.mass;
 230   drag = other.drag;
 231   density = other.density;
 232   maxEnergy = other.maxEnergy;
 233   maxDamage = other.maxDamage;
 234   repairRate = other.repairRate;
 235   disabledLevel = other.disabledLevel;
 236   destroyedLevel = other.destroyedLevel;
 237   cameraMaxDist = other.cameraMaxDist;
 238   cameraMinDist = other.cameraMinDist;
 239   cameraDefaultFov = other.cameraDefaultFov;
 240   cameraMinFov = other.cameraMinFov;
 241   cameraMaxFov = other.cameraMaxFov;
 242   cameraCanBank = other.cameraCanBank;
 243   mountedImagesBank = other.mountedImagesBank;
 244   mShape = other.mShape; // -- TSShape loaded using shapeName
 245   mCRC = other.mCRC; // -- from shape, used to verify client shape 
 246   computeCRC = other.computeCRC;
 247   eyeNode = other.eyeNode; // -- from shape node "eye"
 248   earNode = other.earNode; // -- from shape node "ear"
 249   cameraNode = other.cameraNode; // -- from shape node "cam"
 250   dMemcpy(mountPointNode, other.mountPointNode, sizeof(mountPointNode)); // -- from shape nodes "mount#" 0-31
 251   debrisDetail = other.debrisDetail; // -- from shape detail "Debris-17"
 252   damageSequence = other.damageSequence; // -- from shape sequence "Damage"
 253   hulkSequence = other.hulkSequence; // -- from shape sequence "Visibility"
 254   observeThroughObject = other.observeThroughObject;
 255   collisionDetails = other.collisionDetails; // -- calc from shape (this is a Vector copy)
 256   collisionBounds = other.collisionBounds; // -- calc from shape (this is a Vector copy)
 257   LOSDetails = other.LOSDetails; // -- calc from shape (this is a Vector copy)
 258   firstPersonOnly = other.firstPersonOnly;
 259   useEyePoint = other.useEyePoint;
 260   isInvincible = other.isInvincible;
 261   renderWhenDestroyed = other.renderWhenDestroyed;
 262   inheritEnergyFromMount = other.inheritEnergyFromMount;
 263   remap_txr_tags = other.remap_txr_tags;
 264   remap_buffer = other.remap_buffer;
 265   txr_tag_remappings = other.txr_tag_remappings;
 266   silent_bbox_check = other.silent_bbox_check;
 267}
 268
 269struct ShapeBaseDataProto
 270{
 271   F32 mass;
 272   F32 drag;
 273   F32 density;
 274   F32 maxEnergy;
 275   F32 cameraMaxDist;
 276   F32 cameraMinDist;
 277   F32 cameraDefaultFov;
 278   F32 cameraMinFov;    
 279   F32 cameraMaxFov;    
 280
 281
 282   ShapeBaseDataProto()
 283   {
 284      mass = 1;
 285      drag = 0;
 286      density = 1;
 287      maxEnergy = 0;
 288      cameraMaxDist = 0;
 289      cameraMinDist = 0.2f;
 290      cameraDefaultFov = 75.f;
 291      cameraMinFov = 5.0f;
 292      cameraMaxFov = 120.f;
 293   }
 294};
 295
 296static ShapeBaseDataProto gShapeBaseDataProto;
 297
 298ShapeBaseData::~ShapeBaseData()
 299{
 300
 301   if (remap_buffer && !isTempClone())
 302      dFree(remap_buffer);
 303}
 304
 305bool ShapeBaseData::preload(bool server, String &errorStr)
 306{
 307   if (!Parent::preload(server, errorStr))
 308      return false;
 309   bool shapeError = false;
 310
 311   // Resolve objects transmitted from server
 312   if (!server) {
 313
 314      if( !explosion && explosionID != 0 )
 315      {
 316         if( Sim::findObject( explosionID, explosion ) == false)
 317         {
 318            Con::errorf( ConsoleLogEntry::General, "ShapeBaseData::preload: Invalid packet, bad datablockId(explosion): 0x%x", explosionID );
 319         }
 320         AssertFatal(!(explosion && ((explosionID < DataBlockObjectIdFirst) || (explosionID > DataBlockObjectIdLast))),
 321            "ShapeBaseData::preload: invalid explosion data");
 322      }
 323
 324      if( !underwaterExplosion && underwaterExplosionID != 0 )
 325      {
 326         if( Sim::findObject( underwaterExplosionID, underwaterExplosion ) == false)
 327         {
 328            Con::errorf( ConsoleLogEntry::General, "ShapeBaseData::preload: Invalid packet, bad datablockId(underwaterExplosion): 0x%x", underwaterExplosionID );
 329         }
 330         AssertFatal(!(underwaterExplosion && ((underwaterExplosionID < DataBlockObjectIdFirst) || (underwaterExplosionID > DataBlockObjectIdLast))),
 331            "ShapeBaseData::preload: invalid underwaterExplosion data");
 332      }
 333
 334      if( !debris && debrisID != 0 )
 335      {
 336         Sim::findObject( debrisID, debris );
 337         AssertFatal(!(debris && ((debrisID < DataBlockObjectIdFirst) || (debrisID > DataBlockObjectIdLast))),
 338            "ShapeBaseData::preload: invalid debris data");
 339      }
 340
 341
 342      if( debrisShapeName && debrisShapeName[0] != '\0' && !bool(debrisShape) )
 343      {
 344         debrisShape = ResourceManager::get().load(debrisShapeName);
 345         if( bool(debrisShape) == false )
 346         {
 347            errorStr = String::ToString("ShapeBaseData::load: Couldn't load shape \"%s\"", debrisShapeName);
 348            return false;
 349         }
 350         else
 351         {
 352            if(!server && !debrisShape->preloadMaterialList(debrisShape.getPath()) && NetConnection::filesWereDownloaded())
 353               shapeError = true;
 354
 355            TSShapeInstance* pDummy = new TSShapeInstance(debrisShape, !server);
 356            delete pDummy;
 357         }
 358      }
 359   }
 360   PersistenceManager *persistMgr;
 361   if (!Sim::findObject("ServerAssetValidator", persistMgr)) Con::errorf("ServerAssetValidator not found!");
 362   if (server && persistMgr && mShapeAssetId == StringTable->EmptyString())
 363   {
 364      persistMgr->setDirty(this);
 365   }
 366
 367   //Legacy catch
 368   if (mShapeName != StringTable->EmptyString())
 369   {
 370      mShapeAssetId = ShapeAsset::getAssetIdByFilename(mShapeName);
 371   }
 372   U32 assetState = ShapeAsset::getAssetById(mShapeAssetId, &mShapeAsset);
 373   if (ShapeAsset::Failed != assetState)
 374   {
 375      //only clear the legacy direct file reference if everything checks out fully
 376      if (assetState == ShapeAsset::Ok)
 377      {
 378         mShapeName = StringTable->EmptyString();
 379      }
 380      else Con::warnf("Warning: ShapeBaseData::preload-%s", ShapeAsset::getAssetErrstrn(assetState).c_str());
 381      S32 i;
 382
 383      // Resolve shapename
 384      mShape = mShapeAsset->getShapeResource();
 385      if (bool(mShape) == false)
 386      {
 387         errorStr = String::ToString("ShapeBaseData: Couldn't load shape \"%s\"",mShapeName);
 388         return false;
 389      }
 390      if(!server && !mShape->preloadMaterialList(mShape.getPath()) && NetConnection::filesWereDownloaded())
 391         shapeError = true;
 392
 393      if(computeCRC)
 394      {
 395         Con::printf("Validation required for shape: %s", mShapeName);
 396
 397         Torque::FS::FileNodeRef    fileRef = Torque::FS::GetFileNode(mShape.getPath());
 398
 399         if (!fileRef)
 400         {
 401            errorStr = String::ToString("ShapeBaseData: Couldn't load shape \"%s\"", mShapeName);
 402            return false;
 403         }
 404
 405         if(server)
 406            mCRC = fileRef->getChecksum();
 407         else if(mCRC != fileRef->getChecksum())
 408         {
 409            errorStr = String::ToString("Shape \"%s\" does not match version on server.", mShapeName);
 410            return false;
 411         }
 412      }
 413      // Resolve details and camera node indexes.
 414      static const String sCollisionStr( "collision-" );
 415
 416      for (i = 0; i < mShape->details.size(); i++)
 417      {
 418         const String &name = mShape->names[mShape->details[i].nameIndex];
 419
 420         if (name.compare( sCollisionStr, sCollisionStr.length(), String::NoCase ) == 0)
 421         {
 422            collisionDetails.push_back(i);
 423            collisionBounds.increment();
 424
 425            mShape->computeBounds(collisionDetails.last(), collisionBounds.last());
 426            mShape->getAccelerator(collisionDetails.last());
 427
 428            if (!mShape->mBounds.isContained(collisionBounds.last()))
 429            {
 430               if (!silent_bbox_check)
 431               Con::warnf("Warning: shape %s collision detail %d (Collision-%d) bounds exceed that of shape.", mShapeName, collisionDetails.size() - 1, collisionDetails.last());
 432               collisionBounds.last() = mShape->mBounds;
 433            }
 434            else if (collisionBounds.last().isValidBox() == false)
 435            {
 436               if (!silent_bbox_check)
 437               Con::errorf("Error: shape %s-collision detail %d (Collision-%d) bounds box invalid!", mShapeName, collisionDetails.size() - 1, collisionDetails.last());
 438               collisionBounds.last() = mShape->mBounds;
 439            }
 440
 441            // The way LOS works is that it will check to see if there is a LOS detail that matches
 442            // the the collision detail + 1 + MaxCollisionShapes (this variable name should change in
 443            // the future). If it can't find a matching LOS it will simply use the collision instead.
 444            // We check for any "unmatched" LOS's further down
 445            LOSDetails.increment();
 446
 447            String   buff = String::ToString("LOS-%d", i + 1 + MaxCollisionShapes);
 448            U32 los = mShape->findDetail(buff);
 449            if (los == -1)
 450               LOSDetails.last() = i;
 451            else
 452               LOSDetails.last() = los;
 453         }
 454      }
 455
 456      // Snag any "unmatched" LOS details
 457      static const String sLOSStr( "LOS-" );
 458
 459      for (i = 0; i < mShape->details.size(); i++)
 460      {
 461         const String &name = mShape->names[mShape->details[i].nameIndex];
 462
 463         if (name.compare( sLOSStr, sLOSStr.length(), String::NoCase ) == 0)
 464         {
 465            // See if we already have this LOS
 466            bool found = false;
 467            for (U32 j = 0; j < LOSDetails.size(); j++)
 468            {
 469               if (LOSDetails[j] == i)
 470               {
 471                     found = true;
 472                     break;
 473               }
 474            }
 475
 476            if (!found)
 477               LOSDetails.push_back(i);
 478         }
 479      }
 480
 481      debrisDetail = mShape->findDetail("Debris-17");
 482      eyeNode = mShape->findNode("eye");
 483      earNode = mShape->findNode( "ear" );
 484      if( earNode == -1 )
 485         earNode = eyeNode;
 486      cameraNode = mShape->findNode("cam");
 487      if (cameraNode == -1)
 488         cameraNode = eyeNode;
 489
 490      // Resolve mount point node indexes
 491      for (i = 0; i < SceneObject::NumMountPoints; i++) {
 492         char fullName[256];
 493         dSprintf(fullName,sizeof(fullName),"mount%d",i);
 494         mountPointNode[i] = mShape->findNode(fullName);
 495      }
 496
 497        // find the AIRepairNode - hardcoded to be the last node in the array...
 498      mountPointNode[AIRepairNode] = mShape->findNode("AIRepairNode");
 499
 500      //
 501      hulkSequence = mShape->findSequence("Visibility");
 502      damageSequence = mShape->findSequence("Damage");
 503
 504      //
 505      F32 w = mShape->mBounds.len_y() / 2;
 506      if (cameraMaxDist < w)
 507         cameraMaxDist = w;
 508      // just parse up the string and collect the remappings in txr_tag_remappings.
 509      if (!server && remap_txr_tags != NULL && remap_txr_tags != StringTable->insert(""))
 510      {
 511         txr_tag_remappings.clear();
 512         if (remap_buffer)
 513            dFree(remap_buffer);
 514
 515         remap_buffer = dStrdup(remap_txr_tags);
 516
 517         char* remap_token = dStrtok(remap_buffer, " \t");
 518         while (remap_token != NULL)
 519         {
 520            char* colon = dStrchr(remap_token, ':');
 521            if (colon)
 522            {
 523               *colon = '\0';
 524               txr_tag_remappings.increment();
 525               txr_tag_remappings.last().old_tag = remap_token;
 526               txr_tag_remappings.last().new_tag = colon+1;
 527            }
 528            remap_token = dStrtok(NULL, " \t");
 529         }
 530      }
 531   }
 532
 533   if(!server)
 534   {
 535/*
 536      // grab all the hud images
 537      for(U32 i = 0; i < NumHudRenderImages; i++)
 538      {
 539         if(hudImageNameFriendly[i] && hudImageNameFriendly[i][0])
 540            hudImageFriendly[i] = TextureHandle(hudImageNameFriendly[i], BitmapTexture);
 541
 542         if(hudImageNameEnemy[i] && hudImageNameEnemy[i][0])
 543            hudImageEnemy[i] = TextureHandle(hudImageNameEnemy[i], BitmapTexture);
 544      }
 545*/
 546   }
 547
 548   // Resolve CubeReflectorDesc.
 549   if ( cubeDescName.isNotEmpty() )
 550   {
 551      Sim::findObject( cubeDescName, reflectorDesc );
 552   }
 553   else if( cubeDescId > 0 )
 554   {
 555      Sim::findObject( cubeDescId, reflectorDesc );
 556   }
 557
 558   return !shapeError;
 559}
 560
 561bool ShapeBaseData::_setMass( void* object, const char* index, const char* data )
 562{
 563   ShapeBaseData* shape = reinterpret_cast< ShapeBaseData* >( object );
 564
 565   F32 mass = dAtof(data);
 566
 567   if (mass <= 0)
 568      mass = 0.01f;
 569
 570   shape->mass = mass;
 571
 572   return false;
 573}
 574
 575
 576void ShapeBaseData::initPersistFields()
 577{
 578   addGroup( "Shadows" );
 579
 580      addField( "shadowEnable", TypeBool, Offset(shadowEnable, ShapeBaseData),
 581         "Enable shadows for this shape (currently unused, shadows are always enabled)." );
 582      addField( "shadowSize", TypeS32, Offset(shadowSize, ShapeBaseData),
 583         "Size of the projected shadow texture (must be power of 2)." );
 584      addField( "shadowMaxVisibleDistance", TypeF32, Offset(shadowMaxVisibleDistance, ShapeBaseData),
 585         "Maximum distance at which shadow is visible (currently unused)." );
 586      addField( "shadowProjectionDistance", TypeF32, Offset(shadowProjectionDistance, ShapeBaseData),
 587         "Maximum height above ground to project shadow. If the object is higher "
 588         "than this no shadow will be rendered." );
 589      addField( "shadowSphereAdjust", TypeF32, Offset(shadowSphereAdjust, ShapeBaseData),
 590         "Scalar applied to the radius of spot shadows (initial radius is based "
 591         "on the shape bounds but can be adjusted with this field)." );
 592
 593   endGroup( "Shadows" );
 594
 595   addGroup( "Render" );
 596
 597      addField("shapeAsset", TypeShapeAssetId, Offset(mShapeAssetId, ShapeBaseData),
 598         "The source shape asset.");
 599
 600      addField( "shapeFile", TypeShapeFilename, Offset(mShapeName, ShapeBaseData),
 601         "The DTS or DAE model to use for this object." );
 602
 603   endGroup( "Render" );
 604
 605   addGroup( "Destruction", "Parameters related to the destruction effects of this object." );
 606
 607      addField( "explosion", TYPEID< ExplosionData >(), Offset(explosion, ShapeBaseData),
 608         "%Explosion to generate when this shape is blown up." );
 609      addField( "underwaterExplosion", TYPEID< ExplosionData >(), Offset(underwaterExplosion, ShapeBaseData),
 610         "%Explosion to generate when this shape is blown up underwater." );
 611      addField( "debris", TYPEID< DebrisData >(), Offset(debris, ShapeBaseData),
 612         "%Debris to generate when this shape is blown up." );
 613      addField( "renderWhenDestroyed", TypeBool, Offset(renderWhenDestroyed, ShapeBaseData),
 614         "Whether to render the shape when it is in the \"Destroyed\" damage state." );
 615      addField( "debrisShapeName", TypeShapeFilename, Offset(debrisShapeName, ShapeBaseData),
 616         "The DTS or DAE model to use for auto-generated breakups. @note may not be functional." );
 617
 618   endGroup( "Destruction" );
 619
 620   addGroup( "Physics" );
 621   
 622      addProtectedField("mass", TypeF32, Offset(mass, ShapeBaseData), &_setMass, &defaultProtectedGetFn, "Shape mass.\nUsed in simulation of moving objects.\n"  );
 623      addField( "drag", TypeF32, Offset(drag, ShapeBaseData),
 624         "Drag factor.\nReduces velocity of moving objects." );
 625      addField( "density", TypeF32, Offset(density, ShapeBaseData),
 626         "Shape density.\nUsed when computing buoyancy when in water.\n" );
 627
 628   endGroup( "Physics" );
 629
 630   addGroup( "Damage/Energy" );
 631
 632      addField( "maxEnergy", TypeF32, Offset(maxEnergy, ShapeBaseData),
 633         "Maximum energy level for this object." );
 634      addField( "maxDamage", TypeF32, Offset(maxDamage, ShapeBaseData),
 635         "Maximum damage level for this object." );
 636      addField( "disabledLevel", TypeF32, Offset(disabledLevel, ShapeBaseData),
 637         "Damage level above which the object is disabled.\n"
 638         "Currently unused." );
 639      addField( "destroyedLevel", TypeF32, Offset(destroyedLevel, ShapeBaseData),
 640         "Damage level above which the object is destroyed.\n"
 641         "When the damage level increases above this value, the object damage "
 642         "state is set to \"Destroyed\"." );
 643      addField( "repairRate", TypeF32, Offset(repairRate, ShapeBaseData),
 644         "Rate at which damage is repaired in damage units/tick.\n"
 645         "This value is subtracted from the damage level until it reaches 0." );
 646      addField( "inheritEnergyFromMount", TypeBool, Offset(inheritEnergyFromMount, ShapeBaseData),
 647         "Flag controlling whether to manage our own energy level, or to use "
 648         "the energy level of the object we are mounted to." );
 649      addField( "isInvincible", TypeBool, Offset(isInvincible, ShapeBaseData),
 650         "Invincible flag; when invincible, the object cannot be damaged or "
 651         "repaired." );
 652
 653   endGroup( "Damage/Energy" );
 654
 655   addGroup( "Camera", "The settings used by the shape when it is the camera." );
 656
 657      addField( "cameraMaxDist", TypeF32, Offset(cameraMaxDist, ShapeBaseData),
 658         "The maximum distance from the camera to the object.\n"
 659         "Used when computing a custom camera transform for this object.\n\n"
 660         "@see observeThroughObject" );
 661      addField( "cameraMinDist", TypeF32, Offset(cameraMinDist, ShapeBaseData),
 662         "The minimum distance from the camera to the object.\n"
 663         "Used when computing a custom camera transform for this object.\n\n"
 664         "@see observeThroughObject" );
 665      addField( "cameraDefaultFov", TypeF32, Offset(cameraDefaultFov, ShapeBaseData),
 666         "The default camera vertical FOV in degrees." );
 667      addField( "cameraMinFov", TypeF32, Offset(cameraMinFov, ShapeBaseData),
 668         "The minimum camera vertical FOV allowed in degrees." );
 669      addField( "cameraMaxFov", TypeF32, Offset(cameraMaxFov, ShapeBaseData),
 670         "The maximum camera vertical FOV allowed in degrees." );
 671      addField( "cameraCanBank", TypeBool, Offset(cameraCanBank, ShapeBaseData),
 672         "If the derrived class supports it, allow the camera to bank." );
 673      addField( "mountedImagesBank", TypeBool, Offset(mountedImagesBank, ShapeBaseData),
 674         "Do mounted images bank along with the camera?" );
 675      addField( "firstPersonOnly", TypeBool, Offset(firstPersonOnly, ShapeBaseData),
 676         "Flag controlling whether the view from this object is first person "
 677         "only." );
 678      addField( "useEyePoint", TypeBool, Offset(useEyePoint, ShapeBaseData),
 679         "Flag controlling whether the client uses this object's eye point to "
 680         "view from." );
 681      addField( "observeThroughObject", TypeBool, Offset(observeThroughObject, ShapeBaseData),
 682         "Observe this object through its camera transform and default fov.\n"
 683         "If true, when this object is the camera it can provide a custom camera "
 684         "transform and FOV (instead of the default eye transform)." );
 685
 686   endGroup("Camera");
 687
 688   addGroup( "Misc" );
 689
 690      addField( "computeCRC", TypeBool, Offset(computeCRC, ShapeBaseData),
 691         "If true, verify that the CRC of the client's shape model matches the "
 692         "server's CRC for the shape model when loaded by the client." );
 693
 694   endGroup( "Misc" );
 695
 696   addGroup( "Reflection" );
 697
 698      addField( "cubeReflectorDesc", TypeRealString, Offset( cubeDescName, ShapeBaseData ), 
 699         "References a ReflectorDesc datablock that defines performance and quality properties for dynamic reflections.\n");
 700      //addField( "reflectMaxRateMs", TypeS32, Offset( reflectMaxRateMs, ShapeBaseData ), "reflection will not be updated more frequently than this" );
 701      //addField( "reflectMaxDist", TypeF32, Offset( reflectMaxDist, ShapeBaseData ), "distance at which reflection is never updated" );
 702      //addField( "reflectMinDist", TypeF32, Offset( reflectMinDist, ShapeBaseData ), "distance at which reflection is always updated" );
 703      //addField( "reflectDetailAdjust", TypeF32, Offset( reflectDetailAdjust, ShapeBaseData ), "scale up or down the detail level for objects rendered in a reflection" );
 704
 705   endGroup( "Reflection" );
 706
 707   addField("remapTextureTags",      TypeString,   Offset(remap_txr_tags, ShapeBaseData));
 708   addField("silentBBoxValidation",  TypeBool,     Offset(silent_bbox_check, ShapeBaseData));
 709   // disallow some field substitutions
 710   onlyKeepClearSubstitutions("debris"); // subs resolving to "~~", or "~0" are OK
 711   onlyKeepClearSubstitutions("explosion");
 712   onlyKeepClearSubstitutions("underwaterExplosion");
 713   Parent::initPersistFields();
 714}
 715
 716DefineEngineMethod( ShapeBaseData, checkDeployPos, bool, ( TransformF txfm ),,
 717   "@brief Check if there is the space at the given transform is free to spawn into.\n\n"
 718
 719   "The shape's bounding box volume is used to check for collisions at the given world "
 720   "transform.  Only interior and static objects are checked for collision.\n"
 721
 722   "@param txfm Deploy transform to check\n"
 723   "@return True if the space is free, false if there is already something in "
 724   "the way.\n"
 725
 726   "@note This is a server side only check, and is not actually limited to spawning.\n")
 727{
 728   if (bool(object->mShape) == false)
 729      return false;
 730
 731   MatrixF mat = txfm.getMatrix();
 732
 733   Box3F objBox = object->mShape->mBounds;
 734   Point3F boxCenter = (objBox.minExtents + objBox.maxExtents) * 0.5f;
 735   objBox.minExtents = boxCenter + (objBox.minExtents - boxCenter) * 0.9f;
 736   objBox.maxExtents = boxCenter + (objBox.maxExtents - boxCenter) * 0.9f;
 737
 738   Box3F wBox = objBox;
 739   mat.mul(wBox);
 740
 741   EarlyOutPolyList polyList;
 742   polyList.mNormal.set(0,0,0);
 743   polyList.mPlaneList.clear();
 744   polyList.mPlaneList.setSize(6);
 745   polyList.mPlaneList[0].set(objBox.minExtents,VectorF(-1,0,0));
 746   polyList.mPlaneList[1].set(objBox.maxExtents,VectorF(0,1,0));
 747   polyList.mPlaneList[2].set(objBox.maxExtents,VectorF(1,0,0));
 748   polyList.mPlaneList[3].set(objBox.minExtents,VectorF(0,-1,0));
 749   polyList.mPlaneList[4].set(objBox.minExtents,VectorF(0,0,-1));
 750   polyList.mPlaneList[5].set(objBox.maxExtents,VectorF(0,0,1));
 751
 752   for (U32 i = 0; i < 6; i++)
 753   {
 754      PlaneF temp;
 755      mTransformPlane(mat, Point3F(1, 1, 1), polyList.mPlaneList[i], &temp);
 756      polyList.mPlaneList[i] = temp;
 757   }
 758
 759   if (gServerContainer.buildPolyList(PLC_Collision, wBox, StaticShapeObjectType, &polyList))
 760      return false;
 761   return true;
 762}
 763
 764
 765DefineEngineMethod(ShapeBaseData, getDeployTransform, TransformF, ( Point3F pos, Point3F normal ),,
 766   "@brief Helper method to get a transform from a position and vector (suitable for use with setTransform).\n\n"
 767   "@param pos Desired transform position\n"
 768   "@param normal Vector of desired direction\n"
 769   "@return The deploy transform\n" )
 770{
 771   normal.normalize();
 772
 773   VectorF xAxis;
 774   if( mFabs(normal.z) > mFabs(normal.x) && mFabs(normal.z) > mFabs(normal.y))
 775      mCross( VectorF( 0, 1, 0 ), normal, &xAxis );
 776   else
 777      mCross( VectorF( 0, 0, 1 ), normal, &xAxis );
 778
 779   VectorF yAxis;
 780   mCross( normal, xAxis, &yAxis );
 781
 782   MatrixF testMat(true);
 783   testMat.setColumn( 0, xAxis );
 784   testMat.setColumn( 1, yAxis );
 785   testMat.setColumn( 2, normal );
 786   testMat.setPosition( pos );
 787
 788   return testMat;
 789}
 790
 791void ShapeBaseData::packData(BitStream* stream)
 792{
 793   Parent::packData(stream);
 794
 795   if(stream->writeFlag(computeCRC))
 796      stream->write(mCRC);
 797
 798   stream->writeFlag(shadowEnable);
 799   stream->write(shadowSize);
 800   stream->write(shadowMaxVisibleDistance);
 801   stream->write(shadowProjectionDistance);
 802   stream->write(shadowSphereAdjust);
 803
 804
 805   packShapeAsset(stream);
 806
 807   stream->writeString(cloakTexName);
 808   if(stream->writeFlag(mass != gShapeBaseDataProto.mass))
 809      stream->write(mass);
 810   if(stream->writeFlag(drag != gShapeBaseDataProto.drag))
 811      stream->write(drag);
 812   if(stream->writeFlag(density != gShapeBaseDataProto.density))
 813      stream->write(density);
 814   if(stream->writeFlag(maxEnergy != gShapeBaseDataProto.maxEnergy))
 815      stream->write(maxEnergy);
 816   if(stream->writeFlag(cameraMaxDist != gShapeBaseDataProto.cameraMaxDist))
 817      stream->write(cameraMaxDist);
 818   if(stream->writeFlag(cameraMinDist != gShapeBaseDataProto.cameraMinDist))
 819      stream->write(cameraMinDist);
 820   cameraDefaultFov = mClampF(cameraDefaultFov, cameraMinFov, cameraMaxFov);
 821   if(stream->writeFlag(cameraDefaultFov != gShapeBaseDataProto.cameraDefaultFov))
 822      stream->write(cameraDefaultFov);
 823   if(stream->writeFlag(cameraMinFov != gShapeBaseDataProto.cameraMinFov))
 824      stream->write(cameraMinFov);
 825   if(stream->writeFlag(cameraMaxFov != gShapeBaseDataProto.cameraMaxFov))
 826      stream->write(cameraMaxFov);
 827   stream->writeFlag(cameraCanBank);
 828   stream->writeFlag(mountedImagesBank);
 829   stream->writeString( debrisShapeName );
 830
 831   stream->writeFlag(observeThroughObject);
 832
 833   if( stream->writeFlag( debris != NULL ) )
 834   {
 835      stream->writeRangedU32(mPacked? SimObjectId((uintptr_t)debris):
 836                             debris->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
 837   }
 838
 839   stream->writeFlag(isInvincible);
 840   stream->writeFlag(renderWhenDestroyed);
 841
 842   if( stream->writeFlag( explosion != NULL ) )
 843   {
 844      stream->writeRangedU32( explosion->getId(), DataBlockObjectIdFirst,  DataBlockObjectIdLast );
 845   }
 846
 847   if( stream->writeFlag( underwaterExplosion != NULL ) )
 848   {
 849      stream->writeRangedU32( underwaterExplosion->getId(), DataBlockObjectIdFirst,  DataBlockObjectIdLast );
 850   }
 851
 852   stream->writeFlag(inheritEnergyFromMount);
 853   stream->writeFlag(firstPersonOnly);
 854   stream->writeFlag(useEyePoint);
 855   
 856   if( stream->writeFlag( reflectorDesc != NULL ) )
 857   {
 858      stream->writeRangedU32( reflectorDesc->getId(), DataBlockObjectIdFirst,  DataBlockObjectIdLast );
 859   }
 860
 861   //stream->write(reflectPriority);
 862   //stream->write(reflectMaxRateMs);
 863   //stream->write(reflectMinDist);
 864   //stream->write(reflectMaxDist);
 865   //stream->write(reflectDetailAdjust);
 866   stream->writeString(remap_txr_tags);
 867   stream->writeFlag(silent_bbox_check);
 868}
 869
 870void ShapeBaseData::unpackData(BitStream* stream)
 871{
 872   Parent::unpackData(stream);
 873   computeCRC = stream->readFlag();
 874   if(computeCRC)
 875      stream->read(&mCRC);
 876
 877   shadowEnable = stream->readFlag();
 878   stream->read(&shadowSize);
 879   stream->read(&shadowMaxVisibleDistance);
 880   stream->read(&shadowProjectionDistance);
 881   stream->read(&shadowSphereAdjust);
 882
 883
 884   unpackShapeAsset(stream);
 885
 886   cloakTexName = stream->readSTString();
 887   if(stream->readFlag())
 888      stream->read(&mass);
 889   else
 890      mass = gShapeBaseDataProto.mass;
 891
 892   if(stream->readFlag())
 893      stream->read(&drag);
 894   else
 895      drag = gShapeBaseDataProto.drag;
 896
 897   if(stream->readFlag())
 898      stream->read(&density);
 899   else
 900      density = gShapeBaseDataProto.density;
 901
 902   if(stream->readFlag())
 903      stream->read(&maxEnergy);
 904   else
 905      maxEnergy = gShapeBaseDataProto.maxEnergy;
 906
 907   if(stream->readFlag())
 908      stream->read(&cameraMaxDist);
 909   else
 910      cameraMaxDist = gShapeBaseDataProto.cameraMaxDist;
 911
 912   if(stream->readFlag())
 913      stream->read(&cameraMinDist);
 914   else
 915      cameraMinDist = gShapeBaseDataProto.cameraMinDist;
 916
 917   if(stream->readFlag())
 918      stream->read(&cameraDefaultFov);
 919   else
 920      cameraDefaultFov = gShapeBaseDataProto.cameraDefaultFov;
 921
 922   if(stream->readFlag())
 923      stream->read(&cameraMinFov);
 924   else
 925      cameraMinFov = gShapeBaseDataProto.cameraMinFov;
 926
 927   if(stream->readFlag())
 928      stream->read(&cameraMaxFov);
 929   else
 930      cameraMaxFov = gShapeBaseDataProto.cameraMaxFov;
 931
 932   cameraCanBank = stream->readFlag();
 933   mountedImagesBank = stream->readFlag();
 934
 935   debrisShapeName = stream->readSTString();
 936
 937   observeThroughObject = stream->readFlag();
 938
 939   if( stream->readFlag() )
 940   {
 941      debrisID = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );
 942   }
 943
 944   isInvincible = stream->readFlag();
 945   renderWhenDestroyed = stream->readFlag();
 946
 947   if( stream->readFlag() )
 948   {
 949      explosionID = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );
 950   }
 951
 952   if( stream->readFlag() )
 953   {
 954      underwaterExplosionID = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );
 955   }
 956
 957   inheritEnergyFromMount = stream->readFlag();
 958   firstPersonOnly = stream->readFlag();
 959   useEyePoint = stream->readFlag();
 960
 961   if( stream->readFlag() )
 962   {
 963      cubeDescId = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );
 964   }
 965
 966   //stream->read(&reflectPriority);
 967   //stream->read(&reflectMaxRateMs);
 968   //stream->read(&reflectMinDist);
 969   //stream->read(&reflectMaxDist);
 970   //stream->read(&reflectDetailAdjust);
 971   remap_txr_tags = stream->readSTString();
 972   silent_bbox_check = stream->readFlag();
 973}
 974
 975
 976//----------------------------------------------------------------------------
 977//----------------------------------------------------------------------------
 978
 979Chunker<ShapeBase::CollisionTimeout> sTimeoutChunker;
 980ShapeBase::CollisionTimeout* ShapeBase::sFreeTimeoutList = 0;
 981
 982
 983//----------------------------------------------------------------------------
 984
 985IMPLEMENT_CO_NETOBJECT_V1(ShapeBase);
 986
 987ConsoleDocClass( ShapeBase,
 988   "@ingroup gameObjects"
 989);
 990
 991IMPLEMENT_CALLBACK( ShapeBase, validateCameraFov, F32, (F32 fov), (fov),
 992   "@brief Called on the server when the client has requested a FOV change.\n\n"
 993
 994   "When the client requests that its field of view should be changed (because "
 995   "they want to use a sniper scope, for example) this new FOV needs to be validated "
 996   "by the server.  This method is called if it exists (it is optional) to validate "
 997   "the requested FOV, and modify it if necessary.  This could be as simple as checking "
 998   "that the FOV falls within a correct range, to making sure that the FOV matches the "
 999   "capabilities of the current weapon.\n\n"
1000
1001   "Following this method, ShapeBase ensures that the given FOV still falls within "
1002   "the datablock's cameraMinFov and cameraMaxFov.  If that is good enough for your "
1003   "purposes, then you do not need to define the validateCameraFov() callback for "
1004   "your ShapeBase.\n\n"
1005
1006   "@param fov The FOV that has been requested by the client.\n"
1007   "@return The FOV as validated by the server.\n\n"
1008
1009   "@see ShapeBaseData\n\n");
1010
1011ShapeBase::ShapeBase()
1012 : mDataBlock( NULL ),
1013   mIsAiControlled( false ),
1014   mControllingObject( NULL ),
1015   mAiPose( 0 ),
1016   mMoveMotion( false ),
1017   mShapeBaseMount( NULL ),
1018   mShapeInstance( NULL ),
1019   mConvexList( new Convex ),
1020   mEnergy( 0.0f ),
1021   mRechargeRate( 0.0f ),
1022   mMass( 1.0f ),
1023   mOneOverMass( 1.0f ),
1024   mDrag( 0.0f ),
1025   mBuoyancy( 0.0f ),
1026   mLiquidHeight( 0.0f ),
1027   mWaterCoverage( 0.0f ),
1028   mAppliedForce( Point3F::Zero ),
1029   mNetGravity( 1.0f ),
1030   mDamageFlash( 0.0f ),
1031   mWhiteOut( 0.0f ),
1032   mFlipFadeVal( false ),
1033   mTimeoutList( NULL ),
1034   mDamage( 0.0f ),
1035   mRepairRate( 0.0f ),
1036   mRepairReserve( 0.0f ),
1037   mDamageState( Enabled ),
1038   mDamageThread( NULL ),
1039   mHulkThread( NULL ),
1040   damageDir( 0.0f, 0.0f, 1.0f ),
1041   mCloaked( false ),
1042   mCloakLevel( 0.0f ),
1043   mFadeOut( true ),
1044   mFading( false ),
1045   mFadeVal( 1.0f ),
1046   mFadeElapsedTime( 0.0f ),
1047   mFadeTime( 1.0f ),
1048   mFadeDelay( 0.0f ),
1049   mCameraFov( 90.0f ),
1050   mIsControlled( false ),
1051   mLastRenderFrame( 0 ),
1052   mLastRenderDistance( 0.0f )
1053{
1054   mTypeMask |= ShapeBaseObjectType | LightObjectType;   
1055
1056   S32 i;
1057
1058   for (i = 0; i < MaxSoundThreads; i++) {
1059      mSoundThread[i].play = false;
1060      mSoundThread[i].profile = 0;
1061      mSoundThread[i].sound = 0;
1062   }
1063
1064   for (i = 0; i < MaxScriptThreads; i++) {
1065      mScriptThread[i].sequence = -1;
1066      mScriptThread[i].thread = 0;
1067      mScriptThread[i].state = Thread::Stop;
1068      mScriptThread[i].atEnd = false;
1069      mScriptThread[i].timescale = 1.f;
1070      mScriptThread[i].position = -1.f;
1071   }
1072
1073   for (i = 0; i < MaxTriggerKeys; i++)
1074      mTrigger[i] = false;
1075   anim_clip_flags = 0;
1076   last_anim_id = -1;
1077   last_anim_tag = 0;         
1078   last_anim_lock_tag = 0;
1079   saved_seq_id = -1;
1080   saved_pos = 0.0f;
1081   saved_rate = 1.0f;
1082}
1083
1084
1085ShapeBase::~ShapeBase()
1086{
1087   SAFE_DELETE( mConvexList );
1088
1089   AssertFatal(mMount.link == 0,"ShapeBase::~ShapeBase: An object is still mounted");
1090   if( mShapeInstance && (mShapeInstance->getDebrisRefCount() == 0) )
1091   {
1092      delete mShapeInstance;
1093      mShapeInstance = NULL;
1094   }
1095
1096   CollisionTimeout* ptr = mTimeoutList;
1097   while (ptr) {
1098      CollisionTimeout* cur = ptr;
1099      ptr = ptr->next;
1100      cur->next = sFreeTimeoutList;
1101      sFreeTimeoutList = cur;
1102   }
1103}
1104
1105void ShapeBase::initPersistFields()
1106{
1107   addProtectedField( "skin", TypeRealString, Offset(mAppliedSkinName, ShapeBase), &_setFieldSkin, &_getFieldSkin,
1108      "@brief The skin applied to the shape.\n\n"
1109
1110      "'Skinning' the shape effectively renames the material targets, allowing "
1111      "different materials to be used on different instances of the same model. "
1112      "Using getSkinName() and setSkinName() is equivalent to reading and "
1113      "writing the skin field directly.\n\n"
1114
1115      "Any material targets that start with the old skin name have that part "
1116      "of the name replaced with the new skin name. The initial old skin name is "
1117      "\"base\". For example, if a new skin of \"blue\" was applied to a model "
1118      "that had material targets <i>base_body</i> and <i>face</i>, the new targets "
1119      "would be <i>blue_body</i> and <i>face</i>. Note that <i>face</i> was not "
1120      "renamed since it did not start with the old skin name of \"base\".\n\n"
1121
1122      "To support models that do not use the default \"base\" naming convention, "
1123      "you can also specify the part of the name to replace in the skin field "
1124      "itself. For example, if a model had a material target called <i>shapemat</i>, "
1125      "we could apply a new skin \"shape=blue\", and the material target would be "
1126      "renamed to <i>bluemat</i> (note \"shape\" has been replaced with \"blue\").\n\n"
1127
1128      "Multiple skin updates can also be applied at the same time by separating "
1129      "them with a semicolon. For example: \"base=blue;face=happy_face\".\n\n"
1130
1131      "Material targets are only renamed if an existing Material maps to that "
1132      "name, or if there is a diffuse texture in the model folder with the same "
1133      "name as the new target.\n\n" );
1134
1135   addField( "isAiControlled", TypeBool, Offset(mIsAiControlled, ShapeBase),
1136      "@brief Is this object AI controlled.\n\n"
1137      "If True then this object is considered AI controlled and not player controlled.\n" );
1138
1139   Parent::initPersistFields();
1140}
1141
1142bool ShapeBase::_setFieldSkin( void *object, const char *index, const char *data )
1143{
1144   ShapeBase* shape = static_cast<ShapeBase*>( object );
1145   if ( shape )
1146      shape->setSkinName( data );
1147   return false;
1148}
1149
1150const char *ShapeBase::_getFieldSkin( void *object, const char *data )
1151{
1152   ShapeBase* shape = static_cast<ShapeBase*>( object );
1153   return shape ? shape->getSkinName() : "";
1154}
1155
1156//----------------------------------------------------------------------------
1157
1158bool ShapeBase::onAdd()
1159{
1160   if( !Parent::onAdd() )
1161      return false;
1162      
1163   if( !mDataBlock )
1164   {
1165      Con::errorf( "ShapeBase::onAdd - no datablock on shape %i:%s (%s)",
1166         getId(), getClassName(), getName() );
1167      return false;
1168   }
1169
1170   // Resolve sounds that arrived in the initial update
1171   S32 i;
1172   for (i = 0; i < MaxSoundThreads; i++)
1173      updateAudioState(mSoundThread[i]);
1174
1175   for (i = 0; i < MaxScriptThreads; i++)
1176   {
1177      Thread& st = mScriptThread[i];
1178      if(st.thread)
1179         updateThread(st);
1180   }   
1181
1182/*
1183      if(mDataBlock->cloakTexName != StringTable->EmptyString())
1184        mCloakTexture = TextureHandle(mDataBlock->cloakTexName, MeshTexture, false);
1185*/         
1186   // Accumulation and environment mapping
1187   if (isClientObject() && mShapeInstance)
1188   {
1189      AccumulationVolume::addObject(this);
1190   }
1191   return true;
1192}
1193
1194void ShapeBase::onRemove()
1195{
1196   mConvexList->nukeList();
1197
1198   Parent::onRemove();
1199
1200   // Stop any running sounds on the client
1201   if (isGhost())
1202      for (S32 i = 0; i < MaxSoundThreads; i++)
1203         stopAudio(i);
1204
1205   // Accumulation and environment mapping
1206   if (isClientObject() && mShapeInstance)
1207   {
1208      if (mShapeInstance->hasAccumulation())
1209         AccumulationVolume::removeObject(this);
1210   }
1211
1212   if ( isClientObject() )   
1213   {
1214      mCubeReflector.unregisterReflector();
1215   }
1216}
1217
1218
1219void ShapeBase::onSceneRemove()
1220{
1221   mConvexList->nukeList();
1222   Parent::onSceneRemove();
1223}
1224
1225bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload )
1226{
1227   // need to destroy blend-clips or we crash
1228   if (isGhost())
1229   {
1230      for (S32 i = 0; i < blend_clips.size(); i++)
1231      {
1232         if (blend_clips[i].thread)
1233            mShapeInstance->destroyThread(blend_clips[i].thread);
1234         blend_clips.erase_fast(i);
1235      }
1236   }
1237   ShapeBaseData *prevDB = dynamic_cast<ShapeBaseData*>( mDataBlock );
1238
1239   bool isInitialDataBlock = (prevDB == 0);
1240
1241   if ( Parent::onNewDataBlock( dptr, reload ) == false )
1242      return false;
1243
1244   mDataBlock = dynamic_cast<ShapeBaseData*>(dptr);
1245   if (!mDataBlock)
1246      return false;
1247
1248   setMaskBits(DamageMask);
1249   mDamageThread = 0;
1250   mHulkThread = 0;
1251
1252   // Even if loadShape succeeds, there may not actually be
1253   // a shape assigned to this object.
1254   if (bool(mDataBlock->mShape)) {
1255      delete mShapeInstance;
1256      if (isClientObject() && mDataBlock->txr_tag_remappings.size() > 0)
1257      {
1258         // temporarily substitute material tags with alternates
1259         TSMaterialList* mat_list = mDataBlock->mShape->materialList;
1260         if (mat_list)
1261         {
1262            for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++)
1263            {
1264               ShapeBaseData::TextureTagRemapping* remap = &mDataBlock->txr_tag_remappings[i];
1265               Vector<String>& mat_names = (Vector<String>&) mat_list->getMaterialNameList();
1266               S32 old_tagLen = dStrlen(remap->old_tag);
1267               for (S32 j = 0; j < mat_names.size(); j++)
1268               {
1269                  if (mat_names[j].compare(remap->old_tag, old_tagLen, String::NoCase) == 0)
1270                  {
1271                     mat_names[j] = String(remap->new_tag);
1272                     mat_names[j].insert(0, '#');
1273                     break;
1274                  }
1275               }
1276            }
1277         }
1278      }
1279      mShapeInstance = new TSShapeInstance(mDataBlock->mShape, isClientObject());
1280      if (isClientObject())
1281      {
1282         mShapeInstance->cloneMaterialList();
1283
1284         // restore the material tags to original form
1285         if (mDataBlock->txr_tag_remappings.size() > 0)
1286         {
1287            TSMaterialList* mat_list = mDataBlock->mShape->materialList;
1288            if (mat_list)
1289            {
1290               for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++)
1291               {
1292                  ShapeBaseData::TextureTagRemapping* remap = &mDataBlock->txr_tag_remappings[i];
1293                  Vector<String>& mat_names = (Vector<String>&) mat_list->getMaterialNameList();
1294                  S32 new_tagLen = dStrlen(remap->new_tag);
1295                  for (S32 j = 0; j < mat_names.size(); j++)
1296                  {
1297                     String::SizeType len = mat_names[j].length();
1298                     if (len > 1)
1299                     {
1300                        String temp_name = mat_names[j].substr(1, len - 1);
1301                        if (temp_name.compare(remap->new_tag, new_tagLen) == 0)
1302                        {
1303                           mat_names[j] = String(remap->old_tag);
1304                           break;
1305                        }
1306                     }
1307                  }
1308               }
1309            }
1310         }
1311      }
1312
1313      mObjBox = mDataBlock->mShape->mBounds;
1314      resetWorldBox();
1315
1316      // Set the initial mesh hidden state.
1317      mMeshHidden.setSize(mDataBlock->mShape->objects.size());
1318      mMeshHidden.clear();
1319
1320      // Initialize the threads
1321      for (U32 i = 0; i < MaxScriptThreads; i++) {
1322         Thread& st = mScriptThread[i];
1323         if (st.sequence != -1) {
1324            // TG: Need to see about suppressing non-cyclic sounds
1325            // if the sequences were activated before the object was
1326            // ghosted.
1327            // TG: Cyclic animations need to have a random pos if
1328            // they were started before the object was ghosted.
1329
1330            // If there was something running on the old shape, the thread
1331            // needs to be reset. Otherwise we assume that it's been
1332            // initialized either by the constructor or from the server.
1333            bool reset = st.thread != 0;
1334            st.thread = 0;
1335
1336            // New datablock/shape may not actually HAVE this sequence.
1337            // In that case stop playing it.
1338
1339            AssertFatal(prevDB != NULL, "ShapeBase::onNewDataBlock - how did you have a sequence playing without a prior datablock?");
1340
1341            const TSShape* prevShape = prevDB->mShape;
1342            const TSShape::Sequence& prevSeq = prevShape->sequences[st.sequence];
1343            const String& prevSeqName = prevShape->names[prevSeq.nameIndex];
1344
1345            st.sequence = mDataBlock->mShape->findSequence(prevSeqName);
1346
1347            if (st.sequence != -1)
1348            {
1349               setThreadSequence(i, st.sequence, reset);
1350            }
1351         }
1352      }
1353
1354      if (mDataBlock->damageSequence != -1) {
1355         mDamageThread = mShapeInstance->addThread();
1356         mShapeInstance->setSequence(mDamageThread,
1357            mDataBlock->damageSequence, 0);
1358      }
1359      if (mDataBlock->hulkSequence != -1) {
1360         mHulkThread = mShapeInstance->addThread();
1361         mShapeInstance->setSequence(mHulkThread,
1362            mDataBlock->hulkSequence, 0);
1363      }
1364
1365      if (isGhost())
1366      {
1367         // Reapply the current skin
1368         mAppliedSkinName = "";
1369         reSkin();
1370      }
1371   }
1372
1373   //
1374   mEnergy = 0;
1375   mDamage = 0;
1376   mDamageState = Enabled;
1377   mRepairReserve = 0;
1378   updateMass();
1379   updateDamageLevel();
1380   updateDamageState();
1381
1382   mDrag = mDataBlock->drag;
1383   mCameraFov = mDataBlock->cameraDefaultFov;
1384   updateMass();
1385
1386   if( !isInitialDataBlock && mLightPlugin )
1387      mLightPlugin->reset();
1388   
1389   if ( isClientObject() )
1390   {      
1391      mCubeReflector.unregisterReflector();
1392
1393      if ( mDataBlock->reflectorDesc )
1394         mCubeReflector.registerReflector( this, mDataBlock->reflectorDesc );      
1395   }
1396
1397   return true;
1398}
1399
1400void ShapeBase::onDeleteNotify( SimObject *obj )
1401{
1402   if ( obj == mCurrentWaterObject )
1403      mCurrentWaterObject = NULL;
1404
1405   Parent::onDeleteNotify( obj );      
1406}
1407
1408void ShapeBase::onImpact(SceneObject* obj, const VectorF& vec)
1409{
1410   if (!isGhost())
1411      mDataBlock->onImpact_callback( this, obj, vec, vec.len() );
1412}
1413
1414void ShapeBase::onImpact(const VectorF& vec)
1415{
1416   if (!isGhost())
1417      mDataBlock->onImpact_callback( this, NULL, vec, vec.len() );
1418}
1419
1420
1421//----------------------------------------------------------------------------
1422
1423void ShapeBase::processTick(const Move* move)
1424{
1425   PROFILE_SCOPE( ShapeBase_ProcessTick );
1426
1427   // Energy management
1428   if (mDamageState == Enabled && mDataBlock->inheritEnergyFromMount == false) {
1429      F32 store = mEnergy;
1430      mEnergy += mRechargeRate;
1431      if (mEnergy > mDataBlock->maxEnergy)
1432         mEnergy = mDataBlock->maxEnergy;
1433      else
1434         if (mEnergy < 0)
1435            mEnergy = 0;
1436
1437      // Virtual setEnergyLevel is used here by some derived classes to
1438      // decide whether they really want to set the energy mask bit.
1439      if (mEnergy != store)
1440         setEnergyLevel(mEnergy);
1441   }
1442
1443   // Repair management
1444   if (mDataBlock->isInvincible == false)
1445   {
1446      F32 store = mDamage;
1447      mDamage -= mRepairRate;
1448      mDamage = mClampF(mDamage, 0.f, mDataBlock->maxDamage);
1449
1450      if (mRepairReserve > mDamage)
1451         mRepairReserve = mDamage;
1452      if (mRepairReserve > 0.0)
1453      {
1454         F32 rate = getMin(mDataBlock->repairRate, mRepairReserve);
1455         mDamage -= rate;
1456         mRepairReserve -= rate;
1457      }
1458
1459      if (store != mDamage)
1460      {
1461         updateDamageLevel();
1462         if (isServerObject()) {
1463            setMaskBits(DamageMask);
1464            mDataBlock->onDamage_callback( this, mDamage - store );
1465         }
1466      }
1467   }
1468
1469   if (isServerObject()) {
1470      // Server only...
1471      advanceThreads(TickSec);
1472      updateServerAudio();
1473
1474      // update wet state
1475      setImageWetState(0, mWaterCoverage > 0.4); // more than 40 percent covered
1476
1477      // update motion state
1478      mMoveMotion = false;
1479      if (move && (move->x || move->y || move->z))
1480      {
1481         mMoveMotion = true;
1482      }
1483      for (S32 i = 0; i < MaxMountedImages; i++)
1484      {
1485         setImageMotionState(i, mMoveMotion);
1486      }
1487
1488      if(mFading)
1489      {
1490         F32 dt = TickMs / 1000.0f;
1491         F32 newFadeET = mFadeElapsedTime + dt;
1492         if(mFadeElapsedTime < mFadeDelay && newFadeET >= mFadeDelay)
1493            setMaskBits(CloakMask);
1494         mFadeElapsedTime = newFadeET;
1495         if(mFadeElapsedTime > mFadeTime + mFadeDelay)
1496         {
1497            mFadeVal = F32(!mFadeOut);
1498            mFading = false;
1499         }
1500      }
1501   }
1502
1503   // Advance images
1504   if (isServerObject())
1505   {
1506      for (S32 i = 0; i < MaxMountedImages; i++)
1507      {
1508         if (mMountedImageList[i].dataBlock)
1509            updateImageState(i, TickSec);
1510      }
1511   }
1512
1513   // Call script on trigger state changes
1514   if (move && mDataBlock && isServerObject()) 
1515   {
1516      for (S32 i = 0; i < MaxTriggerKeys; i++) 
1517      {
1518         if (move->trigger[i] != mTrigger[i]) 
1519         {
1520            mTrigger[i] = move->trigger[i];
1521            mDataBlock->onTrigger_callback( this, i, move->trigger[i] );
1522         }
1523      }
1524   }
1525
1526   // Update the damage flash and the whiteout
1527   //
1528   if (mDamageFlash > 0.0)
1529   {
1530      mDamageFlash -= sDamageFlashDec;
1531      if (mDamageFlash <= 0.0)
1532         mDamageFlash = 0.0;
1533   }
1534   if (mWhiteOut > 0.0)
1535   {
1536      mWhiteOut -= sWhiteoutDec;
1537      if (mWhiteOut <= 0.0)
1538         mWhiteOut = 0.0;
1539   }
1540
1541   if (isMounted()) {
1542      MatrixF mat;
1543      mMount.object->getMountTransform( mMount.node, mMount.xfm, &mat );
1544      Parent::setTransform(mat);
1545   }
1546}
1547
1548void ShapeBase::advanceTime(F32 dt)
1549{
1550   // On the client, the shape threads and images are
1551   // advanced at framerate.
1552   advanceThreads(dt);
1553   updateAudioPos();
1554   for (S32 i = 0; i < MaxMountedImages; i++)
1555      if (mMountedImageList[i].dataBlock)
1556      {
1557         updateImageState(i, dt);
1558         updateImageAnimation(i, dt);
1559      }
1560
1561   // Cloaking
1562   if (mCloaked && mCloakLevel != 1.0) {
1563      if (sCloakSpeed <= 0.0f)
1564      {
1565         // Instantaneous
1566         mCloakLevel = 1.0;
1567      }
1568      else
1569      {
1570         // Over time determined by sCloakSpeed
1571         mCloakLevel += dt / sCloakSpeed;
1572         if (mCloakLevel >= 1.0)
1573            mCloakLevel = 1.0;
1574      }
1575   } else if (!mCloaked && mCloakLevel != 0.0) {
1576      if (sCloakSpeed <= 0.0f)
1577      {
1578         // Instantaneous
1579         mCloakLevel = 0.0;
1580      }
1581      else
1582      {
1583         // Over time determined by sCloakSpeed
1584         mCloakLevel -= dt / sCloakSpeed;
1585         if (mCloakLevel <= 0.0)
1586            mCloakLevel = 0.0;
1587      }
1588   }
1589   if(mFading)
1590   {
1591      mFadeElapsedTime += dt;
1592      if(mFadeElapsedTime > mFadeTime)
1593      {
1594         mFadeVal = F32(!mFadeOut);
1595         mFading = false;
1596      }
1597      else
1598      {
1599         mFadeVal = mFadeElapsedTime / mFadeTime;
1600         if(mFadeOut)
1601            mFadeVal = 1 - mFadeVal;
1602      }
1603   }
1604
1605   if (isMounted()) {
1606      MatrixF mat;
1607      mMount.object->getRenderMountTransform( 0.0f, mMount.node, mMount.xfm, &mat );
1608      Parent::setRenderTransform(mat);
1609   }
1610}
1611
1612void ShapeBase::setControllingClient( GameConnection* client )
1613{
1614   if( isGhost() && gSFX3DWorld )
1615   {
1616      if( gSFX3DWorld->getListener() == this && !client && getControllingClient() && getControllingClient()->isConnectionToServer() )
1617      {
1618         // We are the current listener and are no longer a controller object on the
1619         // connection, so clear our listener status.
1620         
1621         gSFX3DWorld->setListener( NULL );
1622      }
1623      else if( client && client->isConnectionToServer() && !getControllingObject() )
1624      {
1625         // We're on the local client and not controlled by another object, so make
1626         // us the current SFX listener.
1627         
1628         gSFX3DWorld->setListener( this );
1629      }
1630   }
1631
1632   Parent::setControllingClient( client );
1633
1634   // Update all of the mounted images' shapes so they may
1635   // optimize their animation threads.
1636   for (U32 i=0; i<MaxMountedImages; ++i)
1637   {
1638      MountedImage& image = mMountedImageList[i];
1639      image.updateDoAnimateAllShapes( this );
1640   }
1641}
1642
1643void ShapeBase::setControllingObject(ShapeBase* obj)
1644{
1645   if (obj) {
1646      setProcessTick(false);
1647      // Even though we don't processTick, we still need to
1648      // process after the controller in case anyone is mounted
1649      // on this object.
1650      processAfter(obj);
1651   }
1652   else {
1653      setProcessTick(true);
1654      clearProcessAfter();
1655      // Catch the case of the controlling object actually
1656      // mounted on this object.
1657      if (mControllingObject->mMount.object == this)
1658         mControllingObject->processAfter(this);
1659   }
1660   mControllingObject = obj;
1661}
1662
1663ShapeBase* ShapeBase::getControlObject()
1664{
1665   return 0;
1666}
1667
1668void ShapeBase::setControlObject(ShapeBase*)
1669{
1670}
1671
1672bool ShapeBase::isFirstPerson() const
1673{
1674   // Always first person as far as the server is concerned.
1675   if (!isGhost())
1676      return true;
1677
1678   if (const GameConnection* con = getControllingClient())
1679      return con->getControlObject() == this && con->isFirstPerson();
1680   return false;
1681}
1682
1683bool ShapeBase::isValidCameraFov(F32 fov)
1684{
1685   return((fov >= mDataBlock->cameraMinFov) && (fov <= mDataBlock->cameraMaxFov));
1686}
1687
1688void ShapeBase::setCameraFov(F32 fov)
1689{
1690   // On server allow for script side checking
1691   if ( !isGhost() && isMethod( "validateCameraFov" ) )
1692   {
1693      fov = validateCameraFov_callback( fov );
1694   }
1695
1696   mCameraFov = mClampF(fov, mDataBlock->cameraMinFov, mDataBlock->cameraMaxFov);
1697}
1698
1699void ShapeBase::onCameraScopeQuery(NetConnection *cr, CameraScopeQuery * query)
1700{
1701   // update the camera query
1702   query->camera = this;
1703
1704   if(GameConnection * con = dynamic_cast<GameConnection*>(cr))
1705   {
1706      // get the fov from the connection (in deg)
1707      F32 fov;
1708      if (con->getControlCameraFov(&fov))
1709      {
1710         query->fov = mDegToRad(fov/2);
1711         query->sinFov = mSin(query->fov);
1712         query->cosFov = mCos(query->fov);
1713      }
1714   }
1715
1716   // use eye rather than camera transform (good enough and faster)
1717   MatrixF eyeTransform;
1718   getEyeTransform(&eyeTransform);
1719   eyeTransform.getColumn(3, &query->pos);
1720   eyeTransform.getColumn(1, &query->orientation);
1721
1722   // Get the visible distance.
1723   if (getSceneManager() != NULL)
1724      query->visibleDistance = getSceneManager()->getVisibleDistance();
1725
1726   Parent::onCameraScopeQuery( cr, query );
1727}
1728
1729
1730//----------------------------------------------------------------------------
1731F32 ShapeBase::getEnergyLevel()
1732{
1733   if ( mDataBlock->inheritEnergyFromMount && mShapeBaseMount )
1734      return mShapeBaseMount->getEnergyLevel();
1735   return mEnergy; 
1736}
1737
1738F32 ShapeBase::getEnergyValue()
1739{
1740   if ( mDataBlock->inheritEnergyFromMount && mShapeBaseMount )
1741   {
1742      F32 maxEnergy = mShapeBaseMount->mDataBlock->maxEnergy;
1743      if ( maxEnergy > 0.f )
1744         return (mShapeBaseMount->getEnergyLevel() / maxEnergy);
1745   }
1746   else
1747   {
1748      F32 maxEnergy = mDataBlock->maxEnergy;
1749      if ( maxEnergy > 0.f )
1750         return (mEnergy / mDataBlock->maxEnergy);   
1751   }
1752
1753   return 0.0f;
1754}
1755
1756void ShapeBase::setEnergyLevel(F32 energy)
1757{
1758   if (mDataBlock->inheritEnergyFromMount == false || !mShapeBaseMount) {
1759      if (mDamageState == Enabled) {
1760         mEnergy = (energy > mDataBlock->maxEnergy)?
1761            mDataBlock->maxEnergy: (energy < 0)? 0: energy;
1762      }
1763   } else {
1764      // Pass the set onto whatever we're mounted to...
1765      if ( mShapeBaseMount )
1766      {
1767         mShapeBaseMount->setEnergyLevel(energy);
1768      }
1769   }
1770}
1771
1772void ShapeBase::setDamageLevel(F32 damage)
1773{
1774   if (!mDataBlock->isInvincible) {
1775      F32 store = mDamage;
1776      mDamage = mClampF(damage, 0.f, mDataBlock->maxDamage);
1777
1778      if (store != mDamage) {
1779         updateDamageLevel();
1780         if (isServerObject()) {
1781            setMaskBits(DamageMask);
1782            mDataBlock->onDamage_callback( this, mDamage - store );
1783         }
1784      }
1785   }
1786}
1787
1788void ShapeBase::updateContainer()
1789{
1790   PROFILE_SCOPE( ShapeBase_updateContainer );
1791
1792   // Update container drag and buoyancy properties
1793
1794   // Set default values.
1795   mDrag = mDataBlock->drag;
1796   mBuoyancy = 0.0f;      
1797   mNetGravity = gGravity;
1798   mAppliedForce.set(0,0,0);
1799   
1800   ContainerQueryInfo info;
1801   info.box = getWorldBox();
1802   info.mass = getMass();
1803
1804   mContainer->findObjects(info.box, WaterObjectType</a>|<a href="/coding/file/objecttypes_8h/#objecttypes_8h_1ac18d4a11e9446825e48fd474d7529084a1af121084d5760a7eaef4bb8828ce1cf">PhysicalZoneObjectType,findRouter,&info);
1805      
1806   mWaterCoverage = info.waterCoverage;
1807   mLiquidType    = info.liquidType;
1808   mLiquidHeight  = info.waterHeight;   
1809   setCurrentWaterObject( info.waterObject );
1810   
1811   // This value might be useful as a datablock value,
1812   // This is what allows the player to stand in shallow water (below this coverage)
1813   // without jiggling from buoyancy
1814   if (mWaterCoverage >= 0.25f) 
1815   {      
1816      // water viscosity is used as drag for in water.
1817      // ShapeBaseData drag is used for drag outside of water.
1818      // Combine these two components to calculate this ShapeBase object's 
1819      // current drag.
1820      mDrag = ( info.waterCoverage * info.waterViscosity ) + 
1821              ( 1.0f - info.waterCoverage ) * mDataBlock->drag;
1822      mBuoyancy = (info.waterDensity / mDataBlock->density) * info.waterCoverage;
1823   }
1824
1825   mAppliedForce = info.appliedForce;
1826   mNetGravity = (1.0-mBuoyancy)*info.gravityScale* gGravity;
1827
1828   //Con::printf( "WaterCoverage: %f", mWaterCoverage );
1829   //Con::printf( "Drag: %f", mDrag );
1830}
1831
1832
1833//----------------------------------------------------------------------------
1834
1835void ShapeBase::applyRepair(F32 amount)
1836{
1837   // Repair increases the repair reserve
1838   if (amount > 0 && ((mRepairReserve += amount) > mDamage))
1839      mRepairReserve = mDamage;
1840}
1841
1842void ShapeBase::applyDamage(F32 amount)
1843{
1844   if (amount > 0)
1845      setDamageLevel(mDamage + amount);
1846}
1847
1848F32 ShapeBase::getDamageValue()
1849{
1850   // Return a 0-1 damage value.
1851   return mDamage / mDataBlock->maxDamage;
1852}
1853
1854F32 ShapeBase::getMaxDamage()
1855{
1856   return mDataBlock->maxDamage;
1857}
1858
1859void ShapeBase::updateDamageLevel()
1860{
1861   if (mDamageThread) {
1862      // mDamage is already 0-1 on the client
1863      if (mDamage >= mDataBlock->destroyedLevel) {
1864         if (getDamageState() == Destroyed)
1865            mShapeInstance->setPos(mDamageThread, 0);
1866         else
1867            mShapeInstance->setPos(mDamageThread, 1);
1868      } else {
1869         mShapeInstance->setPos(mDamageThread, mDamage / mDataBlock->destroyedLevel);
1870      }
1871   }      
1872}
1873
1874
1875//----------------------------------------------------------------------------
1876
1877void ShapeBase::setDamageState(DamageState state)
1878{
1879   if (mDamageState == state)
1880      return;
1881
1882   bool invokeCallback = false;
1883   const char* lastState = 0;
1884
1885   if (!isGhost()) {
1886      if (state != getDamageState())
1887         setMaskBits(DamageMask);
1888
1889      lastState = getDamageStateName();
1890      switch (state) {
1891         case Destroyed: {
1892            if (mDamageState == Enabled)
1893            {
1894               setDamageState(Disabled);
1895
1896               // It is possible that the setDamageState() call above has already
1897               // upgraded our state to Destroyed.  If that is the case, no need
1898               // to continue.
1899               if (mDamageState == state)
1900                  return;
1901            }
1902            invokeCallback = true;
1903            break;
1904         }
1905         case Disabled:
1906            if (mDamageState == Enabled)
1907               invokeCallback = true;
1908            break;
1909         case Enabled:
1910            invokeCallback = true;
1911            break;
1912         default:
1913            AssertFatal(false, "Invalid damage state");
1914            break;
1915      }
1916   }
1917
1918   mDamageState = state;
1919   if (mDamageState != Enabled) {
1920      mRepairReserve = 0;
1921      mEnergy = 0;
1922   }
1923   if (invokeCallback) {
1924      // Like to call the scripts after the state has been intialize.
1925      // This should only end up being called on the server.
1926      switch (state) {
1927         case Destroyed:
1928            mDataBlock->onDestroyed_callback( this, lastState );
1929            break;
1930         case Disabled:
1931            mDataBlock->onDisabled_callback( this, lastState );
1932            break;
1933         case Enabled:
1934            mDataBlock->onEnabled_callback( this, lastState );
1935            break;
1936         default:
1937            break;
1938      }
1939   }
1940   updateDamageState();
1941   updateDamageLevel();
1942}
1943
1944bool ShapeBase::setDamageState(const char* state)
1945{
1946   for (S32 i = 0; i < NumDamageStates; i++)
1947      if (!dStricmp(state,sDamageStateName[i])) {
1948         setDamageState(DamageState(i));
1949         return true;
1950      }
1951   return false;
1952}
1953
1954const char* ShapeBase::getDamageStateName()
1955{
1956   return sDamageStateName[mDamageState];
1957}
1958
1959void ShapeBase::updateDamageState()
1960{
1961   if (mHulkThread) {
1962      F32 pos = (mDamageState == Destroyed) ? 1.0f : 0.0f;
1963      if (mShapeInstance->getPos(mHulkThread) != pos) {
1964         mShapeInstance->setPos(mHulkThread,pos);
1965
1966         if (isClientObject())
1967            mShapeInstance->animate();
1968      }
1969   }
1970}
1971
1972
1973//----------------------------------------------------------------------------
1974
1975void ShapeBase::blowUp()
1976{
1977   Point3F center;
1978   mObjBox.getCenter(&center);
1979   center += getPosition();
1980   MatrixF trans = getTransform();
1981   trans.setPosition( center );
1982
1983   // explode
1984   Explosion* pExplosion = NULL;
1985
1986   if( pointInWater( (Point3F &)center ) && mDataBlock->underwaterExplosion )
1987   {
1988      pExplosion = new Explosion;
1989      pExplosion->onNewDataBlock(mDataBlock->underwaterExplosion, false);
1990   }
1991   else
1992   {
1993      if (mDataBlock->explosion)
1994      {
1995         pExplosion = new Explosion;
1996         pExplosion->onNewDataBlock(mDataBlock->explosion, false);
1997      }
1998   }
1999
2000   if( pExplosion )
2001   {
2002      pExplosion->setTransform(trans);
2003      pExplosion->setInitialState(center, damageDir);
2004      if (pExplosion->registerObject() == false)
2005      {
2006         Con::errorf(ConsoleLogEntry::General, "ShapeBase(%s)::explode: couldn't register explosion",
2007                     mDataBlock->getName() );
2008         delete pExplosion;
2009         pExplosion = NULL;
2010      }
2011   }
2012
2013   TSShapeInstance *debShape = NULL;
2014
2015   if( mDataBlock->debrisShape == NULL )
2016   {
2017      return;
2018   }
2019   else
2020   {
2021      debShape = new TSShapeInstance( mDataBlock->debrisShape, true);
2022   }
2023
2024
2025   Vector< TSPartInstance *> partList;
2026   TSPartInstance::breakShape( debShape, 0, partList, NULL, NULL, 0 );
2027
2028   if( !mDataBlock->debris )
2029   {
2030      mDataBlock->debris = new DebrisData;
2031   }
2032
2033   // cycle through partlist and create debris pieces
2034   for( U32 i=0; i<partList.size(); i++ )
2035   {
2036      //Point3F axis( 0.0, 0.0, 1.0 );
2037      Point3F randomDir = MathUtils::randomDir( damageDir, 0, 50 );
2038
2039      Debris *debris = new Debris;
2040      debris->setPartInstance( partList[i] );
2041      debris->init( center, randomDir );
2042      debris->onNewDataBlock( mDataBlock->debris, false );
2043      debris->setTransform( trans );
2044
2045      if( !debris->registerObject() )
2046      {
2047         Con::warnf( ConsoleLogEntry::General, "Could not register debris for class: %s", mDataBlock->getName() );
2048         delete debris;
2049         debris = NULL;
2050      }
2051      else
2052      {
2053         debShape->incDebrisRefCount();
2054      }
2055   }
2056
2057   damageDir.set(0, 0, 1);
2058}
2059
2060//----------------------------------------------------------------------------
2061
2062void ShapeBase::onMount( SceneObject *obj, S32 node )
2063{   
2064   mConvexList->nukeList();   
2065
2066   // Are we mounting to a ShapeBase object?
2067   mShapeBaseMount = dynamic_cast<ShapeBase*>( obj );
2068
2069   Parent::onMount( obj, node );
2070}
2071
2072void ShapeBase::onUnmount( SceneObject *obj, S32 node )
2073{
2074   Parent::onUnmount( obj, node );
2075
2076   mShapeBaseMount = NULL;
2077}
2078
2079Point3F ShapeBase::getAIRepairPoint()
2080{
2081   if (mDataBlock->mountPointNode[ShapeBaseData::AIRepairNode] < 0)
2082        return Point3F(0, 0, 0);
2083   MatrixF xf(true);
2084   getMountTransform( ShapeBaseData::AIRepairNode, MatrixF::Identity, &xf );
2085   Point3F pos(0, 0, 0);
2086   xf.getColumn(3,&pos);
2087   return pos;
2088}
2089
2090//----------------------------------------------------------------------------
2091
2092void ShapeBase::getEyeTransform(MatrixF* mat)
2093{
2094   getEyeBaseTransform(mat, true);
2095}
2096
2097void ShapeBase::getEyeBaseTransform(MatrixF* mat, bool includeBank)
2098{
2099   // Returns eye to world space transform
2100   S32 eyeNode = mDataBlock->eyeNode;
2101   if (eyeNode != -1)
2102      mat->mul(getTransform(), mShapeInstance->mNodeTransforms[eyeNode]);
2103   else
2104      *mat = getTransform();
2105}
2106
2107void ShapeBase::getRenderEyeTransform(MatrixF* mat)
2108{
2109   getRenderEyeBaseTransform(mat, true);
2110}
2111
2112void ShapeBase::getRenderEyeBaseTransform(MatrixF* mat, bool includeBank)
2113{
2114   // Returns eye to world space transform
2115   S32 eyeNode = mDataBlock->eyeNode;
2116   if (eyeNode != -1)
2117      mat->mul(getRenderTransform(), mShapeInstance->mNodeTransforms[eyeNode]);
2118   else
2119      *mat = getRenderTransform();
2120}
2121
2122void ShapeBase::getCameraTransform(F32* pos,MatrixF* mat)
2123{
2124   // Returns camera to world space transform
2125   // Handles first person / third person camera position
2126
2127   if (isServerObject() && mShapeInstance)
2128      mShapeInstance->animateNodeSubtrees(true);
2129
2130   if (*pos != 0)
2131   {
2132      F32 min,max;
2133      Point3F offset;
2134      MatrixF eye,rot;
2135      getCameraParameters(&min,&max,&offset,&rot);
2136      getRenderEyeTransform(&eye);
2137      mat->mul(eye,rot);
2138
2139      // Use the eye transform to orient the camera
2140      VectorF vp,vec;
2141      vp.x = vp.z = 0;
2142      vp.y = -(max - min) * *pos;
2143      eye.mulV(vp,&vec);
2144      
2145      VectorF minVec;
2146      vp.y = -min;
2147      eye.mulV( vp, &minVec );
2148
2149      // Use the camera node's pos.
2150      Point3F osp,sp;
2151      if (mDataBlock->cameraNode != -1) {
2152         mShapeInstance->mNodeTransforms[mDataBlock->cameraNode].getColumn(3,&osp);
2153
2154         // Scale the camera position before applying the transform
2155         const Point3F& scale = getScale();
2156         osp.convolve( scale );
2157
2158         getRenderTransform().mulP(osp,&sp);
2159      }
2160      else
2161         getRenderTransform().getColumn(3,&sp);
2162
2163      // Make sure we don't extend the camera into anything solid
2164      Point3F ep = sp + minVec + vec + offset;
2165      disableCollision();
2166      if (isMounted())
2167         getObjectMount()->disableCollision();
2168      RayInfo collision;
2169      if( mContainer && mContainer->castRay(sp, ep,
2170                              (0xFFFFFFFF & ~(WaterObjectType      |
2171                                              GameBaseObjectType   |
2172                                              TriggerObjectType    |
2173                                              DefaultObjectType)),
2174                              &collision) == true) {
2175         F32 vecLenSq = vec.lenSquared();
2176         F32 adj = (-mDot(vec, collision.normal) / vecLenSq) * 0.1;
2177         F32 newPos = getMax(0.0f, collision.t - adj);
2178         if (newPos == 0.0f)
2179            eye.getColumn(3,&ep);
2180         else
2181            ep = sp + offset + (vec * newPos);
2182      }
2183      mat->setColumn(3,ep);
2184      if (isMounted())
2185         getObjectMount()->enableCollision();
2186      enableCollision();
2187   }
2188   else
2189   {
2190      getRenderEyeTransform(mat);
2191   }
2192
2193   // Apply Camera FX.
2194   mat->mul( gCamFXMgr.getTrans() );
2195}
2196
2197void ShapeBase::getEyeCameraTransform(IDisplayDevice *displayDevice, U32 eyeId, MatrixF *outMat)
2198{
2199   MatrixF temp(1);
2200   Point3F eyePos;
2201   Point3F rotEyePos;
2202
2203   DisplayPose newPose;
2204   displayDevice->getFrameEyePose(&newPose, eyeId);
2205
2206   // Ok, basically we just need to add on newPose to the camera transform
2207   // NOTE: currently we dont support third-person camera in this mode
2208   MatrixF cameraTransform(1);
2209   F32 fakePos = 0;
2210   //cameraTransform = getRenderTransform(); // use this for controllers TODO
2211   getCameraTransform(&fakePos, &cameraTransform);
2212
2213   temp = MatrixF(1);
2214   newPose.orientation.setMatrix(&temp);
2215   temp.setPosition(newPose.position);
2216
2217   *outMat = cameraTransform * temp;
2218}
2219
2220void ShapeBase::getCameraParameters(F32 *min,F32* max,Point3F* off,MatrixF* rot)
2221{
2222   *min = mDataBlock->cameraMinDist;
2223   *max = mDataBlock->cameraMaxDist;
2224   off->set(0,0,0);
2225   rot->identity();
2226}
2227
2228//----------------------------------------------------------------------------
2229F32 ShapeBase::getDamageFlash() const
2230{
2231   return mDamageFlash;
2232}
2233
2234void ShapeBase::setDamageFlash(const F32 flash)
2235{
2236   mDamageFlash = flash;
2237   if (mDamageFlash < 0.0)
2238      mDamageFlash = 0;
2239   else if (mDamageFlash > 1.0)
2240      mDamageFlash = 1.0;
2241}
2242
2243
2244//----------------------------------------------------------------------------
2245F32 ShapeBase::getWhiteOut() const
2246{
2247   return mWhiteOut;
2248}
2249
2250void ShapeBase::setWhiteOut(const F32 flash)
2251{
2252   mWhiteOut = flash;
2253   if (mWhiteOut < 0.0)
2254      mWhiteOut = 0;
2255   else if (mWhiteOut > 1.5)
2256      mWhiteOut = 1.5;
2257}
2258
2259
2260//----------------------------------------------------------------------------
2261
2262bool ShapeBase::onlyFirstPerson() const
2263{
2264   return mDataBlock->firstPersonOnly;
2265}
2266
2267bool ShapeBase::useObjsEyePoint() const
2268{
2269   return mDataBlock->useEyePoint;
2270}
2271
2272//----------------------------------------------------------------------------
2273void ShapeBase::setVelocity(const VectorF&)
2274{
2275}
2276
2277void ShapeBase::applyImpulse(const Point3F&,const VectorF&)
2278{
2279}
2280
2281
2282//----------------------------------------------------------------------------
2283
2284void ShapeBase::playAudio(U32 slot,SFXTrack* profile)
2285{
2286   AssertFatal( slot < MaxSoundThreads, "ShapeBase::playAudio() bad slot index" );
2287   Sound& st = mSoundThread[slot];
2288   if( profile && ( !st.play || st.profile != profile ) ) 
2289   {
2290      setMaskBits(SoundMaskN << slot);
2291      st.play = true;
2292      st.profile = profile;
2293      updateAudioState(st);
2294   }
2295}
2296
2297void ShapeBase::stopAudio(U32 slot)
2298{
2299   AssertFatal( slot < MaxSoundThreads, "ShapeBase::stopAudio() bad slot index" );
2300
2301   Sound& st = mSoundThread[slot];
2302   if ( st.play ) 
2303   {
2304      st.play = false;
2305      setMaskBits(SoundMaskN << slot);
2306      updateAudioState(st);
2307   }
2308}
2309
2310void ShapeBase::updateServerAudio()
2311{
2312   // Timeout non-looping sounds
2313   for (S32 i = 0; i < MaxSoundThreads; i++) {
2314      Sound& st = mSoundThread[i];
2315      if (st.play && st.timeout && st.timeout < Sim::getCurrentTime()) {
2316         clearMaskBits(SoundMaskN << i);
2317         st.play = false;
2318      }
2319   }
2320}
2321
2322void ShapeBase::updateAudioState(Sound& st)
2323{
2324   SFX_DELETE( st.sound );
2325
2326   if ( st.play && st.profile ) 
2327   {
2328      if ( isGhost() ) 
2329      {
2330         if ( Sim::findObject( SimObjectId((uintptr_t)st.profile), st.profile ) )
2331         {
2332            st.sound = SFX->createSource( st.profile, &getTransform() );
2333            if ( st.sound )
2334               st.sound->play();
2335         }
2336         else
2337            st.play = false;
2338      }
2339      else 
2340      {
2341         // Non-looping sounds timeout on the server
2342         st.timeout = 0;
2343         if ( !st.profile->getDescription()->mIsLooping )
2344            st.timeout = Sim::getCurrentTime() + sAudioTimeout;
2345      }
2346   }
2347   else
2348      st.play = false;
2349}
2350
2351void ShapeBase::updateAudioPos()
2352{
2353   for (S32 i = 0; i < MaxSoundThreads; i++)
2354   {
2355      SFXSource* source = mSoundThread[i].sound;
2356      if ( source )
2357         source->setTransform( getTransform() );
2358   }
2359}
2360
2361//----------------------------------------------------------------------------
2362
2363const char *ShapeBase::getThreadSequenceName( U32 slot )
2364{
2365   Thread& st = mScriptThread[slot];
2366   if ( st.sequence == -1 )
2367   {
2368      // Invalid Animation.
2369      return "";
2370   }
2371
2372   // Name Index
2373   const U32 nameIndex = getShape()->sequences[st.sequence].nameIndex;
2374
2375   // Return Name.
2376   return getShape()->getName( nameIndex );
2377}
2378
2379bool ShapeBase::setThreadSequence(U32 slot, S32 seq, bool reset)
2380{
2381   Thread& st = mScriptThread[slot];
2382   if (st.thread && st.sequence == seq && st.state == Thread::Play)
2383      return true;
2384
2385   // Handle a -1 sequence, as this may be set when a thread has been destroyed.
2386   if(seq == -1)
2387      return true;
2388
2389   if (seq < MaxSequenceIndex) {
2390      setMaskBits(ThreadMaskN << slot);
2391      st.sequence = seq;
2392      if (reset) {
2393         st.state = Thread::Play;
2394         st.atEnd = false;
2395         st.timescale = 1.f;
2396         st.position = 0.f;
2397      }
2398      if (mShapeInstance) {
2399         if (!st.thread)
2400            st.thread = mShapeInstance->addThread();
2401         mShapeInstance->setSequence(st.thread,seq,st.position);
2402         updateThread(st);
2403      }
2404      return true;
2405   }
2406   return false;
2407}
2408
2409void ShapeBase::updateThread(Thread& st)
2410{
2411   switch (st.state)
2412   {
2413      case Thread::Stop:
2414         {
2415            mShapeInstance->setTimeScale( st.thread, 1.f );
2416            mShapeInstance->setPos( st.thread, ( st.timescale > 0.f ) ? 1.0f : 0.0f );
2417         } // Drop through to pause state
2418
2419      case Thread::Pause:
2420         {
2421            mShapeInstance->setTimeScale( st.thread, 0.f );
2422         } break;
2423
2424      case Thread::Play:
2425         {
2426            if (st.atEnd)
2427            {
2428               mShapeInstance->setTimeScale(st.thread,1);
2429               mShapeInstance->setPos( st.thread, ( st.timescale > 0.f ) ? 1.0f : 0.0f );
2430               mShapeInstance->setTimeScale(st.thread,0);
2431               st.state = Thread::Stop;
2432            }
2433            else
2434            {
2435               if ( st.position != -1.f )
2436               {
2437                  mShapeInstance->setTimeScale( st.thread, 1.f );
2438                  mShapeInstance->setPos( st.thread, st.position );
2439               }
2440
2441               mShapeInstance->setTimeScale(st.thread, st.timescale );
2442            }
2443         } break;
2444
2445      case Thread::Destroy:
2446         {
2447            st.atEnd = true;
2448            st.sequence = -1;
2449            if(st.thread)
2450            {
2451               mShapeInstance->destroyThread(st.thread);
2452               st.thread = 0;
2453            }
2454         } break;
2455   }
2456}
2457
2458bool ShapeBase::stopThread(U32 slot)
2459{
2460   Thread& st = mScriptThread[slot];
2461   if (st.sequence != -1 && st.state != Thread::Stop) {
2462      setMaskBits(ThreadMaskN << slot);
2463      st.state = Thread::Stop;
2464      updateThread(st);
2465      return true;
2466   }
2467   return false;
2468}
2469
2470bool ShapeBase::destroyThread(U32 slot)
2471{
2472   Thread& st = mScriptThread[slot];
2473   if (st.sequence != -1 && st.state != Thread::Destroy) {
2474      setMaskBits(ThreadMaskN << slot);
2475      st.state = Thread::Destroy;
2476      updateThread(st);
2477      return true;
2478   }
2479   return false;
2480}
2481
2482bool ShapeBase::pauseThread(U32 slot)
2483{
2484   Thread& st = mScriptThread[slot];
2485   if (st.sequence != -1 && st.state != Thread::Pause) {
2486      setMaskBits(ThreadMaskN << slot);
2487      st.state = Thread::Pause;
2488      updateThread(st);
2489      return true;
2490   }
2491   return false;
2492}
2493
2494bool ShapeBase::playThread(U32 slot)
2495{
2496   Thread& st = mScriptThread[slot];
2497   if (st.sequence != -1 && st.state != Thread::Play) {
2498      setMaskBits(ThreadMaskN << slot);
2499      st.state = Thread::Play;
2500      updateThread(st);
2501      return true;
2502   }
2503   return false;
2504}
2505
2506bool ShapeBase::setThreadPosition( U32 slot, F32 pos )
2507{
2508   Thread& st = mScriptThread[slot];
2509   if (st.sequence != -1)
2510   {
2511      setMaskBits(ThreadMaskN << slot);
2512      st.position = pos;
2513      st.atEnd = false;
2514      updateThread(st);
2515
2516      return true;
2517   }
2518   return false;
2519}
2520
2521bool ShapeBase::setThreadDir(U32 slot,bool forward)
2522{
2523   Thread& st = mScriptThread[slot];
2524   if (st.sequence != -1)
2525   {
2526      if ( ( st.timescale >= 0.f ) != forward )
2527      {
2528         setMaskBits(ThreadMaskN << slot);
2529         st.timescale *= -1.f ;
2530         st.atEnd = false;
2531         updateThread(st);
2532      }
2533      return true;
2534   }
2535   return false;
2536}
2537
2538bool ShapeBase::setThreadTimeScale( U32 slot, F32 timeScale )
2539{
2540   Thread& st = mScriptThread[slot];
2541   if (st.sequence != -1)
2542   {
2543      if (st.timescale != timeScale)
2544      {
2545         setMaskBits(ThreadMaskN << slot);
2546         st.timescale = timeScale;
2547         updateThread(st);
2548      }
2549      return true;
2550   }
2551   return false;
2552}
2553
2554void ShapeBase::advanceThreads(F32 dt)
2555{
2556   for (U32 i = 0; i < MaxScriptThreads; i++) {
2557      Thread& st = mScriptThread[i];
2558      if (st.thread) {
2559         if (!mShapeInstance->getShape()->sequences[st.sequence].isCyclic() && !st.atEnd &&
2560          ( ( st.timescale > 0.f )? mShapeInstance->getPos(st.thread) >= 1.0:
2561              mShapeInstance->getPos(st.thread) <= 0)) {
2562            st.atEnd = true;
2563            updateThread(st);
2564            if (!isGhost()) {
2565               mDataBlock->onEndSequence_callback(this, i, this->getThreadSequenceName(i));
2566            }
2567         }
2568
2569         // Make sure the thread is still valid after the call to onEndSequence_callback().
2570         // Someone could have called destroyThread() while in there.
2571         if(st.thread)
2572         {
2573            mShapeInstance->advanceTime(dt,st.thread);
2574            st.position = mShapeInstance->getPos(st.thread);
2575         }
2576      }
2577   }
2578}
2579
2580//----------------------------------------------------------------------------
2581
2582/// Emit particles on the given emitter, if we're within triggerHeight above some static surface with a
2583/// material that has 'showDust' set to true.  The particles will have a lifetime of 'numMilliseconds'
2584/// and be emitted at the given offset from the contact point having a direction of 'axis'.
2585
2586void ShapeBase::emitDust( ParticleEmitter* emitter, F32 triggerHeight, const Point3F& offset, U32 numMilliseconds, const Point3F& axis )
2587{
2588   if( !emitter )
2589      return;
2590
2591   Point3F startPos = getPosition();
2592   Point3F endPos = startPos + Point3F( 0.0, 0.0, - triggerHeight );
2593
2594   RayInfo rayInfo;
2595   if( getContainer()->castRay( startPos, endPos, STATIC_COLLISION_TYPEMASK, &rayInfo ) )
2596   {
2597      Material* material = ( rayInfo.material ? dynamic_cast< Material* >( rayInfo.material->getMaterial() ) : 0 );
2598      if( material && material->mShowDust )
2599      {
2600         LinearColorF colorList[ ParticleData::PDC_NUM_KEYS ];
2601
2602         for( U32 x = 0; x < getMin( Material::NUM_EFFECT_COLOR_STAGES, ParticleData::PDC_NUM_KEYS ); ++ x )
2603            colorList[ x ] = material->mEffectColor[ x ];
2604         for( U32 x = Material::NUM_EFFECT_COLOR_STAGES; x < ParticleData::PDC_NUM_KEYS; ++ x )
2605            colorList[ x ].set( 1.0, 1.0, 1.0, 0.0 );
2606
2607         emitter->setColors( colorList );
2608
2609         Point3F contactPoint = rayInfo.point + offset;
2610         emitter->emitParticles( contactPoint, true, ( axis == Point3F::Zero ? rayInfo.normal : axis ),
2611                                 getVelocity(), numMilliseconds );
2612      }
2613   }
2614}
2615
2616//----------------------------------------------------------------------------
2617
2618TSShape const* ShapeBase::getShape()
2619{
2620   return mShapeInstance? mShapeInstance->getShape(): 0;
2621}
2622
2623void ShapeBase::prepRenderImage( SceneRenderState *state )
2624{
2625   _prepRenderImage( state, true, true );
2626}
2627
2628void ShapeBase::_prepRenderImage(   SceneRenderState *state, 
2629                                    bool renderSelf, 
2630                                    bool renderMountedImages )
2631{
2632   PROFILE_SCOPE( ShapeBase_PrepRenderImage );
2633
2634   //if ( mIsCubemapUpdate )
2635   //   return false;
2636
2637   if( ( getDamageState() == Destroyed ) && ( !mDataBlock->renderWhenDestroyed ) )
2638      return;
2639
2640   // We don't need to render if all the meshes are forced hidden.
2641   if ( mMeshHidden.getSize() > 0 && mMeshHidden.testAll() )   
2642      return;
2643      
2644   // If we're rendering shadows don't render the mounted
2645   // images unless the shape is also rendered.
2646   if ( state->isShadowPass() && !renderSelf )
2647      return;
2648
2649   // If we're currently rendering our own reflection we
2650   // don't want to render ourselves into it.
2651   if ( mCubeReflector.isRendering() )
2652      return;
2653
2654   // We force all the shapes to use the highest detail
2655   // if we're the control object or mounted.
2656   bool forceHighestDetail = false;
2657   {
2658      GameConnection *con = GameConnection::getConnectionToServer();
2659      ShapeBase *co = NULL;
2660      if(con && ( (co = dynamic_cast<ShapeBase*>(con->getControlObject())) != NULL) )
2661      {
2662         if(co == this || co->getObjectMount() == this)
2663            forceHighestDetail = true;
2664      }
2665   }
2666
2667   mLastRenderFrame = sLastRenderFrame;
2668
2669   // get shape detail...we might not even need to be drawn
2670   Point3F cameraOffset = getWorldBox().getClosestPoint( state->getDiffuseCameraPosition() ) - state->getDiffuseCameraPosition();
2671   F32 dist = cameraOffset.len();
2672   if (dist < 0.01f)
2673      dist = 0.01f;
2674
2675   F32 invScale = (1.0f/getMax(getMax(mObjScale.x,mObjScale.y),mObjScale.z));
2676
2677   if (mShapeInstance)
2678   {
2679      if ( forceHighestDetail )         
2680         mShapeInstance->setCurrentDetail( 0 );
2681      else
2682         mShapeInstance->setDetailFromDistance( state, dist * invScale );
2683                              
2684      mShapeInstance->animate();
2685   }
2686   
2687   if (  ( mShapeInstance && mShapeInstance->getCurrentDetail() < 0 ) ||
2688         ( !mShapeInstance && !gShowBoundingBox ) ) 
2689   {
2690      // no, don't draw anything
2691      return;
2692   }
2693
2694   if( renderMountedImages )
2695   {
2696      for (U32 i = 0; i < MaxMountedImages; i++)
2697      {
2698         MountedImage& image = mMountedImageList[i];
2699         U32 imageShapeIndex = getImageShapeIndex(image);
2700         if (image.dataBlock && image.shapeInstance[imageShapeIndex])
2701         {
2702            // Select detail levels on mounted items but... always 
2703            // draw the control object's mounted images in high detail.
2704            if ( forceHighestDetail )
2705               image.shapeInstance[imageShapeIndex]->setCurrentDetail( 0 );
2706            else
2707               image.shapeInstance[imageShapeIndex]->setDetailFromDistance( state, dist * invScale );
2708
2709            if (!mIsZero( (1.0f - mCloakLevel) * mFadeVal))
2710            {
2711               prepBatchRender( state, i );
2712
2713               // Debug rendering of the mounted shape bounds.
2714               if ( gShowBoundingBox )
2715               {
2716                  ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
2717                  ri->renderDelegate.bind( this, &ShapeBase::_renderBoundingBox );
2718                  ri->objectIndex = i;
2719                  ri->type = RenderPassManager::RIT_Editor;
2720                  state->getRenderPass()->addInst( ri );
2721               }
2722            }
2723         }
2724      }
2725   }
2726
2727   // Debug rendering of the shape bounding box.
2728   if ( gShowBoundingBox )
2729   {
2730      ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
2731      ri->renderDelegate.bind( this, &ShapeBase::_renderBoundingBox );
2732      ri->objectIndex = -1;
2733      ri->type = RenderPassManager::RIT_Editor;
2734      state->getRenderPass()->addInst( ri );
2735   }
2736
2737   if ( mShapeInstance && renderSelf )
2738      prepBatchRender( state, -1 );
2739
2740   calcClassRenderData();
2741}
2742
2743//----------------------------------------------------------------------------
2744// prepBatchRender
2745//----------------------------------------------------------------------------
2746void ShapeBase::prepBatchRender(SceneRenderState* state, S32 mountedImageIndex )
2747{
2748   // CHANGES IN HERE SHOULD BE DUPLICATED IN TSSTATIC!
2749   
2750   GFXTransformSaver saver;
2751   
2752   // Set up our TS render state. 
2753   TSRenderState rdata;
2754   rdata.setSceneState( state );
2755   if ( mCubeReflector.isEnabled() )
2756      rdata.setCubemap( mCubeReflector.getCubemap() );
2757   rdata.setFadeOverride( (1.0f - mCloakLevel) * mFadeVal );
2758
2759   // We might have some forward lit materials
2760   // so pass down a query to gather lights.
2761   LightQuery query;
2762   query.init( getWorldSphere() );
2763   rdata.setLightQuery( &query );
2764
2765   if( mountedImageIndex != -1 )
2766   {
2767      MountedImage& image = mMountedImageList[mountedImageIndex];
2768
2769      if( image.dataBlock && image.shapeInstance )
2770      {
2771         renderMountedImage( mountedImageIndex, rdata, state );
2772      }
2773   }
2774   else
2775   {
2776      MatrixF mat = getRenderTransform();
2777      mat.scale( mObjScale );
2778      GFX->setWorldMatrix( mat );
2779
2780      if ( state->isDiffusePass() && mCubeReflector.isEnabled() && mCubeReflector.getOcclusionQuery() )
2781      {
2782         RenderPassManager *pass = state->getRenderPass();
2783
2784         OccluderRenderInst *ri = pass->allocInst<OccluderRenderInst>();   
2785
2786         ri->type = RenderPassManager::RIT_Occluder;
2787         ri->query = mCubeReflector.getOcclusionQuery();   
2788         mObjToWorld.mulP( mObjBox.getCenter(), &ri->position );
2789         ri->scale.set( mObjBox.getExtents() );
2790         ri->orientation = pass->allocUniqueXform( mObjToWorld );        
2791         ri->isSphere = false;
2792         state->getRenderPass()->addInst( ri );
2793      }
2794
2795      mShapeInstance->animate();
2796      mShapeInstance->render( rdata );
2797   }
2798}
2799
2800void ShapeBase::renderMountedImage( U32 imageSlot, TSRenderState &rstate, SceneRenderState *state )
2801{
2802   GFX->pushWorldMatrix();
2803
2804   MatrixF mat;
2805   getRenderImageTransform(imageSlot, &mat, rstate.getSceneState()->isShadowPass());
2806   GFX->setWorldMatrix( mat );
2807
2808   MountedImage& image = mMountedImageList[imageSlot];
2809   U32 imageShapeIndex = getImageShapeIndex(image);
2810   image.shapeInstance[imageShapeIndex]->animate();
2811   image.shapeInstance[imageShapeIndex]->render( rstate );
2812
2813   GFX->popWorldMatrix();
2814}
2815
2816void ShapeBase::_renderBoundingBox( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat )
2817{
2818   // If we got an override mat then this some
2819   // special rendering pass... skip out of it.
2820   if ( overrideMat )
2821      return;
2822
2823   GFXStateBlockDesc desc;
2824   desc.setZReadWrite( true, false );
2825   desc.setBlend( true );
2826   desc.fillMode = GFXFillWireframe;
2827
2828   GFXDrawUtil *drawer = GFX->getDrawUtil();
2829
2830   if ( ri->objectIndex != -1 )
2831   {
2832      MountedImage &image = mMountedImageList[ ri->objectIndex ];
2833
2834      if ( image.shapeInstance )
2835      {
2836         MatrixF mat;
2837         getRenderImageTransform( ri->objectIndex, &mat );         
2838
2839         const Box3F &objBox = image.shapeInstance[getImageShapeIndex(image)]->getShape()->mBounds;
2840
2841         drawer->drawCube( desc, objBox, ColorI( 255, 255, 255 ), &mat );
2842      }
2843   }
2844   else   
2845      drawer->drawCube( desc, mObjBox, ColorI( 255, 255, 255 ), &mRenderObjToWorld );
2846}
2847
2848bool ShapeBase::castRay(const Point3F &start, const Point3F &end, RayInfo* info)
2849{
2850   if (mShapeInstance) 
2851   {
2852      RayInfo shortest;
2853      shortest.t = 1e8;
2854
2855      info->object = NULL;
2856      for (U32 i = 0; i < mDataBlock->LOSDetails.size(); i++)
2857      {
2858         mShapeInstance->animate(mDataBlock->LOSDetails[i]);
2859         if (mShapeInstance->castRay(start, end, info, mDataBlock->LOSDetails[i]))
2860         {
2861            info->object = this;
2862            if (info->t < shortest.t)
2863               shortest = *info;
2864         }
2865      }
2866
2867      if (info->object == this) 
2868      {
2869         // Copy out the shortest time...
2870         *info = shortest;
2871         return true;
2872      }
2873   }
2874
2875   return false;
2876}
2877
2878bool ShapeBase::castRayRendered(const Point3F &start, const Point3F &end, RayInfo* info)
2879{
2880   if (mShapeInstance) 
2881   {
2882      RayInfo localInfo;
2883      mShapeInstance->animate();
2884      bool res = mShapeInstance->castRayRendered(start, end, &localInfo, mShapeInstance->getCurrentDetail());
2885      if (res)
2886      {
2887         *info = localInfo;
2888         info->object = this;
2889         return true;
2890      }
2891   }
2892
2893   return false;
2894}
2895
2896
2897//----------------------------------------------------------------------------
2898
2899bool ShapeBase::buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &, const SphereF &)
2900{
2901   if ( !mShapeInstance )
2902      return false;
2903
2904   polyList->setTransform(&mObjToWorld, mObjScale);
2905   polyList->setObject(this);
2906
2907   if ( context == PLC_Selection )
2908   {
2909      mShapeInstance->animate();
2910      mShapeInstance->buildPolyList(polyList,mShapeInstance->getCurrentDetail());
2911      return true;
2912   }
2913   else if ( context == PLC_Export )
2914   {
2915      // Try to call on the client so we can export materials
2916      ShapeBase* exportObj = this;
2917      if ( isServerObject() && getClientObject() )
2918         exportObj = dynamic_cast<ShapeBase*>(getClientObject());
2919
2920      S32 dl = 0;
2921      exportObj->mShapeInstance->animate();
2922      exportObj->mShapeInstance->buildPolyList(polyList, dl);
2923      return true;
2924   }
2925   else
2926   {
2927      bool ret = false;
2928      for (U32 i = 0; i < mDataBlock->collisionDetails.size(); i++)
2929      {
2930         mShapeInstance->buildPolyList(polyList,mDataBlock->collisionDetails[i]);
2931         ret = true;
2932      }
2933
2934      return ret;
2935   }
2936}
2937
2938void ShapeBase::buildConvex(const Box3F& box, Convex* convex)
2939{
2940   if (mShapeInstance == NULL)
2941      return;
2942
2943   // These should really come out of a pool
2944   mConvexList->collectGarbage();
2945
2946   Box3F realBox = box;
2947   mWorldToObj.mul(realBox);
2948   realBox.minExtents.convolveInverse(mObjScale);
2949   realBox.maxExtents.convolveInverse(mObjScale);
2950
2951   if (realBox.isOverlapped(getObjBox()) == false)
2952      return;
2953
2954   for (U32 i = 0; i < mDataBlock->collisionDetails.size(); i++)
2955   {
2956         Box3F newbox = mDataBlock->collisionBounds[i];
2957         newbox.minExtents.convolve(mObjScale);
2958         newbox.maxExtents.convolve(mObjScale);
2959         mObjToWorld.mul(newbox);
2960         if (box.isOverlapped(newbox) == false)
2961            continue;
2962
2963         // See if this hull exists in the working set already...
2964         Convex* cc = 0;
2965         CollisionWorkingList& wl = convex->getWorkingList();
2966         for (CollisionWorkingList* itr = wl.wLink.mNext; itr != &wl; itr = itr->wLink.mNext) {
2967            if (itr->mConvex->getType() == ShapeBaseConvexType &&
2968                (static_cast<ShapeBaseConvex*>(itr->mConvex)->pShapeBase == this &&
2969                 static_cast<ShapeBaseConvex*>(itr->mConvex)->hullId     == i)) {
2970               cc = itr->mConvex;
2971               break;
2972            }
2973         }
2974         if (cc)
2975            continue;
2976
2977         // Create a new convex.
2978         ShapeBaseConvex* cp = new ShapeBaseConvex;
2979         mConvexList->registerObject(cp);
2980         convex->addToWorkingList(cp);
2981         cp->mObject    = this;
2982         cp->pShapeBase = this;
2983         cp->hullId     = i;
2984         cp->box        = mDataBlock->collisionBounds[i];
2985         cp->transform = 0;
2986         cp->findNodeTransform();
2987   }
2988}
2989
2990
2991//----------------------------------------------------------------------------
2992
2993void ShapeBase::queueCollision( SceneObject *obj, const VectorF &vec)
2994{
2995   // Add object to list of collisions.
2996   SimTime time = Sim::getCurrentTime();
2997   S32 num = obj->getId();
2998
2999   CollisionTimeout** adr = &mTimeoutList;
3000   CollisionTimeout* ptr = mTimeoutList;
3001   while (ptr) {
3002      if (ptr->objectNumber == num) {
3003         if (ptr->expireTime < time) {
3004            ptr->expireTime = time + CollisionTimeoutValue;
3005            ptr->object = obj;
3006            ptr->vector = vec;
3007         }
3008         return;
3009      }
3010      // Recover expired entries
3011      if (ptr->expireTime < time) {
3012         CollisionTimeout* cur = ptr;
3013         *adr = ptr->next;
3014         ptr = ptr->next;
3015         cur->next = sFreeTimeoutList;
3016         sFreeTimeoutList = cur;
3017      }
3018      else {
3019         adr = &ptr->next;
3020         ptr = ptr->next;
3021      }
3022   }
3023
3024   // New entry for the object
3025   if (sFreeTimeoutList != NULL)
3026   {
3027      ptr = sFreeTimeoutList;
3028      sFreeTimeoutList = ptr->next;
3029      ptr->next = NULL;
3030   }
3031   else
3032   {
3033      ptr = sTimeoutChunker.alloc();
3034   }
3035
3036   ptr->object = obj;
3037   ptr->objectNumber = obj->getId();
3038   ptr->vector = vec;
3039   ptr->expireTime = time + CollisionTimeoutValue;
3040   ptr->next = mTimeoutList;
3041
3042   mTimeoutList = ptr;
3043}
3044
3045void ShapeBase::notifyCollision()
3046{
3047   // Notify all the objects that were just stamped during the queueing
3048   // process.
3049   SimTime expireTime = Sim::getCurrentTime() + CollisionTimeoutValue;
3050   for (CollisionTimeout* ptr = mTimeoutList; ptr; ptr = ptr->next)
3051   {
3052      if (ptr->expireTime == expireTime && ptr->object)
3053      {
3054         SimObjectPtr<SceneObject> safePtr(ptr->object);
3055         SimObjectPtr<ShapeBase> safeThis(this);
3056         onCollision(ptr->object,ptr->vector);
3057         ptr->object = 0;
3058
3059         if(!bool(safeThis))
3060            return;
3061
3062         if(bool(safePtr))
3063            safePtr->onCollision(this,ptr->vector);
3064
3065         if(!bool(safeThis))
3066            return;
3067      }
3068   }
3069}
3070
3071void ShapeBase::onCollision( SceneObject *object, const VectorF &vec )
3072{
3073   if (!isGhost())
3074      mDataBlock->onCollision_callback( this, object, vec, vec.len() );
3075}
3076
3077//--------------------------------------------------------------------------
3078bool ShapeBase::pointInWater( Point3F &point )
3079{
3080   if ( mCurrentWaterObject == NULL )
3081      return false;
3082
3083   return mCurrentWaterObject->isUnderwater( point );   
3084}
3085
3086//----------------------------------------------------------------------------
3087
3088void ShapeBase::writePacketData(GameConnection *connection, BitStream *stream)
3089{
3090   Parent::writePacketData(connection, stream);
3091
3092   stream->write(getEnergyLevel());
3093   stream->write(mRechargeRate);
3094}
3095
3096void ShapeBase::readPacketData(GameConnection *connection, BitStream *stream)
3097{
3098   Parent::readPacketData(connection, stream);
3099
3100   F32 energy;
3101   stream->read(&energy);
3102   setEnergyLevel(energy);
3103
3104   stream->read(&mRechargeRate);
3105}
3106
3107F32 ShapeBase::getUpdatePriority(CameraScopeQuery *camInfo, U32 updateMask, S32 updateSkips)
3108{
3109   // If it's the scope object, must be high priority
3110   if (camInfo->camera == this) {
3111      // Most priorities are between 0 and 1, so this
3112      // should be something larger.
3113      return 10.0f;
3114   }
3115   if( camInfo->camera )
3116   {
3117      ShapeBase* camera = dynamic_cast< ShapeBase* >( camInfo->camera );
3118      // see if the camera is mounted to this...
3119      // if it is, this should have a high priority
3120      if( camera && camera->getObjectMount() == this)
3121         return 10.0f;
3122   }
3123   return Parent::getUpdatePriority(camInfo, updateMask, updateSkips);
3124}
3125
3126U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
3127{
3128   U32 retMask = Parent::packUpdate(con, mask, stream);
3129
3130   if (mask & InitialUpdateMask) {
3131      // mask off sounds that aren't playing
3132      S32 i;
3133      for (i = 0; i < MaxSoundThreads; i++)
3134         if (!mSoundThread[i].play)
3135            mask &= ~(SoundMaskN << i);
3136
3137      // mask off threads that aren't running
3138      for (i = 0; i < MaxScriptThreads; i++)
3139         if (mScriptThread[i].sequence == -1)
3140            mask &= ~(ThreadMaskN << i);
3141
3142      // mask off images that aren't updated
3143      for(i = 0; i < MaxMountedImages; i++)
3144         if(!mMountedImageList[i].dataBlock)
3145            mask &= ~(ImageMaskN << i);
3146   }
3147
3148   if(!stream->writeFlag(mask & (NameMask | DamageMask | SoundMask | MeshHiddenMask |
3149         ThreadMask | ImageMask | CloakMask | SkinMask)))
3150      return retMask;
3151
3152   if (stream->writeFlag(mask & DamageMask)) {
3153      stream->writeFloat(mClampF(mDamage / mDataBlock->maxDamage, 0.f, 1.f), DamageLevelBits);
3154      stream->writeInt(mDamageState,NumDamageStateBits);
3155      stream->writeNormalVector( damageDir, 8 );
3156   }
3157
3158   if (stream->writeFlag(mask & ThreadMask)) {
3159      for (S32 i = 0; i < MaxScriptThreads; i++) {
3160         Thread& st = mScriptThread[i];
3161         if (stream->writeFlag( (st.sequence != -1 || st.state == Thread::Destroy) && (mask & (ThreadMaskN << i)) ) ) {
3162            stream->writeInt(st.sequence,ThreadSequenceBits);
3163            stream->writeInt(st.state,2);
3164            stream->write(st.timescale);
3165            stream->write(st.position);
3166            stream->writeFlag(st.atEnd);
3167         }
3168      }
3169   }
3170
3171   if (stream->writeFlag(mask & SoundMask)) {
3172      for (S32 i = 0; i < MaxSoundThreads; i++) {
3173         Sound& st = mSoundThread[i];
3174         if (stream->writeFlag(mask & (SoundMaskN << i)))
3175            if (stream->writeFlag(st.play))
3176               stream->writeRangedU32(st.profile->getId(),DataBlockObjectIdFirst,
3177                                      DataBlockObjectIdLast);
3178      }
3179   }
3180
3181   if (stream->writeFlag(mask & ImageMask)) {
3182      for (S32 i = 0; i < MaxMountedImages; i++)
3183         if (stream->writeFlag(mask & (ImageMaskN << i))) {
3184            MountedImage& image = mMountedImageList[i];
3185            if (stream->writeFlag(image.dataBlock))
3186               stream->writeInt(image.dataBlock->getId() - DataBlockObjectIdFirst,
3187                                DataBlockObjectIdBitSize);
3188            con->packNetStringHandleU(stream, image.skinNameHandle);
3189            con->packNetStringHandleU(stream, image.scriptAnimPrefix);
3190
3191            // Used to force the 1st person rendering on the client.  This is required
3192            // as this object could be ghosted to the client prior to its controlling client
3193            // being set.  Therefore there is a network tick when the object is in limbo...
3194            stream->writeFlag(image.dataBlock && image.dataBlock->animateAllShapes && getControllingClient() == con);
3195
3196            stream->writeFlag(image.wet);
3197            stream->writeFlag(image.motion);
3198            stream->writeFlag(image.ammo);
3199            stream->writeFlag(image.loaded);
3200            stream->writeFlag(image.target);
3201            stream->writeFlag(image.triggerDown);
3202            stream->writeFlag(image.altTriggerDown);
3203
3204            for (U32 j=0; j<ShapeBaseImageData::MaxGenericTriggers; ++j)
3205            {
3206               stream->writeFlag(image.genericTrigger[j]);
3207            }
3208
3209            stream->writeInt(image.fireCount,3);            
3210            stream->writeInt(image.altFireCount,3);
3211            stream->writeInt(image.reloadCount,3);
3212            stream->writeFlag(isImageFiring(i));
3213            stream->writeFlag(isImageAltFiring(i));
3214            stream->writeFlag(isImageReloading(i));
3215         }
3216   }
3217
3218   // Group some of the uncommon stuff together.
3219   if (stream->writeFlag(mask & (NameMask | CloakMask | SkinMask | MeshHiddenMask ))) {
3220         
3221      if (stream->writeFlag(mask & CloakMask))
3222      {
3223         // cloaking
3224         stream->writeFlag( mCloaked );
3225
3226         // piggyback control update
3227         stream->writeFlag(bool(getControllingClient()));
3228
3229         // fading
3230         if(stream->writeFlag(mFading && mFadeElapsedTime >= mFadeDelay)) {
3231            stream->writeFlag(mFadeOut);
3232            stream->write(mFadeTime);
3233         }
3234         else
3235            stream->writeFlag(mFadeVal == 1.0f);
3236      }
3237      if (stream->writeFlag(mask & NameMask)) {
3238         con->packNetStringHandleU(stream, mShapeNameHandle);
3239      }
3240
3241      if ( stream->writeFlag( mask & MeshHiddenMask ) )
3242         stream->writeBits( mMeshHidden );
3243
3244      if (stream->writeFlag(mask & SkinMask))
3245         con->packNetStringHandleU(stream, mSkinNameHandle);
3246   }
3247
3248   return retMask;
3249}
3250
3251void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream)
3252{
3253   Parent::unpackUpdate(con, stream);
3254   mLastRenderFrame = sLastRenderFrame; // make sure we get a process after the event...
3255
3256   if(!stream->readFlag())
3257      return;
3258
3259   if (stream->readFlag()) {
3260      mDamage = mClampF(stream->readFloat(DamageLevelBits) * mDataBlock->maxDamage, 0.f, mDataBlock->maxDamage);
3261      DamageState prevState = mDamageState;
3262      mDamageState = DamageState(stream->readInt(NumDamageStateBits));
3263      stream->readNormalVector( &damageDir, 8 );
3264      if (prevState != Destroyed && mDamageState == Destroyed && isProperlyAdded())
3265         blowUp();
3266      updateDamageLevel();
3267      updateDamageState();
3268   }
3269
3270   if (stream->readFlag()) {
3271      for (S32 i = 0; i < MaxScriptThreads; i++) {
3272         if (stream->readFlag()) {
3273            Thread& st = mScriptThread[i];
3274            U32 seq = stream->readInt(ThreadSequenceBits);
3275            st.state = Thread::State(stream->readInt(2));
3276            stream->read( &st.timescale );
3277            stream->read( &st.position );
3278            st.atEnd = stream->readFlag();
3279            if (st.sequence != seq && st.state != Thread::Destroy)
3280               setThreadSequence(i,seq,false);
3281            else
3282               updateThread(st);
3283         }
3284      }
3285   }
3286
3287   if ( stream->readFlag() ) 
3288   {
3289      for ( S32 i = 0; i < MaxSoundThreads; i++ ) 
3290      {
3291         if ( stream->readFlag() ) 
3292         {
3293            Sound& st = mSoundThread[i];
3294            st.play = stream->readFlag();
3295            if ( st.play ) 
3296            {
3297               st.profile = (SFXTrack*)(uintptr_t)stream->readRangedU32(  DataBlockObjectIdFirst,
3298                                                                DataBlockObjectIdLast );
3299            }
3300
3301            if ( isProperlyAdded() )
3302               updateAudioState( st );
3303         }
3304      }
3305   }
3306
3307   // Mounted Images
3308   if (stream->readFlag()) {
3309      for (S32 i = 0; i < MaxMountedImages; i++) {
3310         if (stream->readFlag()) {
3311            MountedImage& image = mMountedImageList[i];
3312            ShapeBaseImageData* imageData = 0;
3313            if (stream->readFlag()) {
3314               SimObjectId id = stream->readInt(DataBlockObjectIdBitSize) +
3315                  DataBlockObjectIdFirst;
3316               if (!Sim::findObject(id,imageData)) {
3317                  con->setLastError("Invalid packet (mounted images).");
3318                  return;
3319               }
3320            }
3321
3322            NetStringHandle skinDesiredNameHandle = con->unpackNetStringHandleU(stream);
3323
3324            NetStringHandle scriptDesiredAnimPrefix = con->unpackNetStringHandleU(stream);
3325
3326            image.forceAnimateAllShapes = stream->readFlag();
3327
3328            image.wet = stream->readFlag();
3329
3330            image.motion = stream->readFlag();
3331
3332            image.ammo = stream->readFlag();
3333
3334            image.loaded = stream->readFlag();
3335
3336            image.target = stream->readFlag();
3337
3338            image.triggerDown = stream->readFlag();
3339            image.altTriggerDown = stream->readFlag();
3340
3341            for (U32 j=0; j<ShapeBaseImageData::MaxGenericTriggers; ++j)
3342            {
3343               image.genericTrigger[j] = stream->readFlag();
3344            }
3345
3346            S32 count = stream->readInt(3);
3347            S32 altCount = stream->readInt(3);
3348            S32 reloadCount = stream->readInt(3);
3349
3350            bool datablockChange = image.dataBlock != imageData;
3351            if (datablockChange || (image.skinNameHandle != skinDesiredNameHandle))
3352            {
3353               MountedImage& neoImage = mMountedImageList[i];
3354            neoImage.scriptAnimPrefix = scriptDesiredAnimPrefix;
3355
3356               setImage(   i, imageData, 
3357                           skinDesiredNameHandle, neoImage.loaded,
3358                           neoImage.ammo, neoImage.triggerDown, neoImage.altTriggerDown,
3359                           neoImage.motion, neoImage.genericTrigger[0], neoImage.genericTrigger[1], neoImage.genericTrigger[2], neoImage.genericTrigger[3],
3360                           neoImage.target);
3361            }
3362            
3363            if (!datablockChange && image.scriptAnimPrefix != scriptDesiredAnimPrefix)
3364            {
3365               // We don't have a new image, but we do have a new script anim prefix to work with.
3366               // Notify the image of this change.
3367               MountedImage& animImage = mMountedImageList[i];
3368            animImage.scriptAnimPrefix = scriptDesiredAnimPrefix;
3369               updateAnimThread(i, getImageShapeIndex(animImage));
3370            }
3371
3372            bool isFiring = stream->readFlag();
3373            bool isAltFiring = stream->readFlag();
3374            bool isReloading = stream->readFlag();
3375
3376            if (isProperlyAdded()) {
3377               // Normal processing
3378               bool processFiring = false;
3379               if (count != image.fireCount)
3380               {
3381                  image.fireCount = count;
3382                  setImageState(i,getImageFireState(i),true);
3383                  processFiring = true;
3384               }
3385               else if (altCount != image.altFireCount)
3386               {
3387                  image.altFireCount = altCount;
3388                  setImageState(i,getImageAltFireState(i),true);
3389                  processFiring = true;
3390               }
3391               else if (reloadCount != image.reloadCount)
3392               {
3393                  image.reloadCount = reloadCount;
3394                  setImageState(i,getImageReloadState(i),true);
3395               }
3396
3397               if (processFiring && imageData)
3398               {
3399                  if ( imageData->lightType == ShapeBaseImageData::WeaponFireLight )                     
3400                     image.lightStart = Sim::getCurrentTime();                     
3401               }
3402               
3403               updateImageState(i,0);
3404            }
3405            else
3406            {               
3407               if(imageData)
3408               {
3409                  // Initial state
3410                  image.fireCount = count;
3411                  image.altFireCount = altCount;
3412                  image.reloadCount = reloadCount;
3413                  if (isFiring)
3414                     setImageState(i,getImageFireState(i),true);
3415                  else if (isAltFiring)
3416                     setImageState(i,getImageAltFireState(i),true);
3417                  else if (isReloading)
3418                     setImageState(i,getImageReloadState(i),true);
3419               }
3420            }
3421         }
3422      }
3423   }
3424
3425   if (stream->readFlag())
3426   {
3427      if(stream->readFlag())     // CloakMask and control
3428      {
3429         // Read cloaking state.
3430         
3431         setCloakedState(stream->readFlag());
3432         mIsControlled = stream->readFlag();
3433
3434         if (( mFading = stream->readFlag()) == true) {
3435            mFadeOut = stream->readFlag();
3436            if(mFadeOut)
3437               mFadeVal = 1.0f;
3438            else
3439               mFadeVal = 0;
3440            stream->read(&mFadeTime);
3441            mFadeDelay = 0;
3442            mFadeElapsedTime = 0;
3443         }
3444         else
3445            mFadeVal = F32(stream->readFlag());
3446      }
3447      if (stream->readFlag())  { // NameMask
3448         mShapeNameHandle = con->unpackNetStringHandleU(stream);
3449      }
3450      
3451      if ( stream->readFlag() ) // MeshHiddenMask
3452      {
3453         stream->readBits( &mMeshHidden );
3454         _updateHiddenMeshes();
3455      }
3456
3457      if (stream->readFlag())    // SkinMask
3458      {
3459         NetStringHandle skinDesiredNameHandle = con->unpackNetStringHandleU(stream);;
3460         if (mSkinNameHandle != skinDesiredNameHandle)
3461         {
3462            mSkinNameHandle = skinDesiredNameHandle;
3463            reSkin();
3464         }
3465      }
3466   }
3467}
3468
3469
3470//--------------------------------------------------------------------------
3471
3472void ShapeBase::forceUncloak(const char * reason)
3473{
3474   AssertFatal(isServerObject(), "ShapeBase::forceUncloak: server only call");
3475   if(!mCloaked)
3476      return;
3477
3478   mDataBlock->onForceUncloak_callback( this, reason ? reason : "" );
3479}
3480
3481void ShapeBase::setCloakedState(bool cloaked)
3482{
3483   if (cloaked == mCloaked)
3484      return;
3485
3486   if (isServerObject())
3487      setMaskBits(CloakMask);
3488
3489   // Have to do this for the client, if we are ghosted over in the initial
3490   //  packet as cloaked, we set the state immediately to the extreme
3491   if (isProperlyAdded() == false) {
3492      mCloaked = cloaked;
3493      if (mCloaked)
3494         mCloakLevel = 1.0;
3495      else
3496         mCloakLevel = 0.0;
3497   } else {
3498      mCloaked = cloaked;
3499   }
3500}
3501
3502
3503//--------------------------------------------------------------------------
3504
3505void ShapeBase::setHidden( bool hidden )
3506{
3507   if( hidden != isHidden() )
3508   {
3509      Parent::setHidden( hidden );
3510
3511      if( hidden )
3512         setProcessTick( false );
3513      else
3514         setProcessTick( true );
3515   }
3516}
3517
3518//--------------------------------------------------------------------------
3519
3520void ShapeBaseConvex::findNodeTransform()
3521{
3522   S32 dl = pShapeBase->mDataBlock->collisionDetails[hullId];
3523
3524   TSShapeInstance* si = pShapeBase->getShapeInstance();
3525   TSShape* shape = si->getShape();
3526
3527   const TSShape::Detail* detail = &shape->details[dl];
3528   const S32 subs = detail->subShapeNum;
3529   const S32 start = shape->subShapeFirstObject[subs];
3530   const S32 end = start + shape->subShapeNumObjects[subs];
3531
3532   // Find the first object that contains a mesh for this
3533   // detail level. There should only be one mesh per
3534   // collision detail level.
3535   for (S32 i = start; i < end; i++) 
3536   {
3537      const TSShape::Object* obj = &shape->objects[i];
3538      if (obj->numMeshes && detail->objectDetailNum < obj->numMeshes) 
3539      {
3540         nodeTransform = &si->mNodeTransforms[obj->nodeIndex];
3541         return;
3542      }
3543   }
3544   return;
3545}
3546
3547const MatrixF& ShapeBaseConvex::getTransform() const
3548{
3549   // If the transform isn't specified, it's assumed to be the
3550   // origin of the shape.
3551   const MatrixF& omat = (transform != 0)? *transform: mObject->getTransform();
3552
3553   // Multiply on the mesh shape offset
3554   // tg: Returning this static here is not really a good idea, but
3555   // all this Convex code needs to be re-organized.
3556   if (nodeTransform) {
3557      static MatrixF mat;
3558      mat.mul(omat,*nodeTransform);
3559      return mat;
3560   }
3561   return omat;
3562}
3563
3564Box3F ShapeBaseConvex::getBoundingBox() const
3565{
3566   const MatrixF& omat = (transform != 0)? *transform: mObject->getTransform();
3567   return getBoundingBox(omat, mObject->getScale());
3568}
3569
3570Box3F ShapeBaseConvex::getBoundingBox(const MatrixF& mat, const Point3F& scale) const
3571{
3572   Box3F newBox = box;
3573   newBox.minExtents.convolve(scale);
3574   newBox.maxExtents.convolve(scale);
3575   mat.mul(newBox);
3576   return newBox;
3577}
3578
3579Point3F ShapeBaseConvex::support(const VectorF& v) const
3580{
3581   TSShape::ConvexHullAccelerator* pAccel =
3582      pShapeBase->mShapeInstance->getShape()->getAccelerator(pShapeBase->mDataBlock->collisionDetails[hullId]);
3583   AssertFatal(pAccel != NULL, "Error, no accel!");
3584
3585   F32 currMaxDP = mDot(pAccel->vertexList[0], v);
3586   U32 index = 0;
3587   for (U32 i = 1; i < pAccel->numVerts; i++) {
3588      F32 dp = mDot(pAccel->vertexList[i], v);
3589      if (dp > currMaxDP) {
3590         currMaxDP = dp;
3591         index = i;
3592      }
3593   }
3594
3595   return pAccel->vertexList[index];
3596}
3597
3598
3599void ShapeBaseConvex::getFeatures(const MatrixF& mat, const VectorF& n, ConvexFeature* cf)
3600{
3601   cf->material = 0;
3602   cf->mObject = mObject;
3603
3604   TSShape::ConvexHullAccelerator* pAccel =
3605      pShapeBase->mShapeInstance->getShape()->getAccelerator(pShapeBase->mDataBlock->collisionDetails[hullId]);
3606   AssertFatal(pAccel != NULL, "Error, no accel!");
3607
3608   F32 currMaxDP = mDot(pAccel->vertexList[0], n);
3609   U32 index = 0;
3610   U32 i;
3611   for (i = 1; i < pAccel->numVerts; i++) {
3612      F32 dp = mDot(pAccel->vertexList[i], n);
3613      if (dp > currMaxDP) {
3614         currMaxDP = dp;
3615         index = i;
3616      }
3617   }
3618
3619   const U8* emitString = pAccel->emitStrings[index];
3620   U32 currPos = 0;
3621   U32 numVerts = emitString[currPos++];
3622   for (i = 0; i < numVerts; i++) {
3623      cf->mVertexList.increment();
3624      U32 vListIDx = emitString[currPos++];
3625      mat.mulP(pAccel->vertexList[vListIDx], &cf->mVertexList.last());
3626   }
3627
3628   U32 numEdges = emitString[currPos++];
3629   for (i = 0; i < numEdges; i++) {
3630      U32 ev0 = emitString[currPos++];
3631      U32 ev1 = emitString[currPos++];
3632      cf->mEdgeList.increment();
3633      cf->mEdgeList.last().vertex[0] = ev0;
3634      cf->mEdgeList.last().vertex[1] = ev1;
3635   }
3636
3637   U32 numFaces = emitString[currPos++];
3638   for (i = 0; i < numFaces; i++) {
3639      cf->mFaceList.increment();
3640      U32 plane = emitString[currPos++];
3641      mat.mulV(pAccel->normalList[plane], &cf->mFaceList.last().normal);
3642      for (U32 j = 0; j < 3; j++)
3643         cf->mFaceList.last().vertex[j] = emitString[currPos++];
3644   }
3645}
3646
3647
3648void ShapeBaseConvex::getPolyList(AbstractPolyList* list)
3649{
3650   list->setTransform(&pShapeBase->getTransform(), pShapeBase->getScale());
3651   list->setObject(pShapeBase);
3652
3653   pShapeBase->mShapeInstance->animate(pShapeBase->mDataBlock->collisionDetails[hullId]);
3654   pShapeBase->mShapeInstance->buildPolyList(list,pShapeBase->mDataBlock->collisionDetails[hullId]);
3655}
3656
3657
3658//--------------------------------------------------------------------------
3659
3660bool ShapeBase::isInvincible()
3661{
3662   if( mDataBlock )
3663   {
3664      return mDataBlock->isInvincible;
3665   }
3666   return false;
3667}
3668
3669void ShapeBase::startFade( F32 fadeTime, F32 fadeDelay, bool fadeOut )
3670{
3671   setMaskBits(CloakMask);
3672   mFadeElapsedTime = 0;
3673   mFading = true;
3674   if(fadeDelay < 0)
3675      fadeDelay = 0;
3676   if(fadeTime < 0)
3677      fadeTime = 0;
3678   mFadeTime = fadeTime;
3679   mFadeDelay = fadeDelay;
3680   mFadeOut = fadeOut;
3681   mFadeVal = F32(mFadeOut);
3682}
3683
3684//--------------------------------------------------------------------------
3685
3686void ShapeBase::setShapeName(const char* name)
3687{
3688   if (!isGhost()) {
3689      if (name[0] != '\0') {
3690         // Use tags for better network performance
3691         // Should be a tag, but we'll convert to one if it isn't.
3692         if (name[0] == StringTagPrefixByte)
3693            mShapeNameHandle = NetStringHandle(U32(dAtoi(name + 1)));
3694         else
3695            mShapeNameHandle = NetStringHandle(name);
3696      }
3697      else {
3698         mShapeNameHandle = NetStringHandle();
3699      }
3700      setMaskBits(NameMask);
3701   }
3702}
3703
3704void ShapeBase::setSkinName(const char* name)
3705{
3706   if (!isGhost()) {
3707      if (name[0] != '\0') {
3708         // Use tags for better network performance
3709         // Should be a tag, but we'll convert to one if it isn't.
3710         if (name[0] == StringTagPrefixByte)
3711            mSkinNameHandle = NetStringHandle(U32(dAtoi(name + 1)));
3712         else
3713            mSkinNameHandle = NetStringHandle(name);
3714      }
3715      else
3716         mSkinNameHandle = NetStringHandle();
3717      setMaskBits(SkinMask);
3718   }
3719}
3720
3721//----------------------------------------------------------------------------
3722
3723void ShapeBase::reSkin()
3724{
3725   if (isGhost() && mShapeInstance)
3726   {
3727      if (mSkinNameHandle.isValidString())
3728      {
3729         mShapeInstance->resetMaterialList();
3730         Vector<String> skins;
3731         String(mSkinNameHandle.getString()).split(";", skins);
3732
3733         for (S32 i = 0; i < skins.size(); i++)
3734         {
3735            String oldSkin(mAppliedSkinName.c_str());
3736            String newSkin(skins[i]);
3737
3738            // Check if the skin handle contains an explicit "old" base string. This
3739            // allows all models to support skinning, even if they don't follow the 
3740            // "base_xxx" material naming convention.
3741            S32 split = newSkin.find('=');    // "old=new" format skin?
3742            if (split != String::NPos)
3743            {
3744               oldSkin = newSkin.substr(0, split);
3745               newSkin = newSkin.erase(0, split + 1);
3746            }
3747            else
3748            {
3749               oldSkin = "";
3750            }
3751            mShapeInstance->reSkin(newSkin, oldSkin);
3752            mAppliedSkinName = newSkin;
3753         }
3754      }
3755      else
3756      {
3757         mShapeInstance->reSkin("", mAppliedSkinName);
3758         mAppliedSkinName = "";
3759      }
3760   }
3761}
3762
3763void ShapeBase::setCurrentWaterObject( WaterObject *obj )
3764{
3765   if ( obj )
3766      deleteNotify( obj );
3767   if ( mCurrentWaterObject )
3768      clearNotify( mCurrentWaterObject );
3769
3770   mCurrentWaterObject = obj;
3771}
3772
3773void ShapeBase::setTransform(const MatrixF & mat)
3774{
3775   Parent::setTransform(mat);
3776
3777   // Accumulation and environment mapping
3778   if (isClientObject() && mShapeInstance)
3779   {
3780      if (mShapeInstance->hasAccumulation())
3781         AccumulationVolume::updateObject(this);
3782   }
3783}
3784
3785void ShapeBase::notifyCollisionCallbacks(SceneObject* obj, const VectorF& vel)
3786{
3787   for (S32 i = 0; i < collision_callbacks.size(); i++)
3788      if (collision_callbacks[i])
3789         collision_callbacks[i]->collisionNotify(this, obj, vel);
3790}
3791
3792void ShapeBase::registerCollisionCallback(CollisionEventCallback* ce_cb)
3793{
3794   for (S32 i = 0; i < collision_callbacks.size(); i++)
3795      if (collision_callbacks[i] == ce_cb)
3796         return;
3797
3798   collision_callbacks.push_back(ce_cb);
3799}
3800
3801void ShapeBase::unregisterCollisionCallback(CollisionEventCallback* ce_cb)
3802{
3803   for (S32 i = 0; i < collision_callbacks.size(); i++)
3804      if (collision_callbacks[i] == ce_cb)
3805      {
3806         collision_callbacks.erase(i);
3807         return;
3808      }
3809}
3810//--------------------------------------------------------------------------
3811//----------------------------------------------------------------------------
3812DefineEngineMethod( ShapeBase, setHidden, void, ( bool show ),,
3813   "@brief Add or remove this object from the scene.\n\n"
3814   "When removed from the scene, the object will not be processed or rendered.\n"
3815   "@param show False to hide the object, true to re-show it\n\n" )
3816{
3817   object->setHidden( show );
3818}
3819
3820DefineEngineMethod( ShapeBase, isHidden, bool, (),,
3821   "Check if the object is hidden.\n"
3822   "@return true if the object is hidden, false if visible.\n\n" )
3823{
3824   return object->isHidden();
3825}
3826
3827//----------------------------------------------------------------------------
3828DefineEngineMethod( ShapeBase, playAudio, bool, ( S32 slot, SFXTrack* track ),,
3829   "@brief Attach a sound to this shape and start playing it.\n\n"
3830
3831   "@param slot Audio slot index for the sound (valid range is 0 - 3)\n" // 3 = ShapeBase::MaxSoundThreads-1
3832   "@param track SFXTrack to play\n"
3833   "@return true if the sound was attached successfully, false if failed\n\n"
3834   
3835   "@see stopAudio()\n")
3836{
3837   if (track && slot >= 0 && slot < ShapeBase::MaxSoundThreads) {
3838      object->playAudio(slot,track);
3839      return true;
3840   }
3841   return false;
3842}
3843
3844DefineEngineMethod( ShapeBase, stopAudio, bool, ( S32 slot ),,
3845   "@brief Stop a sound started with playAudio.\n\n"
3846
3847   "@param slot audio slot index (started with playAudio)\n"
3848   "@return true if the sound was stopped successfully, false if failed\n\n"
3849   
3850   "@see playAudio()\n")
3851{
3852   if (slot >= 0 && slot < ShapeBase::MaxSoundThreads) {
3853      object->stopAudio(slot);
3854      return true;
3855   }
3856   return false;
3857}
3858
3859
3860//----------------------------------------------------------------------------
3861DefineEngineMethod( ShapeBase, playThread, bool, ( S32 slot, const char* name ), ( "" ),
3862   "@brief Start a new animation thread, or restart one that has been paused or "
3863   "stopped.\n\n"
3864
3865   "@param slot thread slot to play. Valid range is 0 - 3)\n"  // 3 = ShapeBase::MaxScriptThreads-1
3866   "@param name name of the animation sequence to play in this slot. If not "
3867   "specified, the paused or stopped thread in this slot will be resumed.\n"
3868   "@return true if successful, false if failed\n\n"
3869
3870   "@tsexample\n"
3871   "%obj.playThread( 0, \"ambient\" );      // Play the ambient sequence in slot 0\n"
3872   "%obj.setThreadTimeScale( 0, 0.5 );    // Play at half-speed\n"
3873   "%obj.pauseThread( 0 );                // Pause the sequence\n"
3874   "%obj.playThread( 0 );                 // Resume playback\n"
3875   "%obj.playThread( 0, \"spin\" );         // Replace the sequence in slot 0\n"
3876   "@endtsexample\n"
3877   
3878   "@see pauseThread()\n"
3879   "@see stopThread()\n"
3880   "@see setThreadDir()\n"
3881   "@see setThreadTimeScale()\n"
3882   "@see destroyThread()\n")
3883{
3884   if (slot >= 0 && slot < ShapeBase::MaxScriptThreads) {
3885      if (!dStrEqual(name, "")) {
3886         if (object->getShape()) {
3887            S32 seq = object->getShape()->findSequence(name);
3888            if (seq != -1 && object->setThreadSequence(slot,seq))
3889               return true;
3890         }
3891      }
3892      else
3893         if (object->playThread(slot))
3894            return true;
3895   }
3896   return false;
3897}
3898
3899DefineEngineMethod( ShapeBase, setThreadDir, bool, ( S32 slot, bool fwd ),,
3900   "@brief Set the playback direction of an animation thread.\n\n"
3901
3902   "@param slot thread slot to modify\n"
3903   "@param fwd true to play the animation forwards, false to play backwards\n"
3904   "@return true if successful, false if failed\n\n"
3905   
3906   "@see playThread()\n" )
3907{
3908   if (slot >= 0 && slot < ShapeBase::MaxScriptThreads) {
3909      if (object->setThreadDir(slot,fwd))
3910         return true;
3911   }
3912   return false;
3913}
3914
3915DefineEngineMethod( ShapeBase, setThreadTimeScale, bool, ( S32 slot, F32 scale ),,
3916   "@brief Set the playback time scale of an animation thread.\n\n"
3917
3918   "@param slot thread slot to modify\n"
3919   "@param scale new thread time scale (1=normal speed, 0.5=half speed etc)\n"
3920   "@return true if successful, false if failed\n\n"
3921   
3922   "@see playThread\n" )
3923{
3924   if (slot >= 0 && slot < ShapeBase::MaxScriptThreads) {
3925      if (object->setThreadTimeScale(slot,scale))
3926         return true;
3927   }
3928   return false;
3929}
3930
3931DefineEngineMethod( ShapeBase, setThreadPosition, bool, ( S32 slot, F32 pos ),,
3932   "@brief Set the position within an animation thread.\n\n"
3933
3934   "@param slot thread slot to modify\n"
3935   "@param pos position within thread\n"
3936   "@return true if successful, false if failed\n\n"
3937   
3938   "@see playThread\n" )
3939{
3940   if (slot >= 0 && slot < ShapeBase::MaxScriptThreads) {
3941      if (object->setThreadPosition(slot,pos))
3942         return true;
3943   }
3944   return false;
3945}
3946
3947DefineEngineMethod( ShapeBase, stopThread, bool, ( S32 slot ),,
3948   "@brief Stop an animation thread.\n\n"
3949
3950   "If restarted using playThread, the animation "
3951   "will start from the beginning again.\n"
3952   "@param slot thread slot to stop\n"
3953   "@return true if successful, false if failed\n\n"
3954   
3955   "@see playThread\n" )
3956{
3957   if (slot >= 0 && slot < ShapeBase::MaxScriptThreads) {
3958      if (object->stopThread(slot))
3959         return true;
3960   }
3961   return false;
3962}
3963
3964DefineEngineMethod( ShapeBase, destroyThread, bool, ( S32 slot ),,
3965   "@brief Destroy an animation thread, which prevents it from playing.\n\n"
3966
3967   "@param slot thread slot to destroy\n"
3968   "@return true if successful, false if failed\n\n"
3969   
3970   "@see playThread\n" )
3971{
3972   if (slot >= 0 && slot < ShapeBase::MaxScriptThreads) {
3973      if (object->destroyThread(slot))
3974         return true;
3975   }
3976   return false;
3977}
3978
3979DefineEngineMethod( ShapeBase, pauseThread, bool, ( S32 slot ),,
3980   "@brief Pause an animation thread.\n\n"
3981   
3982   "If restarted using playThread, the animation "
3983   "will resume from the paused position.\n"
3984   "@param slot thread slot to stop\n"
3985   "@return true if successful, false if failed\n\n"
3986   
3987   "@see playThread\n" )
3988{
3989   if (slot >= 0 && slot < ShapeBase::MaxScriptThreads) {
3990      if (object->pauseThread(slot))
3991         return true;
3992   }
3993   return false;
3994}
3995
3996//----------------------------------------------------------------------------
3997DefineEngineMethod( ShapeBase, mountImage, bool,
3998   ( ShapeBaseImageData* image, S32 slot, bool loaded, const char* skinTag ), ( true, "" ),
3999   "@brief Mount a new Image.\n\n"
4000
4001   "@param image the Image to mount\n"
4002   "@param slot Image slot to mount into (valid range is 0 - 3)\n"
4003   "@param loaded initial loaded state for the Image\n"
4004   "@param skinTag tagged string to reskin the mounted Image\n"
4005   "@return true if successful, false if failed\n\n"
4006
4007   "@tsexample\n"
4008   "%player.mountImage( PistolImage, 1 );\n"
4009   "%player.mountImage( CrossbowImage, 0, false );\n"
4010   "%player.mountImage( RocketLauncherImage, 0, true, 'blue' );\n"
4011   "@endtsexample\n"
4012   
4013   "@see unmountImage()\n"
4014   "@see getMountedImage()\n"
4015   "@see getPendingImage()\n"
4016   "@see isImageMounted()\n")
4017{
4018   if (image && slot >= 0 && slot < ShapeBase::MaxMountedImages) {
4019
4020      NetStringHandle team;
4021      if (skinTag[0] == StringTagPrefixByte)
4022         team = NetStringHandle(U32(dAtoi(skinTag+1)));
4023
4024      return object->mountImage( image, slot, loaded, team );
4025   }
4026   return false;
4027}
4028
4029DefineEngineMethod( ShapeBase, unmountImage, bool, ( S32 slot ),,
4030   "@brief Unmount the mounted Image in the specified slot.\n\n"
4031
4032   "@param slot Image slot to unmount\n"
4033   "@return true if successful, false if failed\n\n"
4034   
4035   "@see mountImage()\n")
4036{
4037   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4038      return object->unmountImage(slot);
4039   return false;
4040}
4041
4042DefineEngineMethod( ShapeBase, getMountedImage, S32, ( S32 slot ),,
4043   "@brief Get the Image mounted in the specified slot.\n\n"
4044
4045   "@param slot Image slot to query\n"
4046   "@return ID of the ShapeBaseImageData datablock mounted in the slot, or 0 "
4047   "if no Image is mounted there.\n\n" )
4048{
4049   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4050      if (ShapeBaseImageData* data = object->getMountedImage(slot))
4051         return data->getId();
4052   return 0;
4053}
4054
4055DefineEngineMethod( ShapeBase, getPendingImage, S32, ( S32 slot ),,
4056   "@brief Get the Image that will be mounted next in the specified slot.\n\n"
4057
4058   "Calling mountImage when an Image is already mounted does one of two things: "
4059   "<ol><li>Mount the new Image immediately, the old Image is discarded and "
4060   "whatever state it was in is ignored.</li>"
4061   "<li>If the current Image state does not allow Image changes, the new "
4062   "Image is marked as pending, and will not be mounted until the current "
4063   "state completes. eg. if the user changes weapons, you may wish to ensure "
4064   "that the current weapon firing state plays to completion first.</li></ol>\n"
4065   "This command retrieves the ID of the pending Image (2nd case above).\n"
4066   
4067   "@param slot Image slot to query\n"
4068   "@return ID of the pending ShapeBaseImageData datablock, or 0 if none.\n\n" )
4069{
4070   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4071      if (ShapeBaseImageData* data = object->getPendingImage(slot))
4072         return data->getId();
4073   return 0;
4074}
4075
4076DefineEngineMethod( ShapeBase, isImageFiring, bool, ( S32 slot ),,
4077   "@brief Check if the current Image state is firing.\n\n"
4078
4079   "@param slot Image slot to query\n"
4080   "@return true if the current Image state in this slot has the 'stateFire' flag set.\n" )
4081{
4082   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4083      return object->isImageFiring(slot);
4084   return false;
4085}
4086
4087DefineEngineMethod( ShapeBase, isImageMounted, bool, ( ShapeBaseImageData* image ),,
4088   "@brief Check if the given datablock is mounted to any slot on this object.\n\n"
4089
4090   "@param image ShapeBaseImageData datablock to query\n"
4091   "@return true if the Image is mounted to any slot, false otherwise.\n\n" )
4092{
4093   return (image && object->isImageMounted(image));
4094}
4095
4096DefineEngineMethod( ShapeBase, getMountSlot, S32, ( ShapeBaseImageData* image ),,
4097   "@brief Get the first slot the given datablock is mounted to on this object.\n\n"
4098
4099   "@param image ShapeBaseImageData datablock to query\n"
4100   "@return index of the first slot the Image is mounted in, or -1 if the Image "
4101   "is not mounted in any slot on this object.\n\n" )
4102
4103{
4104   return image ? object->getMountSlot(image) : -1;
4105}
4106
4107DefineEngineMethod( ShapeBase, getImageSkinTag, S32, ( S32 slot ),,
4108   "@brief Get the skin tag ID for the Image mounted in the specified slot.\n\n"
4109
4110   "@param slot Image slot to query\n"
4111   "@return the skinTag value passed to mountImage when the image was "
4112   "mounted\n\n" )
4113{
4114   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4115      return object->getImageSkinTag(slot).getIndex();
4116   return -1;
4117}
4118
4119DefineEngineMethod( ShapeBase, getImageState, const char*, ( S32 slot ),,
4120   "@brief Get the name of the current state of the Image in the specified slot.\n\n"
4121
4122   "@param slot Image slot to query\n"
4123   "@return name of the current Image state, or \"Error\" if slot is invalid\n\n" )
4124{
4125   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4126      return object->getImageState(slot);
4127   return "Error";
4128}
4129
4130DefineEngineMethod( ShapeBase, hasImageState, bool, ( S32 slot, const char* state ),,
4131   "@brief Check if the given state exists on the mounted Image.\n\n"
4132
4133   "@param slot Image slot to query\n"
4134   "@param state Image state to check for\n"
4135   "@return true if the Image has the requested state defined.\n\n" )
4136{
4137   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4138      return object->hasImageState(slot, state);
4139   return false;
4140}
4141
4142DefineEngineMethod( ShapeBase, getImageTrigger, bool, ( S32 slot ),,
4143   "@brief Get the trigger state of the Image mounted in the specified slot.\n\n"
4144
4145   "@param slot Image slot to query\n"
4146   "@return the Image's current trigger state\n\n" )
4147{
4148   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4149      return object->getImageTriggerState(slot);
4150   return false;
4151}
4152
4153DefineEngineMethod( ShapeBase, setImageTrigger, bool, ( S32 slot, bool state ),,
4154   "@brief Set the trigger state of the Image mounted in the specified slot.\n\n"
4155
4156   "@param slot Image slot to modify\n"
4157   "@param state new trigger state for the Image\n"
4158   "@return the Image's new trigger state\n\n" )
4159{
4160   if (slot >= 0 && slot < ShapeBase::MaxMountedImages) {
4161      object->setImageTriggerState(slot,state);
4162      return object->getImageTriggerState(slot);
4163   }
4164   return false;
4165}
4166
4167DefineEngineMethod( ShapeBase, getImageGenericTrigger, bool, ( S32 slot, S32 trigger ),,
4168   "@brief Get the generic trigger state of the Image mounted in the specified slot.\n\n"
4169
4170   "@param slot Image slot to query\n"
4171   "@param trigger Generic trigger number\n"
4172   "@return the Image's current generic trigger state\n\n" )
4173{
4174   if (slot >= 0 && slot < ShapeBase::MaxMountedImages && trigger >= 0 && trigger < ShapeBaseImageData::MaxGenericTriggers)
4175      return object->getImageGenericTriggerState(slot, trigger);
4176   return false;
4177}
4178
4179DefineEngineMethod( ShapeBase, setImageGenericTrigger, S32, ( S32 slot, S32 trigger, bool state ),,
4180   "@brief Set the generic trigger state of the Image mounted in the specified slot.\n\n"
4181
4182   "@param slot Image slot to modify\n"
4183   "@param trigger Generic trigger number\n"
4184   "@param state new generic trigger state for the Image\n"
4185   "@return the Image's new generic trigger state or -1 if there was a problem.\n\n" )
4186{
4187   if (slot >= 0 && slot < ShapeBase::MaxMountedImages && trigger >= 0 && trigger < ShapeBaseImageData::MaxGenericTriggers) {
4188      object->setImageGenericTriggerState(slot,trigger,state);
4189      return object->getImageGenericTriggerState(slot,trigger);
4190   }
4191   return -1;
4192}
4193
4194DefineEngineMethod( ShapeBase, getImageAltTrigger, bool, ( S32 slot ),,
4195   "@brief Get the alt trigger state of the Image mounted in the specified slot.\n\n"
4196
4197   "@param slot Image slot to query\n"
4198   "@return the Image's current alt trigger state\n\n" )
4199{
4200   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4201      return object->getImageAltTriggerState(slot);
4202   return false;
4203}
4204
4205DefineEngineMethod( ShapeBase, setImageAltTrigger, bool, ( S32 slot, bool state ),,
4206   "@brief Set the alt trigger state of the Image mounted in the specified slot.\n\n"
4207
4208   "@param slot Image slot to modify\n"
4209   "@param state new alt trigger state for the Image\n"
4210   "@return the Image's new alt trigger state\n\n" )
4211{
4212   if (slot >= 0 && slot < ShapeBase::MaxMountedImages) {
4213      object->setImageAltTriggerState(slot,state);
4214      return object->getImageAltTriggerState(slot);
4215   }
4216   return false;
4217}
4218
4219DefineEngineMethod( ShapeBase, getImageAmmo, bool, ( S32 slot ),,
4220   "@brief Get the ammo state of the Image mounted in the specified slot.\n\n"
4221
4222   "@param slot Image slot to query\n"
4223   "@return the Image's current ammo state\n\n" )
4224{
4225   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4226      return object->getImageAmmoState(slot);
4227   return false;
4228}
4229
4230DefineEngineMethod( ShapeBase, setImageAmmo, bool, ( S32 slot, bool state ),,
4231   "@brief Set the ammo state of the Image mounted in the specified slot.\n\n"
4232
4233   "@param slot Image slot to modify\n"
4234   "@param state new ammo state for the Image\n"
4235   "@return the Image's new ammo state\n\n" )
4236{
4237   if (slot >= 0 && slot < ShapeBase::MaxMountedImages) {
4238      object->setImageAmmoState(slot,state);
4239      return state;
4240   }
4241   return false;
4242}
4243
4244DefineEngineMethod( ShapeBase, getImageLoaded, bool, ( S32 slot ),,
4245   "@brief Get the loaded state of the Image mounted in the specified slot.\n\n"
4246
4247   "@param slot Image slot to query\n"
4248   "@return the Image's current loaded state\n\n" )
4249{
4250   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4251      return object->getImageLoadedState(slot);
4252   return false;
4253}
4254
4255DefineEngineMethod( ShapeBase, setImageLoaded, bool, ( S32 slot, bool state ),,
4256   "@brief Set the loaded state of the Image mounted in the specified slot.\n\n"
4257
4258   "@param slot Image slot to modify\n"
4259   "@param state new loaded state for the Image\n"
4260   "@return the Image's new loaded state\n\n" )
4261{
4262   if (slot >= 0 && slot < ShapeBase::MaxMountedImages) {
4263      object->setImageLoadedState(slot, state);
4264      return state;
4265   }
4266   return false;
4267}
4268
4269DefineEngineMethod( ShapeBase, getImageTarget, bool, ( S32 slot ),,
4270   "@brief Get the target state of the Image mounted in the specified slot.\n\n"
4271
4272   "@param slot Image slot to query\n"
4273   "@return the Image's current target state\n\n" )
4274{
4275   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4276      return object->getImageTargetState(slot);
4277   return false;
4278}
4279
4280DefineEngineMethod( ShapeBase, setImageTarget, bool, ( S32 slot, bool state ),,
4281   "@brief Set the target state of the Image mounted in the specified slot.\n\n"
4282
4283   "@param slot Image slot to modify\n"
4284   "@param state new target state for the Image\n"
4285   "@return the Image's new target state\n\n" )
4286{
4287   if (slot >= 0 && slot < ShapeBase::MaxMountedImages) {
4288      object->setImageTargetState(slot,state);
4289      return state;
4290   }
4291   return false;
4292}
4293
4294DefineEngineMethod( ShapeBase, getImageScriptAnimPrefix, const char*, ( S32 slot ),,
4295   "@brief Get the script animation prefix of the Image mounted in the specified slot.\n\n"
4296
4297   "@param slot Image slot to query\n"
4298   "@return the Image's current script animation prefix\n\n" )
4299{
4300   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4301      return object->getImageScriptAnimPrefix(slot).getString();
4302   return "";
4303}
4304
4305DefineEngineMethod( ShapeBase, setImageScriptAnimPrefix, void, ( S32 slot, const char* prefix ),,
4306   "@brief Set the script animation prefix for the Image mounted in the specified slot.\n\n"
4307   "This is used to further modify the prefix used when deciding which animation sequence to "
4308   "play while this image is mounted.\n"
4309
4310   "@param slot Image slot to modify\n"
4311   "@param prefix The prefix applied to the image\n" )
4312{
4313   if (slot >= 0 && slot < ShapeBase::MaxMountedImages) {
4314
4315      NetStringHandle prefixHandle;
4316      if (prefix[0] == StringTagPrefixByte)
4317         prefixHandle = NetStringHandle(U32(dAtoi(prefix+1)));
4318
4319      object->setImageScriptAnimPrefix(slot, prefixHandle);
4320   }
4321}
4322
4323DefineEngineMethod( ShapeBase, getMuzzleVector, VectorF, ( S32 slot ),,
4324   "@brief Get the muzzle vector of the Image mounted in the specified slot.\n\n"
4325
4326   "If the Image shape contains a node called 'muzzlePoint', then the muzzle "
4327   "vector is the forward direction vector of that node's transform in world "
4328   "space. If no such node is specified, the slot's mount node is used "
4329   "instead.\n\n"
4330
4331   "If the correctMuzzleVector flag (correctMuzzleVectorTP in 3rd person) "
4332   "is set in the Image, the muzzle vector is computed to point at whatever "
4333   "object is right in front of the object's 'eye' node.\n"
4334
4335   "@param slot Image slot to query\n"
4336   "@return the muzzle vector, or \"0 1 0\" if the slot is invalid\n\n" )
4337{
4338   VectorF vec(0, 1, 0);
4339   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4340      object->getMuzzleVector(slot, &vec);
4341
4342   return vec;
4343}
4344
4345DefineEngineMethod( ShapeBase, getMuzzlePoint, Point3F, ( S32 slot ),,
4346   "@brief Get the muzzle position of the Image mounted in the specified slot.\n\n"
4347
4348   "If the Image shape contains a node called 'muzzlePoint', then the muzzle "
4349   "position is the position of that node in world space. If no such node "
4350   "is specified, the slot's mount node is used instead.\n"
4351
4352   "@param slot Image slot to query\n"
4353   "@return the muzzle position, or \"0 0 0\" if the slot is invalid\n\n" )
4354{
4355   Point3F pos(0, 0, 0);
4356   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4357      object->getMuzzlePoint(slot, &pos);
4358
4359   return pos;
4360}
4361
4362DefineEngineMethod( ShapeBase, getSlotTransform, TransformF, ( S32 slot ),,
4363   "@brief Get the world transform of the specified mount slot.\n\n"
4364
4365   "@param slot Image slot to query\n"
4366   "@return the mount transform\n\n" )
4367{
4368   MatrixF xf(true);
4369   if (slot >= 0 && slot < ShapeBase::MaxMountedImages)
4370      object->getMountTransform( slot, MatrixF::Identity, &xf );
4371
4372   return xf;
4373}
4374
4375//----------------------------------------------------------------------------
4376
4377DefineEngineMethod( ShapeBase, getAIRepairPoint, Point3F, (),,
4378   "@brief Get the position at which the AI should stand to repair things.\n\n"
4379
4380   "If the shape defines a node called \"AIRepairNode\", this method will "
4381   "return the current world position of that node, otherwise \"0 0 0\".\n"
4382   "@return the AI repair position\n\n" )
4383{
4384   return object->getAIRepairPoint();
4385}
4386
4387DefineEngineMethod( ShapeBase, getVelocity, VectorF, (),,
4388   "@brief Get the object's current velocity.\n\n"
4389
4390   "@return the current velocity\n\n" )
4391{
4392   return object->getVelocity();
4393}
4394
4395DefineEngineMethod( ShapeBase, setVelocity, bool, ( Point3F vel ),,
4396   "@brief Set the object's velocity.\n\n"
4397
4398   "@param vel new velocity for the object\n"
4399   "@return true\n\n" )
4400{
4401   object->setVelocity( vel );
4402   return true;
4403}
4404
4405DefineEngineMethod( ShapeBase, applyImpulse, bool, ( Point3F pos, Point3F vec ),,
4406   "@brief Apply an impulse to the object.\n\n"
4407
4408   "@param pos world position of the impulse\n"
4409   "@param vec impulse momentum (velocity * mass)\n"
4410   "@return true\n\n" )
4411{
4412   object->applyImpulse( pos, vec );
4413   return true;
4414}
4415
4416DefineEngineMethod( ShapeBase, getEyeVector, VectorF, (),,
4417   "@brief Get the forward direction of the 'eye' for this object.\n\n"
4418
4419   "If the object model has a node called 'eye', this method will return that "
4420   "node's current forward direction vector, otherwise it will return the "
4421   "object's current forward direction vector.\n"
4422
4423   "@return the eye vector for this object\n"
4424
4425   "@see getEyePoint\n"
4426   "@see getEyeTransform\n" )
4427{
4428   MatrixF mat;
4429   object->getEyeTransform(&mat);
4430   return mat.getForwardVector();
4431}
4432
4433DefineEngineMethod( ShapeBase, getEyePoint, Point3F, (),,
4434   "@brief Get the position of the 'eye' for this object.\n\n"
4435
4436   "If the object model has a node called 'eye', this method will return that "
4437   "node's current world position, otherwise it will return the object's current "
4438   "world position.\n"
4439
4440   "@return the eye position for this object\n"
4441
4442   "@see getEyeVector\n"
4443   "@see getEyeTransform\n" )
4444{
4445   MatrixF mat;
4446   object->getEyeTransform(&mat);
4447   return mat.getPosition();
4448}
4449
4450DefineEngineMethod( ShapeBase, getEyeTransform, TransformF, (),,
4451   "@brief Get the 'eye' transform for this object.\n\n"
4452
4453   "If the object model has a node called 'eye', this method will return that "
4454   "node's current transform, otherwise it will return the object's current "
4455   "transform.\n"
4456
4457   "@return the eye transform for this object\n"
4458
4459   "@see getEyeVector\n"
4460   "@see getEyePoint\n" )
4461{
4462   MatrixF mat;
4463   object->getEyeTransform(&mat);
4464   return mat;
4465}
4466
4467DefineEngineMethod( ShapeBase, getLookAtPoint, const char*, ( F32 distance, U32 typeMask ), ( 2000, 0xFFFFFFFF ),
4468   "@brief Get the world position this object is looking at.\n\n"
4469
4470   "Casts a ray from the eye and returns information about what the ray hits.\n"
4471
4472   "@param distance maximum distance of the raycast\n"
4473   "@param typeMask typeMask of objects to include for raycast collision testing\n"
4474   "@return look-at information as \"Object HitX HitY HitZ [Material]\" or empty string for no hit\n\n"
4475
4476   "@tsexample\n"
4477   "%lookat = %obj.getLookAtPoint();\n"
4478   "echo( \"Looking at: \" @ getWords( %lookat, 1, 3 ) );\n"
4479   "@endtsexample\n" )
4480{
4481   MatrixF mat;
4482   object->getEyeTransform( &mat );
4483   
4484   // Get eye vector.
4485   
4486   VectorF eyeVector;
4487   mat.getColumn( 1, &eyeVector );
4488   
4489   // Get eye position.
4490   
4491   VectorF eyePos;
4492   mat.getColumn( 3, &eyePos );
4493   
4494   // Make sure the eye vector covers the distance.
4495   
4496   eyeVector *= distance;
4497   
4498   // Do a container search.
4499   
4500   VectorF start = eyePos;
4501   VectorF end = eyePos + eyeVector;
4502   
4503   RayInfo ri;
4504   if( !gServerContainer.castRay( start, end, typeMask, &ri ) || !ri.object )
4505      return ""; // No hit.
4506   
4507   // Gather hit info.
4508      
4509   enum { BUFFER_SIZE = 256 };
4510   char* buffer = Con::getReturnBuffer( BUFFER_SIZE );
4511   if( ri.material )
4512      dSprintf( buffer, BUFFER_SIZE, "%u %f %f %f %u",
4513         ri.object->getId(),
4514         ri.point.x,
4515         ri.point.y,
4516         ri.point.z,
4517         ri.material->getMaterial()->getId() );
4518   else
4519      dSprintf( buffer, BUFFER_SIZE, "%u %f %f %f",
4520         ri.object->getId(),
4521         ri.point.x,
4522         ri.point.y,
4523         ri.point.z );
4524
4525   return buffer;
4526}
4527
4528DefineEngineMethod( ShapeBase, setEnergyLevel, void, ( F32 level ),,
4529   "@brief Set this object's current energy level.\n\n"
4530
4531   "@param level new energy level\n"
4532   
4533   "@see getEnergyLevel()\n"
4534   "@see getEnergyPercent()\n")
4535{
4536   object->setEnergyLevel( level );
4537}
4538
4539DefineEngineMethod( ShapeBase, getEnergyLevel, F32, (),,
4540   "@brief Get the object's current energy level.\n\n"
4541
4542   "@return energy level\n"
4543   
4544   "@see setEnergyLevel()\n")
4545{
4546   return object->getEnergyLevel();
4547}
4548
4549DefineEngineMethod( ShapeBase, getEnergyPercent, F32, (),,
4550   "@brief Get the object's current energy level as a percentage of maxEnergy.\n\n"
4551   "@return energyLevel / datablock.maxEnergy\n"
4552
4553   "@see setEnergyLevel()\n")
4554{
4555   return object->getEnergyValue();
4556}
4557
4558DefineEngineMethod( ShapeBase, setDamageLevel, void, ( F32 level ),,
4559   "@brief Set the object's current damage level.\n\n"
4560
4561   "@param level new damage level\n"
4562   
4563   "@see getDamageLevel()\n"
4564   "@see getDamagePercent()\n")
4565{
4566   object->setDamageLevel( level );
4567}
4568
4569DefineEngineMethod( ShapeBase, getDamageLevel, F32, (),,
4570   "@brief Get the object's current damage level.\n\n"
4571
4572   "@return damage level\n"
4573   
4574   "@see setDamageLevel()\n")
4575{
4576   return object->getDamageLevel();
4577}
4578
4579DefineEngineMethod( ShapeBase, getDamagePercent, F32, (),,
4580   "@brief Get the object's current damage level as a percentage of maxDamage.\n\n"
4581
4582   "@return damageLevel / datablock.maxDamage\n"
4583   
4584   "@see setDamageLevel()\n")
4585{
4586   return object->getDamageValue();
4587}
4588  
4589DefineEngineMethod(ShapeBase, getMaxDamage, F32, (),,   
4590   "Get the object's maxDamage level.\n"  
4591   "@return datablock.maxDamage\n")    
4592{    
4593   return object->getMaxDamage();    
4594}  
4595
4596DefineEngineMethod( ShapeBase, setDamageState, bool, ( const char* state ),,
4597   "@brief Set the object's damage state.\n\n"
4598
4599   "@param state should be one of \"Enabled\", \"Disabled\", \"Destroyed\"\n"
4600   "@return true if successful, false if failed\n"
4601   
4602   "@see getDamageState()\n")
4603{
4604   return object->setDamageState( state );
4605}
4606
4607DefineEngineMethod( ShapeBase, getDamageState, const char*, (),,
4608   "@brief Get the object's damage state.\n\n"
4609
4610   "@return the damage state; one of \"Enabled\", \"Disabled\", \"Destroyed\"\n"
4611   
4612   "@see setDamageState()\n")
4613{
4614   return object->getDamageStateName();
4615}
4616
4617DefineEngineMethod( ShapeBase, isDestroyed, bool, (),,
4618   "@brief Check if the object is in the Destroyed damage state.\n\n"
4619
4620   "@return true if damage state is \"Destroyed\", false if not\n" 
4621   
4622   "@see isDisabled()\n"
4623   "@see isEnabled()\n")
4624{
4625   return object->isDestroyed();
4626}
4627
4628DefineEngineMethod( ShapeBase, isDisabled, bool, (),,
4629   "@brief Check if the object is in the Disabled or Destroyed damage state.\n\n"
4630
4631   "@return true if damage state is not \"Enabled\", false if it is\n"
4632   
4633   "@see isDestroyed()\n"
4634   "@see isEnabled()\n")
4635{
4636   return object->getDamageState() != ShapeBase::Enabled;
4637}
4638
4639DefineEngineMethod( ShapeBase, isEnabled, bool, (),,
4640   "@brief Check if the object is in the Enabled damage state.\n\n"
4641
4642   "@return true if damage state is \"Enabled\", false if not\n"
4643   
4644   "@see isDestroyed()\n"
4645   "@see isDisabled()\n")
4646{
4647   return object->getDamageState() == ShapeBase::Enabled;
4648}
4649
4650DefineEngineMethod(ShapeBase, blowUp, void, (),, "@brief Explodes an object into pieces.")
4651{
4652   object->blowUp();
4653}
4654
4655DefineEngineMethod( ShapeBase, applyDamage, void, ( F32 amount ),,
4656   "@brief Increment the current damage level by the specified amount.\n\n"
4657
4658   "@param amount value to add to current damage level\n" )
4659{
4660   object->applyDamage( amount );
4661}
4662
4663DefineEngineMethod( ShapeBase, applyRepair, void, ( F32 amount ),,
4664   "@brief Repair damage by the specified amount.\n\n"
4665
4666   "Note that the damage level is only reduced by repairRate per tick, so it may "
4667   "take several ticks for the total repair to complete.\n"
4668
4669   "@param amount total repair value (subtracted from damage level over time)\n" )
4670{
4671   object->applyRepair( amount );
4672}
4673
4674DefineEngineMethod( ShapeBase, setRepairRate, void, ( F32 rate ),,
4675   "@brief Set amount to repair damage by each tick.\n\n"
4676
4677   "Note that this value is separate to the repairRate field in ShapeBaseData. "
4678   "This value will be subtracted from the damage level each tick, whereas the "
4679   "ShapeBaseData field limits how much of the applyRepair value is subtracted "
4680   "each tick. Both repair types can be active at the same time.\n"
4681   
4682   "@param rate value to subtract from damage level each tick (must be > 0)\n"
4683   
4684   "@see getRepairRate()\n")
4685{
4686   if(rate < 0)
4687      rate = 0;
4688   object->setRepairRate( rate );
4689}
4690
4691DefineEngineMethod( ShapeBase, getRepairRate, F32, (),,
4692   "@brief Get the per-tick repair amount.\n\n"
4693
4694   "@return the current value to be subtracted from damage level each tick\n"
4695
4696   "@see setRepairRate\n" )
4697{
4698   return object->getRepairRate();
4699}
4700
4701DefineEngineMethod( ShapeBase, setRechargeRate, void, ( F32 rate ),,
4702   "@brief Set the recharge rate.\n\n"
4703
4704   "The recharge rate is added to the object's current energy level each tick, "
4705   "up to the maxEnergy level set in the ShapeBaseData datablock.\n"
4706   
4707   "@param rate the recharge rate (per tick)\n"
4708   
4709   "@see getRechargeRate()\n")
4710{
4711   object->setRechargeRate( rate );
4712}
4713
4714DefineEngineMethod( ShapeBase, getRechargeRate, F32, (),,
4715   "@brief Get the current recharge rate.\n\n"
4716
4717   "@return the recharge rate (per tick)\n"
4718   
4719   "@see setRechargeRate()\n")
4720{
4721   return object->getRechargeRate();
4722}
4723
4724DefineEngineMethod( ShapeBase, getControllingClient, S32, (),,
4725   "@brief Get the client (if any) that controls this object.\n\n"
4726
4727   "The controlling client is the one that will send moves to us to act on.\n"
4728
4729   "@return the ID of the controlling GameConnection, or 0 if this object is not "
4730   "controlled by any client.\n"
4731   
4732   "@see GameConnection\n")
4733{
4734   if (GameConnection* con = object->getControllingClient())
4735      return con->getId();
4736   return 0;
4737}
4738
4739DefineEngineMethod( ShapeBase, getControllingObject, S32, (),,
4740   "@brief Get the object (if any) that controls this object.\n\n"
4741
4742   "@return the ID of the controlling ShapeBase object, or 0 if this object is "
4743   "not controlled by another object.\n" )
4744{
4745   if (ShapeBase* con = object->getControllingObject())
4746      return con->getId();
4747   return 0;
4748}
4749
4750DefineEngineMethod( ShapeBase, canCloak, bool, (),,
4751   "@brief Check if this object can cloak.\n\n"
4752   "@return true\n"
4753   
4754   "@note Not implemented as it always returns true.")
4755{
4756   return true;
4757}
4758
4759DefineEngineMethod( ShapeBase, setCloaked, void, ( bool cloak ),,
4760   "@brief Set the cloaked state of this object.\n\n"
4761
4762   "When an object is cloaked it is not rendered.\n"
4763
4764   "@param cloak true to cloak the object, false to uncloak\n"
4765   
4766   "@see isCloaked()\n")
4767{
4768   if (object->isServerObject())
4769      object->setCloakedState( cloak );
4770}
4771
4772DefineEngineMethod( ShapeBase, isCloaked, bool, (),,
4773   "@brief Check if this object is cloaked.\n\n"
4774
4775   "@return true if cloaked, false if not\n" 
4776   
4777   "@see setCloaked()\n")
4778{
4779   return object->getCloakedState();
4780}
4781
4782DefineEngineMethod( ShapeBase, setDamageFlash, void, ( F32 level ),,
4783   "@brief Set the damage flash level.\n\n"
4784
4785   "Damage flash may be used as a postfx effect to flash the screen when the "
4786   "client is damaged.\n"
4787
4788   "@note Relies on the flash postFx.\n"
4789
4790   "@param level flash level (0-1)\n"
4791   
4792   "@see getDamageFlash()\n")
4793{
4794   if (object->isServerObject())
4795      object->setDamageFlash( level );
4796}
4797
4798DefineEngineMethod( ShapeBase, getDamageFlash, F32, (),,
4799   "@brief Get the damage flash level.\n\n"
4800
4801   "@return flash level\n"
4802
4803   "@see setDamageFlash\n" )
4804{
4805   return object->getDamageFlash();
4806}
4807
4808DefineEngineMethod( ShapeBase, setWhiteOut, void, ( F32 level ),,
4809   "@brief Set the white-out level.\n\n"
4810
4811   "White-out may be used as a postfx effect to brighten the screen in response "
4812   "to a game event.\n"
4813
4814   "@note Relies on the flash postFx.\n"
4815
4816   "@param level flash level (0-1)\n"
4817   
4818   "@see getWhiteOut()\n")
4819{
4820   if (object->isServerObject())
4821      object->setWhiteOut( level );
4822}
4823
4824DefineEngineMethod( ShapeBase, getWhiteOut, F32, (),,
4825   "@brief Get the white-out level.\n\n"
4826
4827   "@return white-out level\n"
4828
4829   "@see setWhiteOut\n" )
4830{
4831   return object->getWhiteOut();
4832}
4833
4834DefineEngineMethod( ShapeBase, getDefaultCameraFov, F32, (),,
4835   "@brief Returns the default vertical field of view in degrees for this object if used as a camera.\n\n"
4836
4837   "@return Default FOV\n" )
4838{
4839   if (object->isServerObject())
4840      return object->getDefaultCameraFov();
4841   return 0.0;
4842}
4843
4844DefineEngineMethod( ShapeBase, getCameraFov, F32, (),,
4845   "@brief Returns the vertical field of view in degrees for this object if used as a camera.\n\n"
4846
4847   "@return current FOV as defined in ShapeBaseData::cameraDefaultFov\n" )
4848{
4849   if (object->isServerObject())
4850      return object->getCameraFov();
4851   return 0.0;
4852}
4853
4854DefineEngineMethod( ShapeBase, setCameraFov, void, ( F32 fov ),,
4855   "@brief Set the vertical field of view in degrees for this object if used as a camera.\n\n"
4856
4857   "@param fov new FOV value\n" )
4858{
4859   if (object->isServerObject())
4860      object->setCameraFov( fov );
4861}
4862
4863DefineEngineMethod( ShapeBase, startFade, void, ( S32 time, S32 delay, bool fadeOut ),,
4864   "@brief Fade the object in or out without removing it from the scene.\n\n"
4865
4866   "A faded out object is still in the scene and can still be collided with, "
4867   "so if you want to disable collisions for this shape after it fades out "
4868   "use setHidden to temporarily remove this shape from the scene.\n"
4869  
4870   "@note Items have the ability to light their surroundings. When an Item with "
4871   "an active light is fading out, the light it emits is correspondingly "
4872   "reduced until it goes out. Likewise, when the item fades in, the light is "
4873   "turned-up till it reaches it's normal brightntess.\n"
4874
4875   "@param time duration of the fade effect in ms\n"
4876   "@param delay delay in ms before the fade effect begins\n"
4877   "@param fadeOut true to fade-out to invisible, false to fade-in to full visibility\n" )
4878{
4879   object->startFade( (F32)time / (F32)1000.0, delay / 1000.0, fadeOut );
4880}
4881
4882DefineEngineMethod( ShapeBase, setDamageVector, void, ( Point3F vec ),,
4883   "@brief Set the damage direction vector.\n\n"
4884
4885   "Currently this is only used to initialise the explosion if this object "
4886   "is blown up.\n"
4887
4888   "@param vec damage direction vector\n\n"
4889
4890   "@tsexample\n"
4891   "%obj.setDamageVector( \"0 0 1\" );\n"
4892   "@endtsexample\n" )
4893{
4894   vec.normalize();
4895   object->setDamageDir( vec );
4896}
4897
4898DefineEngineMethod( ShapeBase, setShapeName, void, ( const char* name ),,
4899   "@brief Set the name of this shape.\n\n"
4900
4901   "@note This is the name of the shape object that is sent to the client, "
4902   "not the DTS or DAE model filename.\n"
4903
4904   "@param name new name for the shape\n\n"
4905   
4906   "@see getShapeName()\n")
4907{
4908   object->setShapeName( name );
4909}
4910
4911DefineEngineMethod( ShapeBase, getShapeName, const char*, (),,
4912   "@brief Get the name of the shape.\n\n"
4913
4914   "@note This is the name of the shape object that is sent to the client, "
4915   "not the DTS or DAE model filename.\n"
4916
4917   "@return the name of the shape\n\n" 
4918   
4919   "@see setShapeName()\n")
4920{
4921   return object->getShapeName();
4922}
4923
4924DefineEngineMethod( ShapeBase, setSkinName, void, ( const char* name ),,
4925   "@brief Apply a new skin to this shape.\n\n"
4926
4927   "'Skinning' the shape effectively renames the material targets, allowing "
4928   "different materials to be used on different instances of the same model.\n\n"
4929
4930   "@param name name of the skin to apply\n\n"
4931
4932   "@see skin\n"
4933   "@see getSkinName()\n")
4934{
4935   object->setSkinName( name );
4936}
4937
4938DefineEngineMethod( ShapeBase, getSkinName, const char*, (),,
4939   "@brief Get the name of the skin applied to this shape.\n\n"
4940
4941   "@return the name of the skin\n\n" 
4942
4943   "@see skin\n"
4944   "@see setSkinName()\n")
4945{
4946   return object->getSkinName();
4947}
4948
4949//----------------------------------------------------------------------------
4950void ShapeBase::consoleInit()
4951{
4952   Con::addVariable("SB::DFDec", TypeF32, &sDamageFlashDec, "Speed to reduce the damage flash effect per tick.\n\n"
4953      "@see ShapeBase::setDamageFlash()\n"
4954      "@see ShapeBase::getDamageFlash()\n"
4955      "@note Relies on the flash postFx.\n"
4956      "@ingroup gameObjects\n");
4957   Con::addVariable("SB::WODec", TypeF32, &sWhiteoutDec, "Speed to reduce the whiteout effect per tick.\n\n"
4958      "@see ShapeBase::setWhiteOut()\n"
4959      "@see ShapeBase::getWhiteOut"
4960      "@note Relies on the flash postFx.\n"
4961      "@ingroup gameObjects\n");
4962   Con::addVariable("SB::FullCorrectionDistance", TypeF32, &sFullCorrectionDistance, 
4963      "@brief Distance at which a weapon's muzzle vector is fully corrected to match where the player is looking.\n\n"
4964      "When a weapon image has correctMuzzleVector set and the Player is in 1st person, the muzzle vector from the "
4965      "weapon is modified to match where the player is looking.  Beyond the FullCorrectionDistance the muzzle vector "
4966      "is always corrected.  Between FullCorrectionDistance and the player, the weapon's muzzle vector is adjusted so that "
4967      "the closer the aim point is to the player, the closer the muzzle vector is to the true (non-corrected) one.\n"
4968      "@ingroup gameObjects\n");
4969   Con::addVariable("SB::CloakSpeed", TypeF32, &sCloakSpeed, 
4970      "@brief Time to cloak, in seconds.\n\n"
4971      "@ingroup gameObjects\n");
4972}
4973
4974void ShapeBase::_updateHiddenMeshes()
4975{
4976   if ( !mShapeInstance )
4977      return;
4978
4979   // This may happen at some point in the future... lets
4980   // detect it so that it can be fixed at that time.
4981   AssertFatal( mMeshHidden.getSize() == mShapeInstance->mMeshObjects.size(),
4982      "ShapeBase::_updateMeshVisibility() - Mesh visibility size mismatch!" );
4983
4984   for ( U32 i = 0; i < mMeshHidden.getSize(); i++ )
4985      setMeshHidden( i, mMeshHidden.test( i ) );
4986}
4987
4988void ShapeBase::setMeshHidden( const char *meshName, bool forceHidden )
4989{
4990   setMeshHidden( mDataBlock->mShape->findObject( meshName ), forceHidden );
4991}
4992
4993void ShapeBase::setMeshHidden( S32 meshIndex, bool forceHidden )
4994{
4995   if ( meshIndex == -1 || meshIndex >= mMeshHidden.getSize() )
4996      return;
4997
4998   if ( forceHidden )
4999      mMeshHidden.set( meshIndex );   
5000   else
5001      mMeshHidden.clear( meshIndex );   
5002
5003   if ( mShapeInstance )
5004      mShapeInstance->setMeshForceHidden( meshIndex, forceHidden );
5005
5006   setMaskBits( MeshHiddenMask );
5007}
5008
5009void ShapeBase::setAllMeshesHidden( bool forceHidden )
5010{
5011   if ( forceHidden )
5012      mMeshHidden.set();
5013   else
5014      mMeshHidden.clear();
5015
5016   if ( mShapeInstance )
5017   {
5018      for ( U32 i = 0; i < mMeshHidden.getSize(); i++ )
5019         mShapeInstance->setMeshForceHidden( i, forceHidden );
5020   }
5021
5022   setMaskBits( MeshHiddenMask );
5023}
5024
5025DefineEngineMethod( ShapeBase, setAllMeshesHidden, void, ( bool hide ),,
5026   "@brief Set the hidden state on all the shape meshes.\n\n"
5027
5028   "This allows you to hide all meshes in the shape, for example, and then only "
5029   "enable a few.\n"
5030
5031   "@param hide new hidden state for all meshes\n\n" )
5032{
5033   object->setAllMeshesHidden( hide );
5034}
5035
5036DefineEngineMethod( ShapeBase, setMeshHidden, void, ( const char* name, bool hide ),,
5037   "@brief Set the hidden state on the named shape mesh.\n\n"
5038
5039   "@param name name of the mesh to hide/show\n"
5040   "@param hide new hidden state for the mesh\n\n" )
5041{
5042   object->setMeshHidden( name, hide );
5043}
5044
5045// Some development-handy functions
5046#ifndef TORQUE_SHIPPING
5047
5048void ShapeBase::dumpMeshVisibility()
5049{
5050   if ( !mShapeInstance )
5051      return;
5052
5053   const Vector<TSShapeInstance::MeshObjectInstance> &meshes = mShapeInstance->mMeshObjects;
5054
5055   for ( U32 i = 0; i < meshes.size(); i++)
5056   {
5057      const TSShapeInstance::MeshObjectInstance &mesh = meshes[i];
5058
5059      const String &meshName = mDataBlock->mShape->getMeshName( i );
5060
5061      Con::printf( "%d - %s - forceHidden = %s, visibility = %f", 
5062         i,
5063         meshName.c_str(),
5064         mesh.forceHidden ? "true" : "false",
5065         mesh.visible );
5066   }
5067}
5068
5069DefineEngineMethod( ShapeBase, dumpMeshVisibility, void, (),,
5070   "@brief Print a list of visible and hidden meshes in the shape to the console "
5071   "for debugging purposes.\n\n"
5072   "@note Only in a SHIPPING build.\n")
5073{
5074   object->dumpMeshVisibility();
5075}
5076
5077#endif // #ifndef TORQUE_SHIPPING
5078
5079//------------------------------------------------------------------------
5080//These functions are duplicated in tsStatic and shapeBase.
5081//They each function a little differently; but achieve the same purpose of gathering
5082//target names/counts without polluting simObject.
5083
5084DefineEngineMethod( ShapeBase, getTargetName, const char*, ( S32 index ),,
5085   "@brief Get the name of the indexed shape material.\n\n"
5086
5087   "@param index index of the material to get (valid range is 0 - getTargetCount()-1).\n"
5088   "@return the name of the indexed material.\n\n"
5089   
5090   "@see getTargetCount()\n")
5091{
5092   ShapeBase *obj = dynamic_cast< ShapeBase* > ( object );
5093   if(obj)
5094   {
5095      // Try to use the client object (so we get the reskinned targets in the Material Editor)
5096      if ((ShapeBase*)obj->getClientObject())
5097         obj = (ShapeBase*)obj->getClientObject();
5098
5099      return obj->getShapeInstance()->getTargetName(index);
5100   }
5101
5102   return "";
5103}
5104
5105DefineEngineMethod( ShapeBase, getTargetCount, S32, (),,
5106   "@brief Get the number of materials in the shape.\n\n"
5107
5108   "@return the number of materials in the shape.\n\n" 
5109   
5110   "@see getTargetName()\n")
5111{
5112   ShapeBase *obj = dynamic_cast< ShapeBase* > ( object );
5113   if(obj)
5114   {
5115      // Try to use the client object (so we get the reskinned targets in the Material Editor)
5116      if ((ShapeBase*)obj->getClientObject())
5117         obj = (ShapeBase*)obj->getClientObject();
5118
5119      if (obj->getShapeInstance() != NULL)
5120         return obj->getShapeInstance()->getTargetCount();
5121   }
5122   
5123   return -1;
5124}
5125
5126DefineEngineMethod( ShapeBase, changeMaterial, void, ( const char* mapTo, Material* oldMat, Material* newMat ),,
5127   "@brief Change one of the materials on the shape.\n\n"
5128
5129   "This method changes materials per mapTo with others. The material that "
5130   "is being replaced is mapped to unmapped_mat as a part of this transition.\n"
5131
5132   "@note Warning, right now this only sort of works. It doesn't do a live "
5133   "update like it should.\n"
5134
5135   "@param mapTo the name of the material target to remap (from getTargetName)\n"
5136   "@param oldMat the old Material that was mapped \n"
5137   "@param newMat the new Material to map\n\n"
5138
5139   "@tsexample\n"
5140   "// remap the first material in the shape\n"
5141   "%mapTo = %obj.getTargetName( 0 );\n"
5142   "%obj.changeMaterial( %mapTo, 0, MyMaterial );\n"
5143   "@endtsexample\n" )
5144{
5145   // if no valid new material, theres no reason for doing this
5146   if( !newMat )
5147   {
5148      Con::errorf("ShapeBase::changeMaterial failed: New material does not exist!");
5149      return;
5150   }
5151
5152   // initilize server/client versions
5153   ShapeBase *serverObj = object;
5154   ShapeBase *clientObj = dynamic_cast< ShapeBase* > ( object->getClientObject() );
5155
5156   // Check the mapTo name exists for this shape
5157   S32 matIndex = serverObj->getShape()->materialList->getMaterialNameList().find_next(String(mapTo));
5158   if (matIndex < 0)
5159   {
5160      Con::errorf("ShapeBase::changeMaterial failed: Invalid mapTo name '%s'", mapTo);
5161      return;
5162   }
5163
5164   // Lets remap the old material off, so as to let room for our current material room to claim its spot
5165   if( oldMat )
5166      oldMat->mMapTo = String("unmapped_mat");
5167
5168   newMat->mMapTo = mapTo;
5169
5170   // Map the material by name in the matmgr
5171   MATMGR->mapMaterial( mapTo, newMat->getName() );
5172
5173   // Replace instances with the new material being traded in. For ShapeBase
5174   // class we have to update the server/client objects separately so both
5175   // represent our changes
5176   delete serverObj->getShape()->materialList->mMatInstList[matIndex];
5177   serverObj->getShape()->materialList->mMatInstList[matIndex] = newMat->createMatInstance();
5178   if (clientObj)
5179   {
5180      delete clientObj->getShape()->materialList->mMatInstList[matIndex];
5181      clientObj->getShape()->materialList->mMatInstList[matIndex] = newMat->createMatInstance();
5182   }
5183
5184   // Finish up preparing the material instances for rendering
5185   const GFXVertexFormat *flags = getGFXVertexFormat<GFXVertexPNTTB>();
5186   FeatureSet features = MATMGR->getDefaultFeatures();
5187
5188   serverObj->getShape()->materialList->getMaterialInst(matIndex)->init( features, flags );
5189   if (clientObj)
5190      clientObj->getShapeInstance()->mMaterialList->getMaterialInst(matIndex)->init( features, flags );
5191}
5192
5193DefineEngineMethod( ShapeBase, getModelFile, const char *, (),,
5194   "@brief Get the model filename used by this shape.\n\n"
5195
5196   "@return the shape filename\n\n" )
5197{
5198   GameBaseData * datablock = object->getDataBlock();
5199   if( !datablock )
5200      return String::EmptyString;
5201
5202   const char *fieldName = StringTable->insert( String("shapeFile") );
5203   return datablock->getDataField( fieldName, NULL );
5204}
5205
5206
5207U32 ShapeBase::unique_anim_tag_counter = 1;
5208
5209U32 ShapeBase::playBlendAnimation(S32 seq_id, F32 pos, F32 rate)
5210{
5211   BlendThread blend_clip; 
5212   blend_clip.tag = ((unique_anim_tag_counter++) | BLENDED_CLIP);
5213   blend_clip.thread = 0;
5214
5215   if (isClientObject())
5216   {
5217      blend_clip.thread = mShapeInstance->addThread();
5218      mShapeInstance->setSequence(blend_clip.thread, seq_id, pos);
5219      mShapeInstance->setTimeScale(blend_clip.thread, rate);
5220   }
5221
5222   blend_clips.push_back(blend_clip);
5223
5224   return blend_clip.tag;
5225}
5226
5227void ShapeBase::restoreBlendAnimation(U32 tag)
5228{
5229   for (S32 i = 0; i < blend_clips.size(); i++)
5230   {
5231      if (blend_clips[i].tag == tag)
5232      {
5233         if (blend_clips[i].thread)
5234         {
5235            mShapeInstance->destroyThread(blend_clips[i].thread);
5236         }
5237         blend_clips.erase_fast(i);
5238         break;
5239      }
5240   }
5241}
5242
5243//
5244
5245void ShapeBase::restoreAnimation(U32 tag)
5246{
5247   if (!isClientObject())
5248      return;
5249
5250   // check if this is a blended clip
5251   if ((tag & BLENDED_CLIP) != 0)
5252   {
5253      restoreBlendAnimation(tag);
5254      return;
5255   }
5256
5257   if (tag != 0 && tag == last_anim_tag)
5258   {
5259      anim_clip_flags &= ~(ANIM_OVERRIDDEN | IS_DEATH_ANIM);
5260
5261      stopThread(0);
5262
5263      if (saved_seq_id != -1)
5264      {
5265         setThreadSequence(0, saved_seq_id);
5266         setThreadPosition(0, saved_pos);
5267         setThreadTimeScale(0, saved_rate);
5268         setThreadDir(0, (saved_rate >= 0));
5269         playThread(0);
5270
5271         saved_seq_id = -1;
5272         saved_pos = 0.0f;
5273         saved_rate = 1.0f;
5274      }
5275
5276      last_anim_tag = 0;
5277      last_anim_id = -1;
5278   }
5279}
5280
5281U32 ShapeBase::getAnimationID(const char* name)
5282{
5283   const TSShape* ts_shape = getShape();
5284   S32 seq_id = (ts_shape) ? ts_shape->findSequence(name) : -1;
5285   return (seq_id >= 0) ? (U32) seq_id : BAD_ANIM_ID;
5286}
5287
5288U32 ShapeBase::playAnimationByID(U32 anim_id, F32 pos, F32 rate, F32 trans, bool hold, bool wait, bool is_death_anim)
5289{
5290   if (!isClientObject())
5291      return 0;
5292
5293   if (anim_id == BAD_ANIM_ID)
5294      return 0;
5295
5296   const TSShape* ts_shape = getShape();
5297   if (!ts_shape)
5298      return 0;
5299
5300   S32 seq_id = (S32) anim_id;
5301   if (mShapeInstance->getShape()->sequences[seq_id].isBlend())
5302      return playBlendAnimation(seq_id, pos, rate);
5303
5304   if (last_anim_tag == 0)
5305   {
5306      // try to save state of playing animation
5307      Thread& st = mScriptThread[0];
5308      if (st.sequence != -1)
5309      {
5310         saved_seq_id = st.sequence;
5311         saved_pos = st.position;
5312         saved_rate = st.timescale;
5313      }
5314   }
5315
5316   // START OR TRANSITION TO SEQUENCE HERE
5317   setThreadSequence(0, seq_id);
5318   setThreadPosition(0, pos);
5319   setThreadTimeScale(0, rate);
5320   setThreadDir(0, (rate >= 0));
5321   playThread(0);
5322
5323   if (is_death_anim)
5324      anim_clip_flags |= IS_DEATH_ANIM;
5325   else
5326      anim_clip_flags &= ~<a href="/coding/class/classshapebase/#classshapebase_1aaccf6aef17f289e10ee8665c2fb0393dad8a89251dde3099496492fd6e571185d">IS_DEATH_ANIM</a>;
5327
5328   anim_clip_flags |= ANIM_OVERRIDDEN;
5329   last_anim_tag = unique_anim_tag_counter++;
5330   last_anim_id = anim_id;
5331
5332   return last_anim_tag;
5333}
5334
5335F32 ShapeBase::getAnimationDurationByID(U32 anim_id)
5336{
5337   if (anim_id == BAD_ANIM_ID)
5338      return 0.0f;
5339
5340   S32 seq_id = (S32) anim_id;
5341   if (seq_id >= 0 && seq_id < mDataBlock->mShape->sequences.size())
5342      return mDataBlock->mShape->sequences[seq_id].duration;
5343
5344   return 0.0f;
5345}
5346
5347bool ShapeBase::isBlendAnimation(const char* name)
5348{
5349   U32 anim_id = getAnimationID(name);
5350   if (anim_id == BAD_ANIM_ID)
5351      return false;
5352
5353   S32 seq_id = (S32) anim_id;
5354   if (seq_id >= 0 && seq_id < mDataBlock->mShape->sequences.size())
5355      return mDataBlock->mShape->sequences[seq_id].isBlend();
5356
5357   return false;
5358}
5359
5360const char* ShapeBase::getLastClipName(U32 clip_tag)
5361{ 
5362   if (clip_tag != last_anim_tag)
5363      return "";
5364
5365   S32 seq_id = (S32) last_anim_id;
5366
5367   S32 idx = mDataBlock->mShape->sequences[seq_id].nameIndex;
5368   if (idx < 0 || idx >= mDataBlock->mShape->names.size())
5369      return 0;
5370
5371   return mDataBlock->mShape->names[idx];
5372}
5373
5374//
5375
5376U32 ShapeBase::playAnimation(const char* name, F32 pos, F32 rate, F32 trans, bool hold, bool wait, bool is_death_anim)
5377{
5378   return playAnimationByID(getAnimationID(name), pos, rate, trans, hold, wait, is_death_anim);
5379}
5380
5381F32 ShapeBase::getAnimationDuration(const char* name)
5382{
5383   return getAnimationDurationByID(getAnimationID(name));
5384}
5385
5386void ShapeBase::setSelectionFlags(U8 flags)
5387{
5388   Parent::setSelectionFlags(flags);
5389
5390   if (!mShapeInstance || !isClientObject())  
5391      return;  
5392  
5393   if (!mShapeInstance->ownMaterialList())  
5394      return;  
5395  
5396   TSMaterialList* pMatList = mShapeInstance->getMaterialList();  
5397   for (S32 j = 0; j < pMatList->size(); j++)   
5398   {  
5399      BaseMatInstance * bmi = pMatList->getMaterialInst(j);  
5400      bmi->setSelectionHighlighting(needsSelectionHighlighting());  
5401   }  
5402}
5403
5404