Instructions Jenkins Doxygen

(unstable) [added] Message passing interrupt system for behavior trees 38/2038/1
authordannuic <dannuic@swgemu.com>
Sat, 12 Jul 2014 04:34:43 +0000 (22:34 -0600)
committerdannuic <dannuic@swgemu.com>
Sat, 12 Jul 2014 04:34:43 +0000 (22:34 -0600)
(unstable) [removed] Old interrupt system for behavior trees
(unstable) [removed] Unused classes (obsolete with behavior trees)

Change-Id: Ib4c20e1351e2ff8da8d126a4a4303041ba5cc716

34 files changed:
MMOCoreORB/bin/scripts/ai/actions/wait.lua
MMOCoreORB/bin/scripts/ai/actions/walk.lua
MMOCoreORB/bin/scripts/ai/ai.lua
MMOCoreORB/bin/scripts/ai/tasks/composite.lua
MMOCoreORB/bin/scripts/ai/tasks/nondeterministicselector.lua
MMOCoreORB/bin/scripts/ai/tasks/nondeterministicsequence.lua
MMOCoreORB/bin/scripts/ai/tasks/parallelselector.lua
MMOCoreORB/bin/scripts/ai/tasks/parallelsequence.lua
MMOCoreORB/bin/scripts/ai/tasks/selector.lua
MMOCoreORB/bin/scripts/ai/tasks/sequence.lua
MMOCoreORB/src/Makefile.am
MMOCoreORB/src/server/zone/managers/creature/CreatureManagerImplementation.cpp
MMOCoreORB/src/server/zone/managers/creature/LairObserverImplementation.cpp
MMOCoreORB/src/server/zone/managers/creature/SpawnObserver.idl
MMOCoreORB/src/server/zone/managers/director/DirectorManager.cpp
MMOCoreORB/src/server/zone/managers/object/ObjectManager.cpp
MMOCoreORB/src/server/zone/managers/object/objects.h
MMOCoreORB/src/server/zone/objects/area/SpawnArea.idl
MMOCoreORB/src/server/zone/objects/creature/AiAgent.idl
MMOCoreORB/src/server/zone/objects/creature/AiAgentImplementation.cpp
MMOCoreORB/src/server/zone/objects/creature/CreatureObject.idl
MMOCoreORB/src/server/zone/objects/creature/ai/bt/Behavior.h
MMOCoreORB/src/server/zone/objects/creature/ai/bt/LuaBehavior.cpp
MMOCoreORB/src/server/zone/objects/creature/ai/bt/LuaBehavior.h
MMOCoreORB/src/server/zone/objects/creature/aigroup/AiGroup.idl [deleted file]
MMOCoreORB/src/server/zone/objects/creature/aigroup/AiGroupImplementation.cpp [deleted file]
MMOCoreORB/src/server/zone/objects/creature/aigroup/AiGroupObserver.idl [deleted file]
MMOCoreORB/src/server/zone/objects/creature/aigroup/HerdGroup.idl [deleted file]
MMOCoreORB/src/server/zone/objects/creature/aigroup/HerdGroupImplementation.cpp [deleted file]
MMOCoreORB/src/server/zone/objects/creature/aigroup/LairGroup.idl [deleted file]
MMOCoreORB/src/server/zone/objects/creature/aigroup/LairGroupImplementation.cpp [deleted file]
MMOCoreORB/src/server/zone/objects/creature/aigroup/PackGroup.idl [deleted file]
MMOCoreORB/src/server/zone/objects/creature/aigroup/PackGroupImplementation.cpp [deleted file]
MMOCoreORB/src/server/zone/objects/scene/ObserverEventType.h

index d0fc1e5..9968660 100644 (file)
@@ -3,7 +3,6 @@ Wait = Ai:new {}
 function Wait:start(pAgent)
        self:setWait(pAgent)
        
-       createObserver(STARTCOMBAT, "Wait", "interrupt", pAgent)
        return 0
 end
 
@@ -23,7 +22,6 @@ function Wait:terminate(pAgent)
                agent:setWait(0)
        end
        
-       dropObserver(STARTCOMBAT, pAgent)
        return 0
 end
 
index 6bbb054..df84d77 100644 (file)
@@ -1,15 +1,5 @@
 Walk = Move:new {}
 
-function Walk:start(pAgent)
-       createObserver(STARTCOMBAT, "Walk", "interrupt", pAgent)
-       return 0
-end
-
-function Walk:terminate(pAgent)
-       dropObserver(STARTCOMBAT, pAgent)
-       return 0
-end
-
 -- overrides so that we walk instead of run
 function Walk:findNextPosition(pAgent)
        if (pAgent ~= nil) then
index 9aac694..5ced3a0 100644 (file)
@@ -25,12 +25,14 @@ function Ai:doAction(pAgent)
        return BEHAVIOR_SUCCESS
 end
 
