18 #include "precompiled.h"
27 DEFINE_INTERFACE_METHOD_4("IsInPointRange",
bool, ICmpUnitMotion, IsInPointRange, entity_pos_t, entity_pos_t, entity_pos_t, entity_pos_t)
29 DEFINE_INTERFACE_METHOD_3("MoveToTargetRange",
bool, ICmpUnitMotion, MoveToTargetRange, entity_id_t, entity_pos_t, entity_pos_t)
30 DEFINE_INTERFACE_METHOD_3("MoveToFormationOffset",
void, ICmpUnitMotion, MoveToFormationOffset, entity_id_t, entity_pos_t, entity_pos_t)
48 virtual
bool MoveToPointRange(entity_pos_t x, entity_pos_t z, entity_pos_t minRange, entity_pos_t maxRange)
50 return m_Script.Call<
bool>(
"MoveToPointRange", x, z, minRange, maxRange);
53 virtual bool IsInPointRange(entity_pos_t x, entity_pos_t z, entity_pos_t minRange, entity_pos_t maxRange)
55 return m_Script.Call<
bool>(
"IsInPointRange", x, z, minRange, maxRange);
58 virtual bool IsInTargetRange(entity_id_t target, entity_pos_t minRange, entity_pos_t maxRange)
60 return m_Script.Call<
bool>(
"IsInTargetRange", target, minRange, maxRange);
63 virtual bool MoveToTargetRange(entity_id_t target, entity_pos_t minRange, entity_pos_t maxRange)
65 return m_Script.Call<
bool>(
"MoveToTargetRange", target, minRange, maxRange);
70 m_Script.CallVoid(
"MoveToFormationOffset", target, x, z);
75 m_Script.CallVoid(
"FaceTowardsPoint", x, z);
80 m_Script.CallVoid(
"StopMoving");
85 return m_Script.Call<fixed>(
"GetCurrentSpeed");
90 m_Script.CallVoid(
"SetSpeed", speed);
95 return m_Script.Call<
bool>(
"IsMoving");
100 return m_Script.Call<fixed>(
"GetWalkSpeed");
105 return m_Script.Call<fixed>(
"GetRunSpeed");
110 m_Script.CallVoid(
"SetFacePointAfterMove", facePointAfterMove);
120 m_Script.CallVoid(
"SetUnitRadius", radius);
125 m_Script.CallVoid(
"SetDebugOverlay", enabled);
A simple fixed-point number class.
virtual void SetFacePointAfterMove(bool facePointAfterMove)
Set whether the unit will turn to face the target point after finishing moving.
virtual ICmpPathfinder::pass_class_t GetPassabilityClass()
Get the unit's passability class.
#define DEFINE_INTERFACE_METHOD_3(scriptname, rettype, classname, methodname, arg1, arg2, arg3)
virtual fixed GetCurrentSpeed()
Get the current movement speed.
#define DEFINE_INTERFACE_METHOD_2(scriptname, rettype, classname, methodname, arg1, arg2)
#define END_INTERFACE_WRAPPER(iname)
virtual void StopMoving()
Stop moving immediately.
virtual void MoveToFormationOffset(entity_id_t target, entity_pos_t x, entity_pos_t z)
Join a formation, and move towards a given offset relative to the formation controller entity...
virtual void SetDebugOverlay(bool enabled)
Toggle the rendering of debug info.
virtual void FaceTowardsPoint(entity_pos_t x, entity_pos_t z)
Turn to look towards the given point.
#define DEFINE_INTERFACE_METHOD_1(scriptname, rettype, classname, methodname, arg1)
virtual bool MoveToTargetRange(entity_id_t target, entity_pos_t minRange, entity_pos_t maxRange)
Attempt to walk into range of a given target entity, or as close as possible.
virtual fixed GetRunSpeed()
Get the default speed that this unit will have when running, in metres per second.
virtual void SetSpeed(fixed speed)
Set the current movement speed.
Motion interface for entities with complex movement capabilities.
#define DEFINE_INTERFACE_METHOD_4(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4)
#define DEFINE_INTERFACE_METHOD_0(scriptname, rettype, classname, methodname)
#define DEFAULT_SCRIPT_WRAPPER(cname)
virtual fixed GetWalkSpeed()
Get the default speed that this unit will have when walking, in metres per second.
virtual bool IsInPointRange(entity_pos_t x, entity_pos_t z, entity_pos_t minRange, entity_pos_t maxRange)
Determine wether the givven point is within the given range, using the same measurement as MoveToPoin...
virtual bool IsInTargetRange(entity_id_t target, entity_pos_t minRange, entity_pos_t maxRange)
Determine whether the target is within the given range, using the same measurement as MoveToTargetRan...
virtual bool IsMoving()
Get whether the unit is moving.
#define BEGIN_INTERFACE_WRAPPER(iname)
#define REGISTER_COMPONENT_SCRIPT_WRAPPER(cname)
u32 entity_id_t
Entity ID type.
virtual void SetUnitRadius(fixed radius)
Override the default obstruction radius, used for planning paths and checking for collisions...