Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/ICmpUnitMotion.cpp
Show All 22 Lines | |||||
#include "simulation2/scripting/ScriptComponent.h" | #include "simulation2/scripting/ScriptComponent.h" | ||||
BEGIN_INTERFACE_WRAPPER(UnitMotion) | BEGIN_INTERFACE_WRAPPER(UnitMotion) | ||||
DEFINE_INTERFACE_METHOD_4("MoveToPointRange", bool, ICmpUnitMotion, MoveToPointRange, entity_pos_t, entity_pos_t, entity_pos_t, entity_pos_t) | DEFINE_INTERFACE_METHOD_4("MoveToPointRange", bool, ICmpUnitMotion, MoveToPointRange, entity_pos_t, entity_pos_t, entity_pos_t, entity_pos_t) | ||||
DEFINE_INTERFACE_METHOD_3("MoveToTargetRange", bool, ICmpUnitMotion, MoveToTargetRange, entity_id_t, entity_pos_t, entity_pos_t) | DEFINE_INTERFACE_METHOD_3("MoveToTargetRange", bool, ICmpUnitMotion, MoveToTargetRange, entity_id_t, entity_pos_t, entity_pos_t) | ||||
DEFINE_INTERFACE_METHOD_3("MoveToFormationOffset", void, ICmpUnitMotion, MoveToFormationOffset, entity_id_t, entity_pos_t, entity_pos_t) | DEFINE_INTERFACE_METHOD_3("MoveToFormationOffset", void, ICmpUnitMotion, MoveToFormationOffset, entity_id_t, entity_pos_t, entity_pos_t) | ||||
DEFINE_INTERFACE_METHOD_3("IsTargetRangeReachable", bool, ICmpUnitMotion, IsTargetRangeReachable, entity_id_t, entity_pos_t, entity_pos_t) | DEFINE_INTERFACE_METHOD_3("IsTargetRangeReachable", bool, ICmpUnitMotion, IsTargetRangeReachable, entity_id_t, entity_pos_t, entity_pos_t) | ||||
DEFINE_INTERFACE_METHOD_2("FaceTowardsPoint", void, ICmpUnitMotion, FaceTowardsPoint, entity_pos_t, entity_pos_t) | DEFINE_INTERFACE_METHOD_2("FaceTowardsPoint", void, ICmpUnitMotion, FaceTowardsPoint, entity_pos_t, entity_pos_t) | ||||
DEFINE_INTERFACE_METHOD_0("StopMoving", void, ICmpUnitMotion, StopMoving) | DEFINE_INTERFACE_METHOD_1("StopMoving", void, ICmpUnitMotion, StopMoving, bool) | ||||
DEFINE_INTERFACE_METHOD_CONST_0("GetCurrentSpeed", fixed, ICmpUnitMotion, GetCurrentSpeed) | DEFINE_INTERFACE_METHOD_CONST_0("GetCurrentSpeed", fixed, ICmpUnitMotion, GetCurrentSpeed) | ||||
DEFINE_INTERFACE_METHOD_CONST_0("IsMoveRequested", bool, ICmpUnitMotion, IsMoveRequested) | DEFINE_INTERFACE_METHOD_CONST_0("IsMoveRequested", bool, ICmpUnitMotion, IsMoveRequested) | ||||
DEFINE_INTERFACE_METHOD_CONST_0("GetSpeed", fixed, ICmpUnitMotion, GetSpeed) | DEFINE_INTERFACE_METHOD_CONST_0("GetSpeed", fixed, ICmpUnitMotion, GetSpeed) | ||||
DEFINE_INTERFACE_METHOD_CONST_0("GetWalkSpeed", fixed, ICmpUnitMotion, GetWalkSpeed) | DEFINE_INTERFACE_METHOD_CONST_0("GetWalkSpeed", fixed, ICmpUnitMotion, GetWalkSpeed) | ||||
DEFINE_INTERFACE_METHOD_CONST_0("GetRunMultiplier", fixed, ICmpUnitMotion, GetRunMultiplier) | DEFINE_INTERFACE_METHOD_CONST_0("GetRunMultiplier", fixed, ICmpUnitMotion, GetRunMultiplier) | ||||
DEFINE_INTERFACE_METHOD_1("SetSpeedMultiplier", void, ICmpUnitMotion, SetSpeedMultiplier, fixed) | DEFINE_INTERFACE_METHOD_1("SetSpeedMultiplier", void, ICmpUnitMotion, SetSpeedMultiplier, fixed) | ||||
DEFINE_INTERFACE_METHOD_CONST_0("GetPassabilityClassName", std::string, ICmpUnitMotion, GetPassabilityClassName) | DEFINE_INTERFACE_METHOD_CONST_0("GetPassabilityClassName", std::string, ICmpUnitMotion, GetPassabilityClassName) | ||||
DEFINE_INTERFACE_METHOD_CONST_0("GetUnitClearance", entity_pos_t, ICmpUnitMotion, GetUnitClearance) | DEFINE_INTERFACE_METHOD_CONST_0("GetUnitClearance", entity_pos_t, ICmpUnitMotion, GetUnitClearance) | ||||
DEFINE_INTERFACE_METHOD_1("SetFacePointAfterMove", void, ICmpUnitMotion, SetFacePointAfterMove, bool) | |||||
DEFINE_INTERFACE_METHOD_CONST_0("GetFacePointAfterMove", bool, ICmpUnitMotion, GetFacePointAfterMove) | |||||
DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpUnitMotion, SetDebugOverlay, bool) | DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpUnitMotion, SetDebugOverlay, bool) | ||||
END_INTERFACE_WRAPPER(UnitMotion) | END_INTERFACE_WRAPPER(UnitMotion) | ||||
class CCmpUnitMotionScripted : public ICmpUnitMotion | class CCmpUnitMotionScripted : public ICmpUnitMotion | ||||
{ | { | ||||
public: | public: | ||||
DEFAULT_SCRIPT_WRAPPER(UnitMotionScripted) | DEFAULT_SCRIPT_WRAPPER(UnitMotionScripted) | ||||
Show All 17 Lines | virtual bool IsTargetRangeReachable(entity_id_t target, entity_pos_t minRange, entity_pos_t maxRange) | ||||
return m_Script.Call<bool>("IsTargetRangeReachable", target, minRange, maxRange); | return m_Script.Call<bool>("IsTargetRangeReachable", target, minRange, maxRange); | ||||
} | } | ||||
virtual void FaceTowardsPoint(entity_pos_t x, entity_pos_t z) | virtual void FaceTowardsPoint(entity_pos_t x, entity_pos_t z) | ||||
{ | { | ||||
m_Script.CallVoid("FaceTowardsPoint", x, z); | m_Script.CallVoid("FaceTowardsPoint", x, z); | ||||
} | } | ||||
virtual void StopMoving() | virtual void StopMoving(bool faceToTarget) | ||||
{ | { | ||||
m_Script.CallVoid("StopMoving"); | m_Script.CallVoid("StopMoving", faceToTarget); | ||||
} | } | ||||
virtual fixed GetCurrentSpeed() const | virtual fixed GetCurrentSpeed() const | ||||
{ | { | ||||
return m_Script.Call<fixed>("GetCurrentSpeed"); | return m_Script.Call<fixed>("GetCurrentSpeed"); | ||||
} | } | ||||
virtual bool IsMoveRequested() const | virtual bool IsMoveRequested() const | ||||
Show All 21 Lines | virtual void SetSpeedMultiplier(fixed multiplier) | ||||
m_Script.CallVoid("SetSpeedMultiplier", multiplier); | m_Script.CallVoid("SetSpeedMultiplier", multiplier); | ||||
} | } | ||||
virtual fixed GetSpeedMultiplier() const | virtual fixed GetSpeedMultiplier() const | ||||
{ | { | ||||
return m_Script.Call<fixed>("GetSpeedMultiplier"); | return m_Script.Call<fixed>("GetSpeedMultiplier"); | ||||
} | } | ||||
virtual void SetFacePointAfterMove(bool facePointAfterMove) | |||||
{ | |||||
m_Script.CallVoid("SetFacePointAfterMove", facePointAfterMove); | |||||
} | |||||
virtual bool GetFacePointAfterMove() const | |||||
{ | |||||
return m_Script.Call<bool>("GetFacePointAfterMove"); | |||||
} | |||||
virtual pass_class_t GetPassabilityClass() const | virtual pass_class_t GetPassabilityClass() const | ||||
{ | { | ||||
return m_Script.Call<pass_class_t>("GetPassabilityClass"); | return m_Script.Call<pass_class_t>("GetPassabilityClass"); | ||||
} | } | ||||
virtual std::string GetPassabilityClassName() const | virtual std::string GetPassabilityClassName() const | ||||
{ | { | ||||
return m_Script.Call<std::string>("GetPassabilityClassName"); | return m_Script.Call<std::string>("GetPassabilityClassName"); | ||||
Show All 15 Lines |
Wildfire Games · Phabricator