Emergency 20 Dokumentation  4.2.0
em5::VehicleCraneComponent Class Reference

EMERGENCY 5 vehicle crane component class. More...

#include <VehicleCraneComponent.h>

Inheritance diagram for em5::VehicleCraneComponent:
qsf::Component qsf::InheritedObject qsf::WeakPtrTarget qsf::Object

Public Types

enum  PivotMovement {
  PAUSE = 0, YAW_MOVEMENT, PITCH_MOVEMENT, EXTEND_MOVEMENT,
  YAW_AND_PITCH_MOVEMENT, PITCH_AND_EXTEND_MOVEMENT, YAW_AND_EXTEND_MOVEMENT, COCKPIT_MOVEMENT,
  PITCH_AND_COCKPIT_MOVEMENT
}
 
enum  CraneType { TOW_CAR, BOAT_TRANSPORTER, HEAVY_CRANE }
 
enum  AnimationState {
  STATE_NONE, STATE_ALIGN_ARM, STATE_LOAD_CARGO_ARM, STATE_HOOK_MOVE,
  STATE_HOOK_MOVE_BACK, STATE_FOLD_ARM, STATE_STOP_ALL_ANIMATION
}
 
enum  SequenceType {
  SEQUENCE_NONE, SEQUENCE_PICKUP_BY_TOWCAR_ALIGN_ARM, SEQUENCE_PICKUP_BY_TOWCAR_LOAD_CARGO_ARM, SEQUENCE_LIFT_BY_CRANE_ALIGN_ARM,
  SEQUENCE_LIFT_BY_CRANE_FOLD_ARM, SEQUENCE_UNLOAD_BOAT_ALIGN_ARM, SEQUENCE_UNLOAD_BOAT_FOLD_ARM, SEQUENCE_LOAD_BOAT_ALIGN_ARM,
  SEQUENCE_LOAD_BOAT_LOAD_CARGO_ARM
}
 
- Public Types inherited from qsf::Component
enum  TransformChangeFlag {
  TRANSFORM_CHANGE_POSITION = 0x01, TRANSFORM_CHANGE_ROTATION = 0x02, TRANSFORM_CHANGE_SCALE = 0x04, TRANSFORM_CHANGE_TRANSFORM = 0x07,
  TRANSFORM_CHANGE_FOR_SIMULATION = 0x08, TRANSFORM_CHANGE_FOR_ANIMATION = 0x10
}
 
typedef BitFlagSet< uint8, TransformChangeFlagTransformChangeFlags
 
- Public Types inherited from qsf::Object
enum  PropertyOverrideState { PROPERTY_INVALID, PROPERTY_DEFAULT, PROPERTY_OVERRIDE, PROPERTY_REMOVED }
 
enum  SerializationMethod { SERIALIZE_FLAT, SERIALIZE_COMPLETE, SERIALIZE_DIFFERENTIAL, SERIALIZE_IGNORE_UNKNOWN }
 
enum  SerializationMode { MODE_MINIMAL, MODE_COMPATIBLE }
 

Public Member Functions

 VehicleCraneComponent (qsf::Prototype *prototype)
 Constructor. More...
 
virtual ~VehicleCraneComponent ()
 Destructor. More...
 
bool checkTargetPosition (const glm::vec3 &targetPosition, glm::vec3 &correctionOffset)
 Check if target position is in range. More...
 
void alignArm (const glm::vec3 &position)
 Move the arm of the crane to the given position. More...
 
void foldArm ()
 Fold the arm without cargo. More...
 
void loadCargoArm ()
 Load the cargo back to the vehicle. More...
 
void hookMove (const glm::vec3 &targetPosition, float distancePercentage)
 Load the cargo back to the vehicle. More...
 
void hookMoveBack (float distancePercentage=0.0f)
 Move back to starting position. More...
 
bool isAnimationPlaying () const
 Return if the animation is running or not. More...
 
SequenceType getSequenceType () const
 
void setSequenceType (SequenceType type)
 Movement will be in sequence defined the given vector. More...
 
void deleteSequence ()
 Delete sequence and move synchronously. More...
 
void stopAllAnimation ()
 Stop all animations. More...
 
void setVisibleStrap (bool visible)
 Hide oder show the strap from the stage. More...
 
void linkTargetToHook (qsf::Entity &targetEntity)
 Un/link target to/from hook. More...
 
