Beispiel #1
0
        private void MessageReceiver_FMD_CS_PING(ClientConnection client, AllegianceInterop.FMD_CS_PING message)
        {
            // Check all in-flight cons to make sure their destinations are still legit.
            foreach (short shipID in _constuctorsInFlightToClusterObjectIDByShipObjectID.Keys.ToArray())
            {
                var constructorInFlight = _constuctorsInFlightToClusterObjectIDByShipObjectID[shipID];

                var ship = ClientConnection.GetSide().GetShip(shipID);
                if (ship == null) // The constructor has built on the target rock.
                {
                    Log($"shipID: {shipID} is no longer valid, removing from _constuctorsInFlightToClusterObjectIDByShipObjectID list.");

                    _constuctorsInFlightToClusterObjectIDByShipObjectID.Remove(shipID);
                    continue;
                }

                //if (ship.GetCommandID((sbyte)CommandType.c_cmdCurrent) <= (sbyte)CommandID.c_cidNone) // The constructor's target rock is no longer available, or it has no current plan.
                //{
                //    Log($"shipID: {shipID} doesn't have a current command. Finding a new destination for {ship.GetName()}");

                //    _constuctorsInFlightToClusterObjectIDByShipObjectID.Remove(shipID);

                //    this.PlaceStation(ship, GetHomeCluster().GetObjectID());
                //}
            }

            // Find any idle cons and see if we can send them on their way.
            // Looks like we don't always have an updated command from cons, so this won't work.
            //foreach (var ship in client.GetSide().GetShips().Where(p => (PilotType)p.GetPilotType() == PilotType.c_ptBuilder))
            //{
            //    if (ship.GetCommandID((sbyte)CommandType.c_cmdCurrent) <= (sbyte)CommandID.c_cidNone) // The constructor's target rock is no longer available, or it has no current plan.
            //    {
            //        Log($"{ship.GetName()} doesn't have a current command. Finding a new destination for it.");

            //        _constuctorsInFlightToClusterObjectIDByShipObjectID.Remove(ship.GetObjectID());

            //        this.PlaceStation(ship, GetHomeCluster().GetObjectID());
            //    }
            //}

            if (client.GetSide()?.GetBuckets()?.Count > 0)
            {
                QueueTechForAvailableMoney();
            }
        }
Beispiel #2
0
 private void _messageReceiver_FMD_CS_PING(ClientConnection client, AllegianceInterop.FMD_CS_PING message)
 {
     // refresh the galaxy view every 5 seconds.
     UpdateGalaxyView();
 }