29 std::vector<std::string> tokens;
30 Str::splitString(_parameters, tokens,
",");
31 if (tokens.size() != 2) {
35 _groupId = std::stoi(tokens[0]);
36 _distance = std::stof(tokens[1]);
48 if (_distance < 0.0f) {
52 const GroupMgr& mgr = entity->getZone()->getGroupMgr();
54 if (isInfinite(pos)) {
57 return glm::distance(pos, entity->getCharacter()->getPosition()) <= _distance;
A condition can be placed on a TreeNode to decide which node is going to get executed. In general they are stateless. If they are not, it should explicitly get noted.
Definition: ICondition.h:124
Checks whether the controlled AI is close to a particular group.
Definition: IsCloseToGroup.h:20
Maintains the groups a AI can be in.
Definition: GroupMgr.h:27
glm::vec3 getPosition(GroupId id) const
Returns the average position of the group.
Definition: GroupMgr.h:259
bool evaluate(const AIPtr &entity) override
Checks whether the condition evaluates to true for the given entity.
Definition: IsCloseToGroup.h:43
#define CONDITION_FACTORY(ConditionName)
A condition factory macro to ease and unify the registration at AIRegistry.
Definition: ICondition.h:55