-function Ai:interrupt(pAgent)
-       self:terminate(pAgent)
-       if (pAgent ~= nil) then
-               local agent = LuaAiAgent(pAgent)
-               agent:setBehaviorStatus(BEHAVIOR_SUSPEND)
-               agent:resetBehaviorList()
-               agent:executeBehavior()
+function Ai:interrupt(pAgent, pObject, msg)
+       if msg == STARTCOMBAT then
+               self:terminate(pAgent)
+               if (pAgent ~= nil) then
+                       local agent = LuaAiAgent(pAgent)
+                       agent:setBehaviorStatus(BEHAVIOR_SUSPEND)
+                       agent:resetBehaviorList()
+                       agent:executeBehavior()
+               end
        end
 end
index b08cae4..f54464a 100644 (file)
@@ -1,4 +1,4 @@
-Composite = {}
+Composite = Ai:new {}
 
 function Composite:checkConditions(pAgent)
        return 1
index 68af780..aac7df4 100644 (file)
@@ -1,4 +1,4 @@
-NonDeterministicSelector = {}
+NonDeterministicSelector = Ai:new {}
 
 function NonDeterministicSelector:checkConditions(pAgent)
        if (pAgent ~= nil) then
index f21c5f1..8ab73cb 100644 (file)
@@ -1,4 +1,4 @@
-NonDeterministicSequence = {}
+NonDeterministicSequence = Ai:new {}
 
 function NonDeterministicSequence:checkConditions(pAgent)
        if (pAgent ~= nil) then
index 39b52b2..d7def0d 100644 (file)
@@ -1,4 +1,4 @@
-ParallelSelector = {}
+ParallelSelector = Ai:new {}
 
 function ParallelSelector:checkConditions(pAgent)
        if (pAgent ~= nil) then
index faa53d4..98f2952 100644 (file)
@@ -1,4 +1,4 @@
-ParallelSequence = {}
+ParallelSequence = Ai:new {}
 
 function ParallelSequence:checkConditions(pAgent)
        if (pAgent ~= nil) then
index 1c39352..092656f 100644 (file)
@@ -1,4 +1,4 @@
-Selector = {}
+Selector = Ai:new {}
 
 function Selector:checkConditions(pAgent)
        if (pAgent ~= nil) then
index bbe4c2f..dcafff4 100644 (file)
@@ -1,4 +1,4 @@
-Sequence = {}
+Sequence = Ai:new {}
 
 function Sequence:checkConditions(pAgent)
        if (pAgent ~= nil) then
index 5a79620..0377824 100644 (file)
@@ -175,11 +175,6 @@ core3_IDLS =       autogen/server/zone/managers/creature/DynamicSpawnObserver.cpp \
                                autogen/server/zone/objects/creature/Creature.cpp \
                                autogen/server/zone/objects/creature/AiAgent.cpp \
                                autogen/server/zone/objects/creature/buffs/Buff.cpp \
-                               autogen/server/zone/objects/creature/aigroup/AiGroup.cpp \
-                               autogen/server/zone/objects/creature/aigroup/HerdGroup.cpp \
-                               autogen/server/zone/objects/creature/aigroup/LairGroup.cpp \
-                               autogen/server/zone/objects/creature/aigroup/PackGroup.cpp \
-                               autogen/server/zone/objects/creature/aigroup/AiGroupObserver.cpp \
                                autogen/server/zone/objects/creature/buffs/DelayedBuff.cpp \
                                autogen/server/zone/objects/creature/buffs/SpiceBuff.cpp \
                                autogen/server/zone/objects/creature/buffs/PowerBoostBuff.cpp \
@@ -639,10 +634,6 @@ core3_SOURCES =    $(core3_IDLS) \
                server/zone/objects/creature/ai/bt/ParallelSequenceBehavior.cpp \
                server/zone/objects/creature/ai/bt/ParallelSelectorBehavior.cpp \
                server/zone/objects/creature/ai/bt/LuaBehavior.cpp \
-               server/zone/objects/creature/aigroup/AiGroupImplementation.cpp \
-               server/zone/objects/creature/aigroup/HerdGroupImplementation.cpp \
-               server/zone/objects/creature/aigroup/LairGroupImplementation.cpp \
-               server/zone/objects/creature/aigroup/PackGroupImplementation.cpp \
                server/zone/objects/creature/conversation/ConversationObserverImplementation.cpp \
                server/zone/objects/creature/conversation/TrainerConversationObserverImplementation.cpp \
                server/zone/objects/creature/conversation/DeliverMissionConversationObserverImplementation.cpp \
