Example #1
0
        /** Periodically called when a closeby door is on our path to the target. */
        private bool DealWithDoorOnPath(GameDoor nextDoor)
        {
            if (!Owner.Position.IsInRange(nextDoor.Position, nextDoor.InteractDistance))
            {
                return(true); // Next door is still too far away
            }

            if (nextDoor.IsOpen)
            {
                Owner.DebugSend("There is a door on the way, but it is open: {0}", nextDoor);
                return(true);
            }

            Owner.DebugSend("Trying to open door: {0}", nextDoor);
            if (nextDoor.InteractLiving(Owner, false))
            {
                // Door should either be open now, or we should have been teleported to the other side
                Owner.DebugSend("Interact with door succeeded; door should be open now");
                return(true);
            }

            // Door is blocked/other realm
            Owner.DebugSend("Interact with door failed; stopping movement");
            Owner.StopFollow();
            Owner.StopMoving();
            return(false);
        }