Cafu Engine
ComponentMoverT Class Reference

This component controls the movement of one or more entities and implements the related effects. More...

Inheritance diagram for ComponentMoverT:

Public Member Functions

 HandleMove (number FrameTime)
 This is the main method of this component: [...]. More...
 
- Public Member Functions inherited from ComponentBaseT
any get (string var_name)
 Returns the value of an attribute (a member variable) of this class. More...
 
 set (string var_name, any new_value)
 Sets an attribute (a member variable) of this class to a new value. More...
 
string GetExtraMessage (string var_name)
 Returns the result of VarBaseT::GetExtraMessage() for the given member variable. More...
 
 interpolate (string var_name, number start_value, number end_value, number time)
 Schedules a value for interpolation between a start and end value over a given period of time. More...
 
EntityT GetEntity ()
 Returns the entity that this component is a part of (or nil if the component is currently "stand-alone", not a part of any entity). More...
 
 InitClientApprox (string VarName)
 Registers the given attribute (a member variable) of this class for interpolation over client frames in order to bridge the larger intervals between server frames. More...
 
 OnInit ()
 This method is called for each component of each entity as the last step of initializing a newly loaded map. More...
 
 OnClientFrame (number t)
 This method is called for each component of each entity before the client renders the next frame. More...
 

Public Attributes

number moveDuration
 The time in seconds that it takes to move each part from one endpoint to the other. More...
 
number destActivated
 Describes the mover's behavior when it is activated at the "dest" position. More...
 
number destTimeout
 The timeout in seconds after which the parts move back to their "home" position. More...
 
number otherEntities
 Describes the mover's behavior regarding other entities. More...
 
number trajFunc
 Describes the base function that is used to compute the mover's trajectory. More...
 
number trajExp
 The exponent that is applied to trajFunc. More...
 

Detailed Description

This component controls the movement of one or more entities and implements the related effects.

The component can handle a single entity, e.g. a moving platform or a lift, or several entities that act together as a team, e.g. the wings of a door.

This component works in concert with a Script component, which must be present in the same entity. The Mover component queries the Script component for the desired spatial transformation of each team member, and notifies it whenever the movement is blocked by another entity (e.g. a player). It also implements the appropriate effects on other entities, e.g. their being pushed by moving parts, or their riding on top of them.

Note that the variables of this class (also referred to as "Public Attributes" or "Member Data") must be used with the get() and set() methods at this time – see get() and set() for details.

If you would like to create a new component of this type explicitly (those defined in the CaWE Map Editor are instantiated automatically), use WorldT::new():

local comp = world:new("ComponentMoverT")
Implementing C++ Class:
cf::GameSys::ComponentMoverT

Member Function Documentation

HandleMove ( number  FrameTime)

This is the main method of this component: [...].

Parameters
FrameTimeThe time across which the parts are moved.

Member Data Documentation

number destActivated

Describes the mover's behavior when it is activated at the "dest" position.

Typical values:
ValueDescription
0move home
1reset timeout
2ignore
Related C++ type:
int
number destTimeout

The timeout in seconds after which the parts move back to their "home" position.

A negative value to disables the timeout.

Related C++ type:
float
number moveDuration

The time in seconds that it takes to move each part from one endpoint to the other.

Related C++ type:
float
number otherEntities

Describes the mover's behavior regarding other entities.

Typical values:
ValueDescription
0ignore
1cannot push
2can push
3can force-push
Related C++ type:
int
number trajExp

The exponent that is applied to trajFunc.

Related C++ type:
float
number trajFunc

Describes the base function that is used to compute the mover's trajectory.

Typical values:
ValueDescription
0linear
1sine
Related C++ type:
int