📄 shapebase.h
字号:
/// @{
void setShapeName(const char*);
const char* getShapeName();
void setSkinName(const char*);
const char* getSkinName();
/// @}
// Skin modifiers
/// @name Skin modifiers
/// @{
// void addSkinModifier(U32 slot, const char* skinName, const char* maskName, const char* printName);
// void removeSkinModifier(U32 slot);
// void clearSkinModifiers();
//#ifdef TGE_RPGCLIENT2 /// TGE_RPGClient2
// void onSkinModifierChanged(U32 slot);
//#endif
/// @}
/// @name Basic attributes
/// @{
/// Sets the ammount of damage on this object.
void setDamageLevel(F32 damage);
/// Changes the object's damage state.
/// @param state New state of the object
void setDamageState(DamageState state);
/// Changes the object's damage state, based on a named state.
/// @see setDamageState
/// @param state New state of the object as a string.
bool setDamageState(const char* state);
/// Returns the name of the current damage state as a string.
const char* getDamageStateName();
/// Returns the current damage state.
DamageState getDamageState() { return mDamageState; }
/// Returns true if the object is destroyed.
bool isDestroyed() { return mDamageState == Destroyed; }
/// Sets the rate at which the object regenerates damage.
///
/// @param rate Repair rate in units/second.
void setRepairRate(F32 rate) { mRepairRate = rate; }
/// Returns damage amount.
F32 getDamageLevel() { return mDamage; }
/// Returns the damage percentage.
///
/// @return Damage factor, between 0.0 - 1.0
F32 getDamageValue();
/// Returns the rate at which the object regenerates damage
F32 getRepairRate() { return mRepairRate; }
/// Adds damage to an object
/// @param amount Amount of of damage to add
void applyDamage(F32 amount);
/// Removes damage to an object
/// @param amount Amount to repair object by
void applyRepair(F32 amount);
/// Sets the direction from which the damage is coming
/// @param vec Vector indicating the direction of the damage
void setDamageDir(const VectorF& vec) { damageDir = vec; }
/// Sets the level of energy for this object
/// @param energy Level of energy to assign to this object
virtual void setEnergyLevel(F32 energy);
/// Sets the rate at which the energy replentishes itself
/// @param rate Rate at which energy restores
void setRechargeRate(F32 rate) { mRechargeRate = rate; }
/// Returns the amount of energy in the object
F32 getEnergyLevel();
/// Returns the percentage of energy, 0.0 - 1.0
F32 getEnergyValue();
/// Returns the recharge rate
F32 getRechargeRate() { return mRechargeRate; }
/// @}
/// @name Script sounds
/// @{
/// Plays an audio sound from a mounted object
/// @param slot Mount slot ID
/// @param profile Audio profile to play
void playAudio(U32 slot,AudioProfile* profile);
/// Stops audio from a mounted object
/// @param slot Mount slot ID
void stopAudio(U32 slot);
/// @}
/// @name Script animation
/// @{
/// Sets the animation thread for a mounted object
/// @param slot Mount slot ID
/// @param seq Sequance id
/// @param reset Reset the sequence
bool setThreadSequence(U32 slot, S32 seq, bool reset = true);
/// Update the animation thread
/// @param st Thread to update
void updateThread(Thread& st);
/// Stop the current thread from playing on a mounted object
/// @param slot Mount slot ID
bool stopThread(U32 slot);
/// Pause the running animation thread
/// @param slot Mount slot ID
bool pauseThread(U32 slot);
/// Start playing the running animation thread again
/// @param slot Mount slot ID
bool playThread(U32 slot);
/// Toggle the thread as reversed or normal (For example, sidestep-right reversed is sidestep-left)
/// @param slot Mount slot ID
/// @param forward True if the animation is to be played normally
bool setThreadDir(U32 slot,bool forward);
/// Start the sound associated with an animation thread
/// @param thread Thread
void startSequenceSound(Thread& thread);
/// Stop the sound associated with an animation thread
/// @param thread Thread
void stopThreadSound(Thread& thread);
/// Advance all animation threads attached to this shapebase
/// @param dt Change in time from last call to this function
void advanceThreads(F32 dt);
/// @}
/// @name Cloaking
/// @{
/// Force uncloaking of object
/// @param reason Reason this is being forced to uncloak, this is passed directly to script control
void forceUncloak(const char *reason);
/// Set cloaked state of object
/// @param cloaked True if object is cloaked
void setCloakedState(bool cloaked);
/// Returns true if object is cloaked
bool getCloakedState();
/// Returns level of cloaking, as it's not an instant "now you see it, now you don't"
F32 getCloakLevel();
/// @}
/// @name Mounted objects
/// @{
/// Mount an object to a mount point
/// @param obj Object to mount
/// @param node Mount node ID
virtual void mountObject(ShapeBase* obj,U32 node);
/// Remove an object mounting
/// @param obj Object to unmount
void unmountObject(ShapeBase *obj);
/// Unmount this object from it's mount
void unmount();
/// Return the object that this object is mounted to
ShapeBase* getObjectMount() { return mMount.object; }
/// Return object link of next object mounted to this object's mount
ShapeBase* getMountLink() { return mMount.link; }
/// Returns the list of things mounted along with this object
ShapeBase* getMountList() { return mMount.list; }
/// Returns the mount id that this is mounted to
U32 getMountNode() { return mMount.node; }
/// Returns true if this object is mounted to anything at all
bool isMounted() { return mMount.object != 0; }
/// Returns the number of object mounted along with this
S32 getMountedObjectCount();
/// Returns the object mounted at a position in the mount list
/// @param idx Position on the mount list
ShapeBase* getMountedObject(S32 idx);
/// Returns the node the object at idx is mounted to
/// @param idx Index
S32 getMountedObjectNode(S32 idx);
/// Returns the object a object on the mount list is mounted to
/// @param node
ShapeBase* getMountNodeObject(S32 node);
/// Returns where the AI should be to repair this object
///
/// @note Legacy code from Tribes 2, but still works
Point3F getAIRepairPoint();
/// @}
/// @name Mounted Images
/// @{
/// Mount an image (ShapeBaseImage) onto an image slot
/// @param image ShapeBaseImage to mount
/// @param imageSlot Image mount point
/// @param loaded True if weapon is loaded (it assumes it's a weapon)
/// @param skinNameHandle Skin name for object
virtual bool mountImage(ShapeBaseImageData* image,U32 imageSlot,bool loaded, StringHandle &skinNameHandle);
/// Unmount an image from a slot
/// @param imageSlot Mount point
virtual bool unmountImage(U32 imageSlot);
/// Gets the information on the image mounted in a slot
/// @param imageSlot Mount point
ShapeBaseImageData* getMountedImage(U32 imageSlot);
/// Gets the mounted image on on a slot
/// @param imageSlot Mount Point
MountedImage* getImageStruct(U32 imageSlot);
/// Gets the next image which will be put in an image slot
/// @see setImageState
/// @param imageSlot mount Point
ShapeBaseImageData* getPendingImage(U32 imageSlot);
/// Returns true if the mounted image is firing
/// @param imageSlot Mountpoint
bool isImageFiring(U32 imageSlot);
/// This will return true if, when triggered, the object will fire.
/// @param imageSlot mount point
/// @param ns Used internally for recursion, do not mess with
/// @param depth Used internally for recursion, do not mess with
bool isImageReady(U32 imageSlot,U32 ns = (U32)-1,U32 depth = 0);
/// Returns true if the specified image is mounted
/// @param image ShapeBase image
bool isImageMounted(ShapeBaseImageData* image);
/// Returns the slot which the image specified is mounted on
/// @param image Image to test for
S32 getMountSlot(ShapeBaseImageData* image);
/// Returns the skin for the image in a slot
/// @param imageSlot Image slot to get the skin from
StringHandle getImageSkinTag(U32 imageSlot);
/// Returns the image state as a string
/// @param imageSlot Image slot to check state
const char* getImageState(U32 imageSlot);
/// Sets the trigger state of the image (Ie trigger pulled down on gun)
/// @param imageSlot Image slot
/// @param trigger True if trigger is down
void setImageTriggerState(U32 imageSlot,bool trigger);
/// Returns the trigger state of the image
/// @param imageSlot Image slot
bool getImageTriggerState(U32 imageSlot);
/// Sets the flag if the image uses ammo or energy
/// @param imageSlot Image slot
/// @param ammo True if the weapon uses ammo, not energy
void setImageAmmoState(U32 imageSlot,bool ammo);
/// Returns true if the image uses ammo, not energy
/// @param imageSlot Image slot
bool getImageAmmoState(U32 imageSlot);
/// Sets the image as wet or not, IE if you wanted a gun not to function underwater
/// @param imageSlot Image slot
/// @param wet True if image is wet
void setImageWetState(U32 imageSlot,bool wet);
/// Returns true if image is wet
/// @param imageSlot image slot
bool getImageWetState(U32 imageSlot);
/// Sets the flag of if the image is loaded with ammo
/// @param imageSlot Image slot
/// @param loaded True if object is loaded with ammo
void setImageLoadedState(U32 imageSlot,bool loaded);
/// Returns true if object is loaded with ammo
/// @param imageSlot Image slot
bool getImageLoadedState(U32 imageSlot);
/// Modify muzzle, if needed, to aim at whatever is straight in front of eye.
/// Returns true if result is actually modified.
/// @param muzMat Muzzle transform (in/out)
/// @param result Corrected muzzle vector (out)
bool getCorrectedAim(const MatrixF& muzMat, VectorF* result);
/// Gets the muzzle vector of a specified slot
/// @param imageSlot Image slot to check transform for
/// @param vec Muzzle vector (out)
virtual void getMuzzleVector(U32 imageSlot,VectorF* vec);
/// Gets the point of the muzzle of the image
/// @param imageSlot Image slot
/// @param pos Muzzle point (out)
void getMuzzlePoint(U32 imageSlot,Point3F* pos);
/// @}
/// @name Transforms
/// @{
/// Gets the minimum viewing distance, maximum viewing distance, camera offsetand rotation
/// for this object, if the world were to be viewed through its eyes
/// @param min Minimum viewing distance
/// @param max Maximum viewing distance
/// @param offset Offset of the camera from the origin in local space
/// @param rot Rotation matrix
virtual void getCameraParameters(F32 *min,F32* max,Point3F* offset,MatrixF* rot);
/// Gets the camera transform
/// @todo Find out what pos does
/// @param pos TODO: Find out what this does
/// @param mat Camera transform (out)
virtual void getCameraTransform(F32* pos,MatrixF* mat);
/// Gets the index of a node inside a mounted image given the name
/// @param imageSlot Image slot
/// @param nodeName Node name
S32 getNodeIndex(U32 imageSlot,StringTableEntry nodeName);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -