From 1cddf0959084fd08129ff88915931cd0be4f6bd8 Mon Sep 17 00:00:00 2001 From: AlexBarys Date: Sun, 23 Apr 2017 18:58:40 -0400 Subject: [PATCH 1/2] Implementation for two new features Added implementation to expose two new functionalities from the c++ to Torquescript as requested in issue #1272. Added both a DefineEngineMethod function for getting the count of the number of objects on the turret ignore list and a DefineEngineMethod function for returning a reference to the object on the ignore list at a given index on the ignore list. Also added functions that do each of those things and are then encapsulated by those DefineEngineMethod functions. --- Engine/source/T3D/turret/aiTurretShape.cpp | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Engine/source/T3D/turret/aiTurretShape.cpp b/Engine/source/T3D/turret/aiTurretShape.cpp index ac36e30ea..aa053a3f5 100644 --- a/Engine/source/T3D/turret/aiTurretShape.cpp +++ b/Engine/source/T3D/turret/aiTurretShape.cpp @@ -564,6 +564,16 @@ void AITurretShape::removeFromIgnoreList(ShapeBase* obj) mIgnoreObjects.removeObject(obj); } +S32 AITurretShape::ignoreListCount() +{ + return mIgnoreObjects.size(); +} + +SimObject* AITurretShape::getIgnoreListObject(S32 index) +{ + return mIgnoreObjects.at(index); +} + //---------------------------------------------------------------------------- void AITurretShape::_initState() @@ -1244,6 +1254,21 @@ DefineEngineMethod( AITurretShape, removeFromIgnoreList, void, (ShapeBase* obj), object->removeFromIgnoreList(obj); } +DefineEngineMethod( AITurretShape, ignoreListCount, S32, (),, + "@brief Returns the number of objects in the turrets ignore list.\n\n" + "All objects in this list will be ignored by the turret's targeting.\n") +{ + return object->ignoreListCount(); +} + +DefineEngineMethod( AITurretShape, getIgnoreListObject, SimObject*, (S32 index),, + "@brief Returns the object in the ignore list at index.\n\n" + "All objects in this list will be ignored by the turret's targeting.\n" + "@param index The index of the object in the ignore list being retrieved.\n") +{ + return object->getIgnoreListObject(index); +} + DefineEngineMethod( AITurretShape, setTurretState, void, (const char* newState, bool force), (false), "@brief Set the turret's current state.\n\n" "Normally the turret's state comes from updating the state machine but this method " From b82e87ec89a2c01cd6e788a0b379c394f03ec2f1 Mon Sep 17 00:00:00 2001 From: AlexBarys Date: Sun, 23 Apr 2017 19:01:31 -0400 Subject: [PATCH 2/2] Function definitions for new functions Added header file definitions for the two new functions created to implement the features requested in issue #1272 --- Engine/source/T3D/turret/aiTurretShape.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Engine/source/T3D/turret/aiTurretShape.h b/Engine/source/T3D/turret/aiTurretShape.h index 18c0fb728..21e07fbf4 100644 --- a/Engine/source/T3D/turret/aiTurretShape.h +++ b/Engine/source/T3D/turret/aiTurretShape.h @@ -257,6 +257,8 @@ public: void addToIgnoreList(ShapeBase* obj); void removeFromIgnoreList(ShapeBase* obj); + S32 ignoreListCount(); + SimObject* getIgnoreListObject(S32 index); void setTurretStateName(const char* newState, bool force=false); void setTurretState(U32 newState, bool force=false);