예제 #1
0
        public void ForceHome()
        {
            var homePos = GetPosition(PositionType.Home);

            if (DebugMove)
            {
                Console.WriteLine($"{Name} ({Guid}) - ForceHome({homePos.ToLOCString()})");
            }

            var setPos = new SetPosition();

            setPos.Pos   = new Physics.Common.Position(homePos);
            setPos.Flags = SetPositionFlags.Teleport;

            PhysicsObj.SetPosition(setPos);

            UpdatePosition_SyncLocation();

            SendUpdatePosition();

            var actionChain = new ActionChain();

            actionChain.AddDelaySeconds(0.5f);
            actionChain.AddAction(this, Sleep);
            actionChain.EnqueueChain();
        }
예제 #2
0
        /// <summary>
        /// For monsters only -- blips to a new position within the same landblock
        /// </summary>
        public void FakeTeleport(Position _newPosition)
        {
            var newPosition = new Position(_newPosition);

            newPosition.PositionZ += 0.005f * (ObjScale ?? 1.0f);

            if (Location.Landblock != newPosition.Landblock)
            {
                log.Error($"{Name} tried to teleport from {Location} to a different landblock {newPosition}");
                return;
            }

            // force out of hotspots
            PhysicsObj.report_collision_end(true);

            //HandlePreTeleportVisibility(newPosition);

            // do the physics teleport
            var setPosition = new Physics.Common.SetPosition();

            setPosition.Pos   = new Physics.Common.Position(newPosition);
            setPosition.Flags = Physics.Common.SetPositionFlags.SendPositionEvent | Physics.Common.SetPositionFlags.Slide | Physics.Common.SetPositionFlags.Placement | Physics.Common.SetPositionFlags.Teleport;

            PhysicsObj.SetPosition(setPosition);

            // update ace location
            SyncLocation();

            // broadcast blip to new position
            SendUpdatePosition(true);
        }