void unlinkTargetFromHook ()
 
qsf::EntitygetHookEntity () const
 Get hook entity if there is one, or null pointer if not. More...
 
glm::vec3 worldSpacePositionWithLocalOffset (const qsf::TransformComponent &transformComponent, const glm::vec3 &localoffset)
 Get position in world space and add a local offset. More...
 
uint64 getCraneEntityId () const
 Get crane entity ID. More...
 
void setCraneEntityId (uint64 craneEntityId)
 
float getMinLength () const
 Getter and setter for CAMP. More...
 
void setMinLength (float minLength)
 
float getMaxLength () const
 
void setMaxLength (float maxLength)
 
float getMinAngle () const
 
void setMinAngle (float minAngle)
 
float getMaxAngle () const
 
void setMaxAngle (float maxAngle)
 
float getCraneHeight () const
 
void setCraneHeight (float craneHeight)
 
float getArmRotateSpeed () const
 
void setArmRotateSpeed (float armRotateSpeed)
 
float getExtendSpeed () const
 
void setExtendSpeed (float extendSpeed)
 
float getLowToHighSpeed () const
 
void setLowToHighSpeed (float lowToHighSpeed)
 
float getHookSpeed () const
 
void setHookSpeed (float hookSpeed)
 
float getCockpitSpeed () const
 
void setCockpitSpeed (float cockpitSpeed)
 
float getTimeUltimatum () const
 
void setTimeUltimatum (float timeUltimatum)
 
CraneType getCraneType () const
 
void setCraneType (CraneType craneType)
 
AnimationState getLastAnimationState () const
 
const glm::vec3 & getTargetPosition () const
 
bool isStrapVisible () const
 
float getHookMoveDistancePercentage () const
 
uint64 getEntityIdLinkedToHook () const
 
virtual void serialize (qsf::BinarySerializer &serializer) override
 Serialize or deserialize the component using a binary serializer. More...
 
- Public Member Functions inherited from qsf::Component
virtual ~Component ()
 Destructor. More...
 
PrototypegetPrototype () const
 Return the prototype this component is in. More...
 
EntitygetEntity () const
 Return a reference to the entity this component is in. More...
 
uint32 getId () const
 Return the unique component identifier. More...
 
ComponentManagergetComponentManager () const
 Return the component manager that's responsible for this component instance. More...
 
ComponentCollectiongetComponentCollection () const
 Return the component collection that's responsible for this component instance. More...
 
bool isSimulating () const
 Return whether or not the component is in simulating mode. More...
 
bool isActive () const
 Return whether or not the component is considered to be active. More...
 
void setActive (bool active)
 Set whether or not the component is considered to be active. More...
 
bool isDebug () const
 Return whether or not the component is considered to be in debug mode. More...
 
bool isHidden () const
 Return whether or not the component is hidden. More...
 
void setHidden (bool hidden)
 Set whether or not the component is hidden. More...
 
bool isGloballyHidden () const
 Return whether or not the component is globally hidden. More...
 
void setGloballyHidden (bool globallyHidden)
 Set whether or not the component is globally hidden. More...
 
bool isReallyHidden () const
 Return whether or not the component is really hidden. More...
 
bool startup (bool ownerIsRunning)
 Startup the component. More...
 
bool isRunning () const
 Return whether or not the component is up-and-running. More...
 
void shutdown ()
 Shutdown the component. More...
 
uint64 getPrototypeId () const
 Return the ID of the prototype this component is in. More...
 
uint64 getEntityId () const
 Return the ID of the entity this component is in. More...
 
virtual void onInvalidation ()
 Invalidate the component. More...
 
virtual void setDebug (bool debugMode)
 Set whether or not the component is considered to be in debug mode. More...
 
- Public Member Functions inherited from qsf::InheritedObject
void copyPropertyOverrideStateFrom (const InheritedObject &object, bool add=false)
 
void setAllPropertyOverrideFlags (bool value)
 
void autoCreatePropertyOverrideState ()
 
virtual camp::Value getPropertyDefaultValue (const StringHash &propertyId) const override
 
virtual PropertyOverrideState getPropertyOverrideState (const StringHash &propertyId) const override
 
virtual bool setPropertyOverrideState (const StringHash &propertyId, PropertyOverrideState overrideState) override
 
- Public Member Functions inherited from qsf::Object
virtual ~Object ()
 Destructor. More...
 
