Instructions Jenkins Doxygen

[Fixed] stability issue 75/2375/2
authorIvojedi <ivojedi@swgemu.com>
Tue, 26 Aug 2014 12:21:16 +0000 (05:21 -0700)
committerIvojedi <ivojedi@swgemu.com>
Tue, 26 Aug 2014 13:06:41 +0000 (06:06 -0700)
[Changed] mob spawning will no longer be triggered by invisible players

Change-Id: Ied16d676437dccba4b5bc4993920b13dd8f51dd4

MMOCoreORB/src/server/zone/objects/area/SpawnAreaImplementation.cpp
MMOCoreORB/src/server/zone/objects/creature/AiAgentImplementation.cpp
MMOCoreORB/src/server/zone/objects/creature/events/DespawnCreatureOnPlayerDissappear.h
MMOCoreORB/src/server/zone/objects/creature/events/InvisibleDelayEvent.h
MMOCoreORB/src/server/zone/objects/tangible/LairObject.idl

index 1b33672..45b5908 100644 (file)
@@ -102,6 +102,11 @@ void SpawnAreaImplementation::notifyEnter(SceneObject* object) {
        if (!object->isPlayerCreature())
                return;
 
+       CreatureObject* creo = cast<CreatureObject*>(object);
+       if (creo->isInvisible()) {
+               return;
+       }
+
        ManagedReference<SceneObject*> parent = object->getParent();
 
        if (parent != NULL && parent->isCellObject())
@@ -122,7 +127,7 @@ void SpawnAreaImplementation::notifyPositionUpdate(QuadTreeEntry* obj) {
        if (creature == NULL)
                return;
 
-       if (!creature->isPlayerCreature())
+       if (!creature->isPlayerCreature() || creature->isInvisible())
                return;
 
        ManagedReference<SceneObject*> parent = creature->getParent();
index 69d0d4b..f751f61 100644 (file)
@@ -801,8 +801,11 @@ void AiAgentImplementation::notifyInsert(QuadTreeEntry* entry) {
                return;
 
        if (scno->isPlayerCreature()) {
-               numberOfPlayersInRange.increment();
-               activateMovementEvent();
+               CreatureObject* creo = cast<CreatureObject*>(scno);
+               if (!creo->isInvisible()) {
+                       numberOfPlayersInRange.increment();
+                       activateMovementEvent();
+               }
        }
 }
 
@@ -972,35 +975,39 @@ void AiAgentImplementation::notifyDissapear(QuadTreeEntry* entry) {
        if (scno == followObject) {
                class SetObliviousTask : public Task {
                        ManagedReference<AiAgent*> ai;
+                       ManagedReference<SceneObject*> sceno;
 
                public:
-                       SetObliviousTask(AiAgent* mob) : ai(mob) {}
+                       SetObliviousTask(AiAgent* mob, SceneObject* scno) : ai(mob), sceno(scno) {}
 
                        void run() {
                                Locker locker(ai);
-                               ai->setOblivious();
-                               ai->storeFollowObject();
+                               if (sceno == ai->getFollowObject()) {
+                                       ai->setOblivious();
+                                       ai->storeFollowObject();
+                               }
                        }
                };
 
-               SetObliviousTask* task = new SetObliviousTask(_this.get().get());
+               SetObliviousTask* task = new SetObliviousTask(_this.get().get(), scno);
                task->execute();
        }
 
        if (scno->isPlayerCreature()) {
-               int32 newValue = (int32) numberOfPlayersInRange.decrement();
+               CreatureObject* creo = cast<CreatureObject*>(scno);
+               if (!creo->isInvisible()) {
+                       int32 newValue = (int32) numberOfPlayersInRange.decrement();
+
+                       if ((newValue == 0) && despawnOnNoPlayerInRange
+                                       && (despawnEvent == NULL) && !isPet()) {
+                               despawnEvent = new DespawnCreatureOnPlayerDissappear(_this.get());
+                               despawnEvent->schedule(30000);
+                       } else if (newValue < 0) {
+                               error("numberOfPlayersInRange below 0");
+                       }
 
-               if ((newValue == 0)
-                               && despawnOnNoPlayerInRange
-                               && (despawnEvent == NULL)
-                               && !isPet()) {
-                       despawnEvent = new DespawnCreatureOnPlayerDissappear(_this.get());
-                       despawnEvent->schedule(30000);
-               } else if (newValue < 0) {
-                       error("numberOfPlayersInRange below 0");
+                       activateMovementEvent();
                }
-
-               activateMovementEvent();
        }
 }
 
index 770d0c9..936f1d9 100644 (file)
@@ -43,7 +43,7 @@ public:
                if (!strongRef->getDespawnOnNoPlayerInRange())
                        return;
 
-               if (strongRef->inRangeObjects(SceneObjectType::PLAYERCREATURE, 128) == 0 && strongRef->getNumberOfPlayersInRange() <= 0) {
+               if (strongRef->getNumberOfPlayersInRange() <= 0) {
                        strongRef->destroyObjectFromWorld(true);
                        strongRef->notifyDespawn(zone);
                }
index e011f49..bf7afb1 100644 (file)
@@ -88,7 +88,7 @@ public:
                                        for (int i = 0; i < closeObjects->size(); ++i) {
                                                SceneObject* scno = cast<SceneObject*>( closeObjects->get(i).get());
 
-                                               if (scno != player)
+                                               if (scno != player && !scno->isBuildingObject())
                                                                scno->notifyDissapear(player);
 
                                        }
@@ -106,7 +106,7 @@ public:
                                        for (int i = 0; i < closeObjects->size(); ++i) {
                                                SceneObject* scno = cast<SceneObject*>( closeObjects->get(i).get());
 
-                                               if (scno != player)
+                                               if (scno != player && !scno->isBuildingObject())
                                                                scno->notifyInsert(player);
 
                                        }
index 56c90f5..1f20143 100644 (file)
@@ -46,6 +46,7 @@ package server.zone.objects.tangible;
 
 import server.zone.objects.tangible.TangibleObject;
 import server.zone.objects.tangible.DespawnLairOnPlayerDisappear;
+import server.zone.objects.creature.CreatureObject;
 include engine.util.u3d.CloseObjectsVector;
 include engine.util.u3d.QuadTreeEntry;
 
@@ -86,8 +87,11 @@ class LairObject extends TangibleObject {
                        return;
                
                if (obj.isPlayerCreature()) {
-                       numberOfPlayersInRange++;
-                       clearDespawnEvent();
+                       CreatureObject creo = (CreatureObject) obj;
+                       if (!creo.isInvisible()) {
+                               numberOfPlayersInRange++;
+                               clearDespawnEvent();
+                       }
                }
        }
        
@@ -98,10 +102,13 @@ class LairObject extends TangibleObject {
                        return;
                
                if (obj.isPlayerCreature()) {
-                       numberOfPlayersInRange = numberOfPlayersInRange - 1;
-                       
-                       if (numberOfPlayersInRange <= 0 && despawnOnNoPlayersInRange)
-                               activateDespawnEvent();
+                       CreatureObject creo = (CreatureObject) obj;
+                       if (!creo.isInvisible()) {
+                               numberOfPlayersInRange = numberOfPlayersInRange - 1;
+
+                               if (numberOfPlayersInRange <= 0 && despawnOnNoPlayersInRange)
+                                       activateDespawnEvent();
+                       }
                }
        }