public override bool OnFrameImpl() { if (IsDone) { return(false); } if (warp != null) { warp.OnFrame(); if (warp.IsDone) { warp = null; } else { return(true); } } if (!started) { // check if we're already in warp if (g.me.ToEntity.Mode == 3) { SetDone("can't dock in warp"); return(false); } List <Entity> entities = g.eve.QueryEntities("ID = {0}".Format(entity_id)); if (entities.Count == 0) { SetDone("entity not found"); return(false); } if (entities.Count > 1) { SetDone("entity ambiguous"); return(false); } Entity entity = entities[0]; if (entity.Distance > 150000.0) { warp = new WarpState(entity_id); warp.OnFrame(); if (warp.IsDone) { SetDone(warp.Result); } } else { entity.Dock(); started = true; } return(true); } else if (waiting) { if (DateTime.Now - wait_start > TimeSpan.FromSeconds(5.0)) { SetDone("Success"); return(false); } } else { if (!g.me.InSpace && g.me.InStation && g.me.StationID > 0 && g.me.Ship.GetCargo() != null) { waiting = true; wait_start = DateTime.Now; return(true); } } return(true); }
public override bool OnFrameImpl() { if (warp_state != null) { warp_state.OnFrame(); if (warp_state.IsDone) { warp_state = null; } else { return(true); } } List <Entity> entities = g.eve.QueryEntities(); if (entities == null || entities.Count <= 0) { // we're probably jumping right now - just chill return(true); } if (g.me.InSpace && g.me.SolarSystemID == solarsystem_id) { SetDone("Success"); return(false); } entities = g.eve.QueryEntities("ID = {0}".Format(entity_id)); if (entities.Count == 0) { SetDone("stargate not found"); return(false); } if (entities.Count > 1) { SetDone("stargate id ambiguous"); return(false); } Entity stargate = entities[0]; if (stargate.Distance > 150000.0) { warp_state = new WarpState(entity_id); warp_state.OnFrame(); return(true); } else if (stargate.Distance < 2500.0) { if (!jumped) { stargate.Jump(); jumped = true; } return(true); } else if (!approached) { stargate.Approach(); approached = true; } return(true); }