const camp::Class & getCampClass () const
 Return the CAMP class. More...
 
int getPropertyIndexById (const StringHash &propertyId) const
 Return the CAMP property index by using the unique class property ID. More...
 
uint32 getPropertyIdByIndex (int index) const
 Return the unique class property ID with the given index. More...
 
std::string getPropertyNameById (const StringHash &propertyId) const
 Return the CAMP property name by using the unique class property ID. More...
 
const camp::Property * getCampPropertyById (const StringHash &propertyId) const
 Return the CAMP property by using the unique class property ID. More...
 
void setPropertyValuesByString (const std::string &values)
 Set CAMP reflection property values by using a given string. More...
 
void setPropertiesToDefaultValues ()
 Set all CAMP reflection system properties to their default values. More...
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
void serializeToBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void deserializeFromBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL, bool setOverrideState=true)
 
virtual void onPreDeserialize ()
 Called right before the object is deserialized using any of the above methods. Default implementation is empty. More...
 
virtual void onPostDeserialize ()
 Called right after the object was deserialized using any of the above methods. Default implementation is empty. More...
 
virtual ScriptgetAssociatedScript () const
 Return the script instance associated with this object instance. More...
 

Static Public Attributes

static const uint32 COMPONENT_ID
 "em5::VehicleCraneComponent" unique component ID More...
 
static const float YAW_EPSILON
 Epsilon to check if yaw orientation can be assumed equal. More...
 
static const float ANIMATION_EPSILON
 Epsilon to check if animation offset can be assumed equal. More...
 
static const float HOOK_DISTANCE_EPSILON
 Epsilon to check if hook movement distance can be assumed equal. More...
 
- Static Public Attributes inherited from qsf::Component
static const uint32 COMPONENT_ID
 "qsf::Component" unique component ID More...
 

Protected Member Functions

virtual void onShutdown () override
 Shutdown the component. More...
 
- Protected Member Functions inherited from qsf::Component
 Component (Prototype *prototype)
 Constructor. More...
 
void promotePropertyChange (uint32 propertyId)
 A component property value was changed. More...
 
template<typename T , typename S >
bool assignAndPromoteChange (T &variable, const S &newValue, uint32 propertyId)
 Comfort function for updating an exported member variable and promoting any change that happened. More...
 
void setRegisterForSimulationTransformChanges (bool enable)
 Register or unregister this component as simulation transform listener. More...
 
void setRegisterForAnimationTransformChanges (bool enable)
 Register or unregister this component as animation transform listener. More...
 
virtual const ObjectgetPropertyDefaultsProvider () const override
 
virtual bool ignoreOwnerRunningState () const
 Return whether or not the component will only startup if the owner is in running state. More...
 
virtual bool implementsOnComponentPropertyChange () const
 Signal whether this component needs the "onComponentPropertyChange" callback at all. More...
 
virtual void onComponentPropertyChange (const Component &component, uint32 propertyId)
 Called in case a component property value was changed. More...
 
virtual void onComponentTransformChange (const Transform &transform, TransformChangeFlags flags)
 Called in case a component transformation value was changed. More...
 
virtual void onSetSimulating (bool simulating)
 Set whether or not the component is in simulating mode. More...
 
virtual void onSetActive (bool active)
 Set whether or not the component is considered to be active. More...
 
virtual void onSetDebug (bool debug)
 Set whether or not the component is considered to be in debug mode. More...
 
virtual void onSetHidden (bool hidden)
 Set whether or not the component is considered to be hidden. More...
 
virtual bool onStartup ()
 Startup the component. More...
 
- Protected Member Functions inherited from qsf::InheritedObject
 InheritedObject ()
 Default constructor. More...
 
- Protected Member Functions inherited from qsf::Object
 Object ()
 Default constructor. More...
 
- Protected Member Functions inherited from qsf::WeakPtrTarget
 WeakPtrTarget ()
 Default constructor. More...
 
 WeakPtrTarget (const WeakPtrTarget &other)
 Copy constructor. More...
 
 WeakPtrTarget (WeakPtrTarget &&)=delete
 Delete the move constructor, as WeakPtrTarget would need a proper move constructor-implementation that ensures that its pointer gets updated in the WeakPtrBase as well. More...
 
 ~WeakPtrTarget ()
 Destructor. More...
 
