public string Enqueue(Ship ship) { lock (queue) { if (queue.Count >= maxCount) return "The spawn queue is full."; var removeList = queue.Where(i => i.Name == ship.Name).ToList(); foreach (var remove in removeList) { queue.Remove(remove); } queue.AddLast(ship); return "Your ship will spawn shortly."; } }
public static void HandleUpload(NetConnection connection, Packet packet) { var upload = (Upload)packet; var session = SessionManager.Get(connection.RemoteUniqueIdentifier); string message = null; if (session.Account == null) message = "You need to login to do that."; if (message == null) { var ship = new Ship(session.Account.Username, upload.Program); message = Game.SpawnQueue.Enqueue(ship); } var messagePacket = new Message() { Title = "Upload", Content = message }; Send(messagePacket, session); }
public static void Despawn(Ship ship) { World.RemoveBody(ship.Body); ships.Remove(ship); }