Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. planetCoord = "8:440:9"
  2. ships = {PATHFINDER: 1, LARGECARGO: 500, ESPIONAGEPROBE: 1}
  3. expeditionDuration = 1
  4. startHour = 6
  5. endHour = 21
  6.  
  7. //----------------------------------------
  8. origin = GetCachedCelestial(planetName)
  9. minSystem = 440
  10. maxSystem = 440
  11. func sendExpedition() {
  12. randomSystem = Random(minSystem, maxSystem)
  13. destination = NewCoordinate(origin.GetCoordinate().Galaxy, randomSystem, 16, PLANET_TYPE)
  14. fleet = NewFleet()
  15. fleet.SetOrigin(origin.GetID())
  16. fleet.SetDestination(destination)
  17. fleet.SetSpeed(HUNDRED_PERCENT)
  18. fleet.SetMission(EXPEDITION)
  19. for shipID, nbr in ships {
  20. fleet.AddShips(shipID, nbr)
  21. }
  22. fleet.SetDuration(expeditionDuration)
  23. return fleet.SendNow()
  24. }
  25.  
  26. for {
  27. hour, min, sec = Clock()
  28. hour+= 1
  29. if hour >= startHour && hour <= endHour {
  30. fleets, slots = GetFleets()
  31.  
  32. // Find next expedition fleet that will come back
  33. bigNum = 999999999
  34. minSecs = bigNum
  35. for fleet in fleets {
  36. if fleet.Mission == EXPEDITION {
  37. minSecs = Min(fleet.BackIn, minSecs)
  38. }
  39. }
  40.  
  41. // Sends new expeditions
  42. expeditionsPossible = slots.ExpTotal - slots.ExpInUse
  43. for expeditionsPossible > 0 {
  44. newFleet, err = sendExpedition()
  45. if err != nil {
  46. LogError(err)
  47. break
  48. } else {
  49. Print(newFleet)
  50. minSecs = Min(newFleet.BackIn, minSecs)
  51. expeditionsPossible--
  52. }
  53. Sleep(Random(10000, 20000))
  54. }
  55.  
  56. // If we didn't found any expedition fleet and didn't create any, let's wait 5min
  57. if minSecs == bigNum {
  58. minSecs = Random(5, 15) * 60
  59. }
  60.  
  61. Sleep((minSecs + 10) * 1000) // Sleep until one of the expedition fleet come back
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement