Example #1
0
        public virtual void MoveShipHere(NPCShip npc)
        {
            if (npc.GetArea() != null)
            {
                npc.GetArea().RemoveShip(npc);
            }

            AddShip(npc);
        }
Example #2
0
        public override void MoveShipHere(NPCShip npc)
        {
            if (npc.GetArea() != null)
            {
                npc.GetArea().RemoveShip(npc);
            }

            addShip(npc);
        }
Example #3
0
        public override void MoveShipHere(NPCShip npc)
        {
            if (npc.CurrentAreaId != null)
            {
                npc.GetArea().RemoveShip(npc);
            }

            AddShip(npc);
        }
Example #4
0
        public virtual void RemoveShip(NPCShip npc)
        {
            ISimulatable temp;

            _model.ShipIDs.Remove(npc.Id);
            _shipCache.Remove(npc.Id);

            SimulatableObjects.TryRemove(npc.Id, out temp);

            MessageRemoveKillRevive msgData = new MessageRemoveKillRevive {
                ActionType = ActionType.Remove, ObjectType = RemovableObjectTypes.Ship
            };

            msgData.ObjectIDs.Add(npc.Id);
            BroadcastMessage(new NetworkMessageContainer(msgData, MessageTypes.RemoveKillRevive));
        }
Example #5
0
        public virtual void AddShip(NPCShip npc, bool suspendNetworking = false)
        {
            _model.ShipIDs.Add(npc.Id);
            lock (SHIPLOCK)
            {
                if (!_shipCache.ContainsKey(npc.Id))
                {
                    _shipCache.Add(npc.Id, npc);//Somehow, this sometimes throws an exception. Ergo lock.
                }
            }
            SimulatableObjects.TryAdd(npc.Id, npc);

            if (!suspendNetworking)
            {
                var messageData = new MessageReceiveNewShips();
                messageData.Ships.Add(npc.GetNetworkData(true, true, false, true));
                BroadcastMessage(new NetworkMessageContainer(messageData, MessageTypes.ReceiveNewShips), npc.PlayerID);
            }
        }
Example #6
0
 public override void RemoveShip(NPCShip npc)
 {
     _model.ShipIDs.Remove(npc.Id);
     _shipCache.Remove(npc.Id);
 }
Example #7
0
 public override void AddShip(NPCShip npc, bool suspendNetworking)
 {
     _model.ShipIDs.Add(npc.Id);
     _shipCache.Add(npc.Id, npc);
 }