Esempio n. 1
0
        public override bool OnFrameImpl()
        {
            if (substate != null)
            {
                if (substate.OnFrame())
                {
                    return(true);
                }
            }

            // check if we're done
            if (g.me.InStation && g.me.StationID == station_id)
            {
                SetDone("Reached destination");
                return(false);
            }
            // check if we're in the right solar system and just need to dock
            else if (g.me.InSpace && g.me.SolarSystemID == solarsystem_id)
            {
                substate = new DockState(station_id);
                substate.OnFrame();
                return(true);
            }
            // if we're in station, undock
            else if (g.me.InStation)
            {
                substate = new UndockState();
                substate.OnFrame();
                return(true);
            }
            // if we're out in space, move to the next solarsystem
            else if (g.me.InSpace)
            {
                // set our destination if its not already correct
                List <int> systems = g.eve.GetToDestinationPath();
                if (systems == null || systems.Count == 0 ||
                    systems[systems.Count - 1] != solarsystem_id)
                {
                    Universe.ByID(solarsystem_id).SetDestination();
                }

                systems = g.eve.GetToDestinationPath();
                Interstellar  next_system = Universe.ByID(systems[0]);
                List <Entity> entities    = g.eve.QueryEntities("GroupID = 10");
                Entity        next_gate   = null;
                foreach (Entity stargate in entities)
                {
                    if (stargate.Name.Contains(next_system.Name))
                    {
                        next_gate = stargate;
                    }
                }

                if (next_gate != null)
                {
                    substate = new JumpState(next_gate.ID, systems[0]);
                    substate.OnFrame();
                    return(true);
                }
            }

            // I guess we'll just wait hehe
            return(true);
        }