void invalidateAllWeakPtr ()
 Invalidate all weak pointers to this object. More...
 
void operator= (const WeakPtrTarget &other)
 Copy operator. More...
 

Additional Inherited Members

- Protected Attributes inherited from qsf::InheritedObject
std::bitset< 128 > mPropertyOverrideFlags
 One bit for each property; if set, the property is overridden. More...
 

Detailed Description

EMERGENCY 5 vehicle crane component class.

Member Enumeration Documentation

Enumerator
STATE_NONE 
STATE_ALIGN_ARM 
STATE_LOAD_CARGO_ARM 
STATE_HOOK_MOVE 
STATE_HOOK_MOVE_BACK 
STATE_FOLD_ARM 
STATE_STOP_ALL_ANIMATION 
Enumerator
TOW_CAR 
BOAT_TRANSPORTER 
HEAVY_CRANE 
Enumerator
PAUSE 
YAW_MOVEMENT 
PITCH_MOVEMENT 
EXTEND_MOVEMENT 
YAW_AND_PITCH_MOVEMENT 
PITCH_AND_EXTEND_MOVEMENT 
YAW_AND_EXTEND_MOVEMENT 
COCKPIT_MOVEMENT 
PITCH_AND_COCKPIT_MOVEMENT 
Enumerator
SEQUENCE_NONE 
SEQUENCE_PICKUP_BY_TOWCAR_ALIGN_ARM 
SEQUENCE_PICKUP_BY_TOWCAR_LOAD_CARGO_ARM 
SEQUENCE_LIFT_BY_CRANE_ALIGN_ARM 
SEQUENCE_LIFT_BY_CRANE_FOLD_ARM 
SEQUENCE_UNLOAD_BOAT_ALIGN_ARM 
SEQUENCE_UNLOAD_BOAT_FOLD_ARM 
SEQUENCE_LOAD_BOAT_ALIGN_ARM 
SEQUENCE_LOAD_BOAT_LOAD_CARGO_ARM 

Constructor & Destructor Documentation

em5::VehicleCraneComponent::VehicleCraneComponent ( qsf::Prototype prototype)
inlineexplicit

Constructor.

Parameters
[in]prototypeThe prototype this component is in, no null pointer allowed
em5::VehicleCraneComponent::~VehicleCraneComponent ( )
inlinevirtual

Destructor.

Member Function Documentation

void em5::VehicleCraneComponent::alignArm ( const glm::vec3 &  position)

Move the arm of the crane to the given position.

Parameters
[in]positionThe position the arm should move to
bool em5::VehicleCraneComponent::checkTargetPosition ( const glm::vec3 &  targetPosition,
glm::vec3 &  correctionOffset 
)

Check if target position is in range.

Returns
"true" if a correction is necessary, "false" if target position is okay
void em5::VehicleCraneComponent::deleteSequence ( )

Delete sequence and move synchronously.

void em5::VehicleCraneComponent::foldArm ( )

Fold the arm without cargo.

float em5::VehicleCraneComponent::getArmRotateSpeed ( ) const
inline
float em5::VehicleCraneComponent::getCockpitSpeed ( ) const
inline
uint64 em5::VehicleCraneComponent::getCraneEntityId ( ) const
inline

Get crane entity ID.

float em5::VehicleCraneComponent::getCraneHeight ( ) const
inline
VehicleCraneComponent::CraneType em5::VehicleCraneComponent::getCraneType ( ) const
inline
uint64 em5::VehicleCraneComponent::getEntityIdLinkedToHook ( ) const
inline
float em5::VehicleCraneComponent::getExtendSpeed ( ) const
inline
qsf::Entity* em5::VehicleCraneComponent::getHookEntity ( ) const

Get hook entity if there is one, or null pointer if not.

float em5::VehicleCraneComponent::getHookMoveDistancePercentage ( ) const
inline
float em5::VehicleCraneComponent::getHookSpeed ( ) const
inline
VehicleCraneComponent::AnimationState em5::VehicleCraneComponent::getLastAnimationState ( ) const
inline
float em5::VehicleCraneComponent::getLowToHighSpeed ( ) const
inline
float em5::VehicleCraneComponent::getMaxAngle ( ) const
inline
float em5::VehicleCraneComponent::getMaxLength ( ) const
inline
float em5::VehicleCraneComponent::getMinAngle ( ) const
inline
float em5::VehicleCraneComponent::getMinLength ( ) const
inline