index 88d7d8f..ffe4909 100644 (file)
@@ -131,7 +131,7 @@ SceneObject* CreatureManagerImplementation::spawnLair(unsigned int lairTemplate,
 
        building->registerObserver(ObserverEventType::OBJECTDESTRUCTION, lairObserver);
        building->registerObserver(ObserverEventType::DAMAGERECEIVED, lairObserver);
-
+       building->registerObserver(ObserverEventType::AIMESSAGE, lairObserver);
 
        zone->transferObject(building, -1, false);
 
index 5429012..821c777 100644 (file)
@@ -60,26 +60,46 @@ which carries forward this exception.
 #include "server/zone/managers/creature/DisseminateExperienceTask.h"
 
 int LairObserverImplementation::notifyObserverEvent(unsigned int eventType, Observable* observable, ManagedObject* arg1, int64 arg2) {
+       int ret = 1;
+       int i = 0;
+
+       Reference<LairAggroTask*> task = NULL;
+       SceneObject* sourceObject = cast<SceneObject*>(arg1);
+       AiAgent* agent = NULL;
+
        switch (eventType) {
        case ObserverEventType::OBJECTDESTRUCTION:
                notifyDestruction(cast<TangibleObject*>(observable), cast<TangibleObject*>(arg1), (int)arg2);
                return 1;
                break;
        case ObserverEventType::DAMAGERECEIVED:
-
-               int livingCreatureCount = getLivingCreatureCount();
-
                // if there are living creatures, make them aggro
-               if(livingCreatureCount > 0 ){
-                       Reference<LairAggroTask*> task = new LairAggroTask(cast<TangibleObject*>(observable), cast<TangibleObject*>(arg1), _this.get(), false);
+               if(getLivingCreatureCount() > 0 ){
+                       task = new LairAggroTask(cast<TangibleObject*>(observable), cast<TangibleObject*>(arg1), _this.get(), false);
                        task->execute();
                }
 
                // if new creatures have spawned or there are live creatures near the lair
-               if( checkForNewSpawns(cast<TangibleObject*>(observable), cast<TangibleObject*>(arg1)) || livingCreatureCount > 0 )
+               if( checkForNewSpawns(cast<TangibleObject*>(observable), cast<TangibleObject*>(arg1)) || getLivingCreatureCount() > 0 )
                        checkForHeal(cast<TangibleObject*>(observable), cast<TangibleObject*>(arg1));
 
                break;
+       case ObserverEventType::AIMESSAGE:
+               if (sourceObject == NULL) {
+                       Logger::console.error("LairObserverImplemenation::notifyObserverEvent does not have a source object");
+                       return 1;
+               }
+
+               for (i = 0; i < spawnedCreatures.size(); i++) {
+                       agent = cast<AiAgent*>(spawnedCreatures.get(i).get());
+                       if (agent == NULL)
+                               continue;
+
+                       if (agent->interrupt(sourceObject, arg2) != 0)
+                               return 1;
+               }
+
+               break;
        }
 
        return 0;
index 5e9d585..0b9cac4 100644 (file)
@@ -74,9 +74,9 @@ class SpawnObserver extends Observer implements Logger {
                size = 20;
        }
 
-       public native int notifyObserverEvent(unsigned int eventType, Observable observable, ManagedObject arg1, long arg2) {
+       public abstract int notifyObserverEvent(unsigned int eventType, Observable observable, ManagedObject arg1, long arg2) {
                return 1;
-}
+       }
 
        @local
        public void setLairTemplate(LairTemplate tmpl) {
index 13c27d4..f962360 100644 (file)
@@ -252,6 +252,7 @@ void DirectorManager::initializeLuaEngine(Lua* luaEngine) {
        luaEngine->setGlobalInt("FACTIONBASEFLIPPED", ObserverEventType::FACTIONBASEFLIPPED);
        luaEngine->setGlobalInt("LOOTCREATURE", ObserverEventType::LOOTCREATURE);
        luaEngine->setGlobalInt("SCREENPLAYSTATECHANGED", ObserverEventType::SCREENPLAYSTATECHANGED);
+       luaEngine->setGlobalInt("AIMESSAGE", ObserverEventType::AIMESSAGE);
 
        luaEngine->setGlobalInt("UPRIGHT", CreaturePosture::UPRIGHT);
        luaEngine->setGlobalInt("PRONE", CreaturePosture::PRONE);
index 91d52f3..19a2428 100644 (file)
@@ -344,11 +344,6 @@ void ObjectManager::registerObjectTypes() {
 
        objectFactory.registerObject<FactoryCrate>(SceneObjectType::FACTORYCRATE);
 
-       objectFactory.registerObject<AiGroup>(SceneObjectType::AIGROUP);
-       objectFactory.registerObject<HerdGroup>(SceneObjectType::HERDGROUP);
-       objectFactory.registerObject<PackGroup>(SceneObjectType::PACKGROUP);
-       objectFactory.registerObject<LairGroup>(SceneObjectType::LAIRGROUP);
-
        objectFactory.registerObject<FighterShipObject>(SceneObjectType::SHIPFIGHTER);
        objectFactory.registerObject<SpaceStationObject>(SceneObjectType::SHIPSTATION);
 
index d218ea5..5b76b5f 100644 (file)
 #include "server/zone/objects/area/MissionReconActiveArea.h"
 #include "server/zone/objects/area/SpawnArea.h"
 
-#include "server/zone/objects/creature/aigroup/AiGroup.h"
-#include "server/zone/objects/creature/aigroup/HerdGroup.h"
-#include "server/zone/objects/creature/aigroup/PackGroup.h"
-#include "server/zone/objects/creature/aigroup/LairGroup.h"
-
 #endif /* OBJECTS_H_ */
index 3362d79..5405c61 100644 (file)
@@ -48,7 +48,6 @@ import server.zone.objects.area.ActiveArea;
 import system.util.SortedVector;
 import system.util.HashTable;
 import engine.core.ManagedObject;
-import server.zone.objects.creature.aigroup.AiGroup;
 import server.zone.managers.creature.SpawnGroup;
 import server.zone.objects.area.SpawnAreaObserver;
 import engine.util.Observable;
index 49e70e4..ebe1a4d 100644 (file)
@@ -883,8 +883,18 @@ class AiAgent extends CreatureObject {
        
        @local
        public native void clearBehaviorList();
+       
+       @local
+       public native int interrupt(SceneObject source, long msg);
 
        public native void setHomeObject(SceneObject home) {
                homeObject = home;
        }
+       
+       /**
+        * Sets the combat state
+        * @pre { this object is locked }
+        * @post { this object is locked, this object is in a combat state }
+        */
+       public native void setCombatState();
 }
index d907068..db3c9e5 100644 (file)
 #include "variables/CreatureAttackMap.h"
 #include "variables/CreatureTemplateReference.h"
 #include "variables/CurrentFoundPath.h"
-#include "server/zone/managers/director/DirectorManager.h"
 
 #include "server/chat/ChatManager.h"
 
@@ -2280,6 +2279,9 @@ void AiAgentImplementation::resetBehaviorList() {
        Behavior* b = behaviors.get(currentBehaviorID);
        b->setStatus(AiMap::SUSPEND);
 
+       stopWaiting();
+       setWait(0);
+
        Locker locker(&movementEventMutex);
        if (moveEvent != NULL)
                moveEvent->cancel();
@@ -2299,3 +2301,22 @@ void AiAgentImplementation::clearBehaviorList() {
        currentBehaviorID = "";
        behaviors.removeAll();
 }
+
+int AiAgentImplementation::interrupt(SceneObject* source, int64 msg) {
+       Locker bLocker(&behaviorMutex);
+       Behavior* b = behaviors.get(currentBehaviorID);
+
+       if (b == NULL)
+               return 1;
+
+       return b->interrupt(source, msg);
+}
+
+void AiAgentImplementation::setCombatState() {
+       CreatureObjectImplementation::setCombatState();
+
+       if (homeObject != NULL)
+               homeObject->notifyObservers(ObserverEventType::AIMESSAGE, _this.get(), ObserverEventType::STARTCOMBAT);
+
+       interrupt(_this.get(), ObserverEventType::STARTCOMBAT);
+}
index ba36ebe..f1f2397 100644 (file)
@@ -371,7 +371,7 @@ class CreatureObject extends TangibleObject {
         * @pre { this object is locked }
         * @post { this object is locked, this object is in a combat state }
         */
-       public native void setCombatState();
+       public abstract native void setCombatState();
        
        /**
         * Cleares the combat state
index eae0ece..f954026 100644 (file)
@@ -103,6 +103,10 @@ public:
         */
        virtual void doAction();
 
+       virtual int interrupt(SceneObject* source, int64 msg) {
+               return interface->interrupt(agent.get(), source, msg);
+       }
+
        /**
         * End the behavior with success
         */
index 84f40de..5893090 100644 (file)
@@ -8,6 +8,7 @@
 #include "LuaBehavior.h"
 #include "server/zone/managers/director/DirectorManager.h"
 #include "server/zone/managers/creature/AiMap.h"
+#include "server/zone/objects/scene/SceneObject.h"
 #include "engine/engine.h"
 
 
@@ -88,3 +89,20 @@ int LuaBehavior::doAction(AiAgent* agent) {
 
        return result;
 }
+
+int LuaBehavior::interrupt(AiAgent* agent, SceneObject* source, int64 msg) {
+       Lua* lua = DirectorManager::instance()->getLuaInstance();
+
+       LuaFunction messageFunc(lua->getLuaState(), className, "interrupt", 1);
+       messageFunc << agent;
+       messageFunc << source; //arg1
+       messageFunc << msg; //arg2
+
+       messageFunc.callFunction();
+
+       int result = lua_tointeger(lua->getLuaState(), -1);
+       lua_pop(lua->getLuaState(), 1);
+
+       //1 remove observer, 0 keep observer
+       return result;
+}
index b5a569d..3029dab 100644 (file)
 namespace server {
 namespace zone {
 namespace objects {
+
+namespace scene {
+class SceneObject;
+}
+
+using namespace server::zone::objects::scene;
+
 namespace creature {
 class AiAgent;
 namespace ai {
@@ -43,6 +50,7 @@ public:
        void start(AiAgent* agent);
        float end(AiAgent* agent);
        int doAction(AiAgent* agent);
+       int interrupt(AiAgent* agent, SceneObject* source, int64 msg);
 
        virtual uint16 getType();
 
diff --git a/MMOCoreORB/src/server/zone/objects/creature/aigroup/AiGroup.idl b/MMOCoreORB/src/server/zone/objects/creature/aigroup/AiGroup.idl
deleted file mode 100644 (file)
index 94b9f6b..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
-Copyright (C) 2007 <SWGEmu>
-
-This File is part of Core3.
-
-This program is free software; you can redistribute
-it and/or modify it under the terms of the GNU Lesser
-General Public License as published by the Free Software
-Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-See the GNU Lesser General Public License for
-more details.
-
-You should have received a copy of the GNU Lesser General
-Public License along with this program; if not, write to
-the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Linking Engine3 statically or dynamically with other modules
-is making a combined work based on Engine3.
-Thus, the terms and conditions of the GNU Lesser General Public License
-cover the whole combination.
-
-In addition, as a special exception, the copyright holders of Engine3
-give you permission to combine Engine3 program with free software
-programs or libraries that are released under the GNU LGPL and with
-code included in the standard release of Core3 under the GNU LGPL
-license (or modified versions of such code, with unchanged license).
-You may copy and distribute such a system following the terms of the
-GNU LGPL for Engine3 and the licenses of the other code concerned,
-provided that you include the source code of that other code when
-and as the GNU LGPL requires distribution of source code.
-
-Note that people who make modified versions of Engine3 are not obligated
-to grant this special exception for their modified versions;
-it is their choice whether to do so. The GNU Lesser General Public License
-gives permission to release a modified version without this exception;
-this exception also makes it possible to release a modified version
-which carries forward this exception.
-*/
-
-package server.zone.objects.creature.aigroup;
-
-import server.zone.Zone;
-import server.zone.objects.scene.SceneObject;
-import engine.core.ManagedObject;
-import engine.util.u3d.Coordinate;
-import system.util.SortedVector;
-import system.util.Vector;
-import server.zone.objects.creature.AiAgent;
-import engine.util.Observable;
-import server.zone.objects.creature.aigroup.AiGroupObserver;
-
-class AiGroup extends SceneObject {
-       protected SceneObject leader;
-       
-       @dereferenced
-       protected SortedVector<AiAgent> scouts;
-       
-       @dereferenced
-       protected Vector<string> scoutTemps;
-       
-       @dereferenced
-       protected SortedVector<AiAgent> protectors;
-       
-       @dereferenced
-       protected Vector<string> protectorTemps;
-       
-       @dereferenced
-       protected SortedVector<AiAgent> babies;
-       
-       @dereferenced
-       protected Vector<string> babyTemps;
-       
-       @dereferenced
-       protected SortedVector<AiGroup> subgroups;      
-       
-       @dereferenced
-       protected SortedVector<AiGroupObserver> observers;
-       
-       protected int commandLevel;
-       protected float wanderRadius;
-       protected int size;
-       
-       protected float scoutWeight;
-       protected float protectorWeight;
-       protected float babyWeight;
-       
-       protected boolean isStatic;
-       
-       public AiGroup() {
-               Logger.setLoggingName("AiGroup");
-               
-               commandLevel = 0;
-               wanderRadius = 0;
-               size = 0;
-               
-               isStatic = true;
-       }
-       
-       public native void setPatrolPoints();
-       public native void setPatrolPoint(AiAgent member);
-       
-       //@local
-       //public native void setup(StaticSpawnGroup templ);
-       
-       //@local
-       //public native void setup(DynamicSpawnGroup templ);
-       
-       public native int notifyObserverEvent(unsigned int eventType, Observable observable, ManagedObject arg1, long arg2);
-       
-       public abstract boolean isHerdGroup() {
-               return false;
-       }
-       
-       public abstract boolean isPackGroup() {
-               return false;
-       }
-       
-       public abstract boolean isLairGroup() {
-               return false;
-       }
-}
diff --git a/MMOCoreORB/src/server/zone/objects/creature/aigroup/AiGroupImplementation.cpp b/MMOCoreORB/src/server/zone/objects/creature/aigroup/AiGroupImplementation.cpp
deleted file mode 100644 (file)
index 77ab98c..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * AiGroupImplementation.cpp
- *
- *  Created on: Oct 31, 2010
- *      Author: dannuic
- */
-
-#include "server/zone/objects/creature/aigroup/AiGroup.h"
-#include "server/zone/objects/creature/aigroup/AiGroupObserver.h"
-#include "server/zone/objects/creature/PatrolPoint.h"
-#include "server/zone/objects/creature/PatrolPointsVector.h"
-#include "engine/util/u3d/Coordinate.h"
-#include "server/zone/objects/creature/CreatureFlag.h"
-#include "server/zone/objects/creature/AiAgent.h"
-#include "server/zone/managers/creature/SpawnGroup.h"
-#include "server/zone/managers/creature/CreatureManager.h"
-#include "server/zone/managers/planet/PlanetManager.h"
-#include "server/zone/objects/scene/SceneObject.h"
-
-void AiGroupImplementation::setPatrolPoints() {
-       if (wanderRadius == 0)
-               return;
-
-       for (int i = 0; i < scouts.size(); ++i)
-               setPatrolPoint(scouts.get(i));
-
-       for (int i = 0; i < protectors.size(); ++i)
-               setPatrolPoint(protectors.get(i));
-
-       for (int i = 0; i < babies.size(); ++i)
-               setPatrolPoint(babies.get(i));
-}
-
-void AiGroupImplementation::setPatrolPoint(AiAgent* member) {
-       if (member == NULL)
-               return;
-
-       if (member == leader && !isStatic) {
-               setPosition(member->getPositionX(), member->getPositionZ(), member->getPositionY());
-               // TODO: check to make sure not wandering into static areas and out of original area
-       }
-
-       Coordinate coord(getPositionX(), 0, getPositionY());
-
-       float radius = wanderRadius;
-       if (scouts.contains(member))
-               radius *= 3;
-
-       coord.randomizePosition(radius);
-
-       member->setNextPosition(coord.getPositionX(), getZone()->getHeight(coord.getPositionX(), coord.getPositionY()), coord.getPositionY(), getParent().get());
-       member->activateWaitEvent();
-}
-
-/*void AiGroupImplementation::setup(StaticSpawnGroup* templ) {
-       // in static groups, all members are protectors
-       // designate the first in the template as the leader
-       isStatic = true;
-
-       CreatureManager* cm = getZone()->getCreatureManager();
-       if (cm == NULL)
-               return;
-
-       commandLevel = templ->getCommandLevel();
-       wanderRadius = templ->getWanderRadius();
-
-       uint64 cellID = templ->getCellID();
-
-       if (cellID != 0) {
-               Reference<SceneObject*> cellParent = getZone()->getZoneServer()->getObject(cellID);
-
-               if (cellParent != NULL) {
-                       if (!cellParent->isCellObject())
-                               cellParent = NULL;
-                       else
-                               cellParent->transferObject(_this.get(), -1);
-               }
-
-               //setParent(cellParent);
-       }
-
-       Vector<SpawnCoordinate>* members = templ->getSpawnList();
-
-       for (int i = 0; i < members->size(); ++i) {
-               SpawnCoordinate* protTempl = &members->get(i);
-
-               uint32 crc = protTempl->getTemplateName().hashCode();
-               Coordinate* coordinate = protTempl->getCoordinate();
-               float x = coordinate->getPositionX();
-               float z = coordinate->getPositionZ();
-               float y = coordinate->getPositionY();
-
-               if (cellID == 0) {
-                       x += getPositionX();
-                       y += getPositionY();
-                       z += getPositionZ();
-               }
-
-               ManagedReference<AiAgent*> prot = dynamic_cast<AiAgent*>(cm->spawnCreature(crc, 0, x, z, y, cellID));
-               if (prot == NULL)
-                       continue;
-
-               Quaternion* dir = protTempl->getDirection();
-
-               prot->setDirection(dir->getW(), dir->getX(), dir->getY(), dir->getZ());
-               prot->setRespawnTimer(templ->getRespawnTime());
-               prot->setHomeLocation(x, z, y, prot->getParent().get());
-
-               protectors.add(prot);
-
-               if (protectors.size() == 1)
-                       leader = prot;
-
-               AiGroupObserver* moveObserver = new AiGroupObserver(_this.get());
-               ObjectManager::instance()->persistObject(moveObserver, 1, "aiobservers");
-               prot->registerObserver(ObserverEventType::DESTINATIONREACHED, moveObserver);
-               observers.put(moveObserver);
-       }
-
-       setPatrolPoints();
-}
-
-void AiGroupImplementation::setup(DynamicSpawnGroup* templ) {
-       // dynamic groups specify scouts, protectors, and babies in the template
-       // don't assign the leader until the group spawns stuff
-       isStatic = false;
-
-       commandLevel = templ->getCommandLevel();
-       wanderRadius = templ->getWanderRadius();
-
-       size = templ->getSize();
-
-       scoutTemps = templ->getScoutTemplates();
-       scoutWeight = templ->getScoutWeight();
-
-       protectorTemps = templ->getProtectorTemplates();
-       protectorWeight = templ->getProtectorWeight();
-
-       babyTemps = templ->getBabyTemplates();
-       babyWeight = templ->getBabyWeight();
-
-       CreatureManager* cm = getZone()->getCreatureManager();
-
-       if (cm == NULL)
-               return;
-
-       for (int i = 0; i < 5; i++) {
-               uint32 templateCrc = 0;
-
-               float randomValue = System::random(10000) * 1.f / 10000.f;
-
-               if (randomValue < scoutWeight) {
-                       templateCrc = scoutTemps.get(System::random(scoutTemps.size() - 1)).hashCode();
-               } else if (randomValue < scoutWeight + protectorWeight) {
-                       templateCrc = protectorTemps.get(System::random(protectorTemps.size() - 1)).hashCode();
-               } else {
-                       templateCrc = babyTemps.get(System::random(babyTemps.size() - 1)).hashCode();
-               }
-
-               float x;
-               float y;
-               int retries = 20;
-               bool foundSpawnPoint = false;
-               while (retries-- > 0) {
-                       x = System::random(50) - 25 + getPositionX();
-                       y = System::random(50) - 25 + getPositionY();
-
-                       if (!getZone()-> getPlanetManager()->isInObjectsNoBuildZone(x, y, 2)) {
-                               foundSpawnPoint = true;
-                       }
-               }
-
-               if (foundSpawnPoint) {
-                       float z;
-                       z = getZone()->getHeight(x, y);
-
-                       CreatureObject* creature = cm->spawnCreature(templateCrc, 0, x, z, y, 0);
-                       creature->setDirection(System::random(360) * Math::DEG2RAD);
-               }
-       }
-
-       setPatrolPoints();
-}*/
-
-int AiGroupImplementation::notifyObserverEvent(uint32 eventType, Observable* observable, ManagedObject* arg1, int64 arg2) {
-       AiAgent* member = cast<AiAgent*>(observable);
-
-       switch (eventType) {
-       case ObserverEventType::DESTINATIONREACHED:
-               setPatrolPoint(member);
-               break;
-       default:
-               break;
-       }
-
-       return 0;
-}
diff --git a/MMOCoreORB/src/server/zone/objects/creature/aigroup/AiGroupObserver.idl b/MMOCoreORB/src/server/zone/objects/creature/aigroup/AiGroupObserver.idl
deleted file mode 100644 (file)
index e69754d..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-Copyright (C) 2007 <SWGEmu>
-This File is part of Core3.
-This program is free software; you can redistribute 
-it and/or modify it under the terms of the GNU Lesser 
-General Public License as published by the Free Software
-Foundation; either version 2 of the License, 
-or (at your option) any later version.
-This program is distributed in the hope that it will be useful, 
-but WITHOUT ANY WARRANTY; without even the implied warranty of 
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
-See the GNU Lesser General Public License for
-more details.
-You should have received a copy of the GNU Lesser General 
-Public License along with this program; if not, write to
-the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-Linking Engine3 statically or dynamically with other modules 
-is making a combined work based on Engine3. 
-Thus, the terms and conditions of the GNU Lesser General Public License 
-cover the whole combination.
-In addition, as a special exception, the copyright holders of Engine3 
-give you permission to combine Engine3 program with free software 
-programs or libraries that are released under the GNU LGPL and with 
-code included in the standard release of Core3 under the GNU LGPL 
-license (or modified versions of such code, with unchanged license). 
-You may copy and distribute such a system following the terms of the 
-GNU LGPL for Engine3 and the licenses of the other code concerned, 
-provided that you include the source code of that other code when 
-and as the GNU LGPL requires distribution of source code.
-Note that people who make modified versions of Engine3 are not obligated 
-to grant this special exception for their modified versions; 
-it is their choice whether to do so. The GNU Lesser General Public License 
-gives permission to release a modified version without this exception; 
-this exception also makes it possible to release a modified version 
-which carries forward this exception.
-*/
-
-package server.zone.objects.creature.aigroup;
-
-import engine.util.Observer;
-import engine.util.Observable;
-import server.zone.objects.creature.aigroup.AiGroup;
-import server.zone.objects.scene.SceneObject;
-
-class AiGroupObserver extends Observer implements Logger {
-       protected AiGroup aiGroup;
-       
-       public AiGroupObserver(AiGroup group) {
-               aiGroup = group;
-               
-               Logger.setLoggingName("AiGroupObserver");
-       }
-       
-       public abstract int notifyObserverEvent(unsigned int eventType, Observable observable, ManagedObject arg1, long arg2) {
-               if (aiGroup == null)
-                       return 0;
-               else
-                       return aiGroup.notifyObserverEvent(eventType, observable, arg1, arg2);
-       }
-}
diff --git a/MMOCoreORB/src/server/zone/objects/creature/aigroup/HerdGroup.idl b/MMOCoreORB/src/server/zone/objects/creature/aigroup/HerdGroup.idl
deleted file mode 100644 (file)
index 1d3cf30..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-Copyright (C) 2007 <SWGEmu>
-
-This File is part of Core3.
-
-This program is free software; you can redistribute
-it and/or modify it under the terms of the GNU Lesser
-General Public License as published by the Free Software
-Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-See the GNU Lesser General Public License for
-more details.
-
-You should have received a copy of the GNU Lesser General
-Public License along with this program; if not, write to
-the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Linking Engine3 statically or dynamically with other modules
-is making a combined work based on Engine3.
-Thus, the terms and conditions of the GNU Lesser General Public License
-cover the whole combination.
-
-In addition, as a special exception, the copyright holders of Engine3
-give you permission to combine Engine3 program with free software
-programs or libraries that are released under the GNU LGPL and with
-code included in the standard release of Core3 under the GNU LGPL
-license (or modified versions of such code, with unchanged license).
-You may copy and distribute such a system following the terms of the
-GNU LGPL for Engine3 and the licenses of the other code concerned,
-provided that you include the source code of that other code when
-and as the GNU LGPL requires distribution of source code.
-
-Note that people who make modified versions of Engine3 are not obligated
-to grant this special exception for their modified versions;
-it is their choice whether to do so. The GNU Lesser General Public License
-gives permission to release a modified version without this exception;
-this exception also makes it possible to release a modified version
-which carries forward this exception.
-*/
-
-package server.zone.objects.creature.aigroup;
-
-import server.zone.objects.creature.aigroup.AiGroup;
-
-class HerdGroup extends AiGroup {
-       
-       public HerdGroup() {
-               super();
-       }
-       
-       public boolean isHerdGroup() {
-               return true;
-       }
-}
diff --git a/MMOCoreORB/src/server/zone/objects/creature/aigroup/HerdGroupImplementation.cpp b/MMOCoreORB/src/server/zone/objects/creature/aigroup/HerdGroupImplementation.cpp
deleted file mode 100644 (file)
index 3e26445..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * HerdGroupImplementation.cpp
- *
- *  Created on: Oct 31, 2010
- *      Author: dannuic
- */
-
-#include "server/zone/objects/creature/aigroup/HerdGroup.h"
diff --git a/MMOCoreORB/src/server/zone/objects/creature/aigroup/LairGroup.idl b/MMOCoreORB/src/server/zone/objects/creature/aigroup/LairGroup.idl
deleted file mode 100644 (file)
index 4891ba7..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-Copyright (C) 2007 <SWGEmu>
-
-This File is part of Core3.
-
-This program is free software; you can redistribute
-it and/or modify it under the terms of the GNU Lesser
-General Public License as published by the Free Software
-Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-See the GNU Lesser General Public License for
-more details.
-
-You should have received a copy of the GNU Lesser General
-Public License along with this program; if not, write to
-the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Linking Engine3 statically or dynamically with other modules
-is making a combined work based on Engine3.
-Thus, the terms and conditions of the GNU Lesser General Public License
-cover the whole combination.
-
-In addition, as a special exception, the copyright holders of Engine3
-give you permission to combine Engine3 program with free software
-programs or libraries that are released under the GNU LGPL and with
-code included in the standard release of Core3 under the GNU LGPL
-license (or modified versions of such code, with unchanged license).
-You may copy and distribute such a system following the terms of the
-GNU LGPL for Engine3 and the licenses of the other code concerned,
-provided that you include the source code of that other code when
-and as the GNU LGPL requires distribution of source code.
-
-Note that people who make modified versions of Engine3 are not obligated
-to grant this special exception for their modified versions;
-it is their choice whether to do so. The GNU Lesser General Public License
-gives permission to release a modified version without this exception;
-this exception also makes it possible to release a modified version
-which carries forward this exception.
-*/
-
-package server.zone.objects.creature.aigroup;
-
-import server.zone.objects.creature.aigroup.AiGroup;
-
-class LairGroup extends AiGroup {
-       
-       public LairGroup() {
-               super();
-       }
-       
-       public boolean isLairGroup() {
-               return true;
-       }
-}
diff --git a/MMOCoreORB/src/server/zone/objects/creature/aigroup/LairGroupImplementation.cpp b/MMOCoreORB/src/server/zone/objects/creature/aigroup/LairGroupImplementation.cpp
deleted file mode 100644 (file)
index f4b84ed..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * LairGroupImplementation.cpp
- *
- *  Created on: Oct 31, 2010
- *      Author: da
- */
-
-#include "server/zone/objects/creature/aigroup/LairGroup.h"
diff --git a/MMOCoreORB/src/server/zone/objects/creature/aigroup/PackGroup.idl b/MMOCoreORB/src/server/zone/objects/creature/aigroup/PackGroup.idl
deleted file mode 100644 (file)
index 0f14d85..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-Copyright (C) 2007 <SWGEmu>
-
-This File is part of Core3.
-
-This program is free software; you can redistribute
-it and/or modify it under the terms of the GNU Lesser
-General Public License as published by the Free Software
-Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-See the GNU Lesser General Public License for
-more details.
-
-You should have received a copy of the GNU Lesser General
-Public License along with this program; if not, write to
-the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Linking Engine3 statically or dynamically with other modules
-is making a combined work based on Engine3.
-Thus, the terms and conditions of the GNU Lesser General Public License
-cover the whole combination.
-
-In addition, as a special exception, the copyright holders of Engine3
-give you permission to combine Engine3 program with free software
-programs or libraries that are released under the GNU LGPL and with
-code included in the standard release of Core3 under the GNU LGPL
-license (or modified versions of such code, with unchanged license).
-You may copy and distribute such a system following the terms of the
-GNU LGPL for Engine3 and the licenses of the other code concerned,
-provided that you include the source code of that other code when
-and as the GNU LGPL requires distribution of source code.
-
-Note that people who make modified versions of Engine3 are not obligated
-to grant this special exception for their modified versions;
-it is their choice whether to do so. The GNU Lesser General Public License
-gives permission to release a modified version without this exception;
-this exception also makes it possible to release a modified version
-which carries forward this exception.
-*/
-
-package server.zone.objects.creature.aigroup;
-
-import server.zone.objects.creature.aigroup.AiGroup;
-
-class PackGroup extends AiGroup {
-       
-       public PackGroup() {
-               super();
-       }
-       
-       public boolean isPackGroup() {
-               return true;
-       }
-}
diff --git a/MMOCoreORB/src/server/zone/objects/creature/aigroup/PackGroupImplementation.cpp b/MMOCoreORB/src/server/zone/objects/creature/aigroup/PackGroupImplementation.cpp
deleted file mode 100644 (file)
index 2f4b64a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * PackGroupImplementation.cpp
- *
- *  Created on: Oct 31, 2010
- *      Author: da
- */
-
-#include "server/zone/objects/creature/aigroup/PackGroup.h"
index b1c8914..c55f444 100644 (file)
@@ -65,6 +65,7 @@ public:
        const static int LOOTCREATURE                           = 53; // ManagedObject arg1 = player who is looting, long arg2 = 0, event occurs before looting starts, i.e. it is possible to change loot with this event.
        const static int SCREENPLAYSTATECHANGED         = 54; // ManagedObject arg1 = null, long arg2 = 0
        const static int CREATUREDESPAWNED                      = 55; // ManagedObject arg1 = AiAgent that despawned, long arg2 = 0
+       const static int AIMESSAGE                                      = 56; // ManagedObject arg1 = sender of the message (can be any SCNO), long arg2 = message
 };
 
 #endif /* OBSERVEREVENTTYPES_H_ */