Getter and setter for CAMP.

VehicleCraneComponent::SequenceType em5::VehicleCraneComponent::getSequenceType ( ) const
inline
const glm::vec3 & em5::VehicleCraneComponent::getTargetPosition ( ) const
inline
float em5::VehicleCraneComponent::getTimeUltimatum ( ) const
inline
void em5::VehicleCraneComponent::hookMove ( const glm::vec3 &  targetPosition,
float  distancePercentage 
)

Load the cargo back to the vehicle.

Parameters
[in]targetPositionThe position of the target
[in]distancePercentage0: position on the crane, 1: position on the target
void em5::VehicleCraneComponent::hookMoveBack ( float  distancePercentage = 0.0f)

Move back to starting position.

Parameters
[in]distancePercentage0: position on the crane, 1: old position
bool em5::VehicleCraneComponent::isAnimationPlaying ( ) const

Return if the animation is running or not.

bool em5::VehicleCraneComponent::isStrapVisible ( ) const
inline
void em5::VehicleCraneComponent::linkTargetToHook ( qsf::Entity targetEntity)

Un/link target to/from hook.

Parameters
[in]targetEntityEntity we want to link to the hook
void em5::VehicleCraneComponent::loadCargoArm ( )

Load the cargo back to the vehicle.

virtual void em5::VehicleCraneComponent::onShutdown ( )
overrideprotectedvirtual

Shutdown the component.

Note
  • Only called in case "onStartup()" returned successfully
  • The default implementation is empty

Reimplemented from qsf::Component.

virtual void em5::VehicleCraneComponent::serialize ( qsf::BinarySerializer serializer)
overridevirtual

Serialize or deserialize the component using a binary serializer.

Parameters
[in]serializerThe serializer, which can be either in read or write mode

Reimplemented from qsf::Component.

void em5::VehicleCraneComponent::setArmRotateSpeed ( float  armRotateSpeed)
inline
void em5::VehicleCraneComponent::setCockpitSpeed ( float  cockpitSpeed)
inline
void em5::VehicleCraneComponent::setCraneEntityId ( uint64  craneEntityId)
void em5::VehicleCraneComponent::setCraneHeight ( float  craneHeight)
inline
void em5::VehicleCraneComponent::setCraneType ( VehicleCraneComponent::CraneType  craneType)
inline
void em5::VehicleCraneComponent::setExtendSpeed ( float  extendSpeed)
inline
void em5::VehicleCraneComponent::setHookSpeed ( float  hookSpeed)
inline
void em5::VehicleCraneComponent::setLowToHighSpeed ( float  lowToHighSpeed)
inline
void em5::VehicleCraneComponent::setMaxAngle ( float  maxAngle)
inline
void em5::VehicleCraneComponent::setMaxLength ( float  maxLength)
inline
void em5::VehicleCraneComponent::setMinAngle ( float  minAngle)
inline
void em5::VehicleCraneComponent::setMinLength ( float  minLength)
inline
void em5::VehicleCraneComponent::setSequenceType ( SequenceType  type)

Movement will be in sequence defined the given vector.

void em5::VehicleCraneComponent::setTimeUltimatum ( float  timeUltimatum)
inline
void em5::VehicleCraneComponent::setVisibleStrap ( bool  visible)

Hide oder show the strap from the stage.

void em5::VehicleCraneComponent::stopAllAnimation ( )

Stop all animations.

void em5::VehicleCraneComponent::unlinkTargetFromHook ( )
glm::vec3 em5::VehicleCraneComponent::worldSpacePositionWithLocalOffset ( const qsf::TransformComponent transformComponent,
const glm::vec3 &  localoffset 
)

Get position in world space and add a local offset.

Member Data Documentation

const float em5::VehicleCraneComponent::ANIMATION_EPSILON
static

Epsilon to check if animation offset can be assumed equal.

const uint32 em5::VehicleCraneComponent::COMPONENT_ID
static

"em5::VehicleCraneComponent" unique component ID

const float em5::VehicleCraneComponent::HOOK_DISTANCE_EPSILON
static

Epsilon to check if hook movement distance can be assumed equal.

const float em5::VehicleCraneComponent::YAW_EPSILON
static

Epsilon to check if yaw orientation can be assumed equal.


The documentation for this class was generated from the following files: