Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- planetCoord = "8:440:9"
- ships = {PATHFINDER: 1, LARGECARGO: 500, ESPIONAGEPROBE: 1}
- expeditionDuration = 1
- startHour = 6
- endHour = 21
- //----------------------------------------
- origin = GetCachedCelestial(planetName)
- minSystem = 440
- maxSystem = 440
- func sendExpedition() {
- randomSystem = Random(minSystem, maxSystem)
- destination = NewCoordinate(origin.GetCoordinate().Galaxy, randomSystem, 16, PLANET_TYPE)
- fleet = NewFleet()
- fleet.SetOrigin(origin.GetID())
- fleet.SetDestination(destination)
- fleet.SetSpeed(HUNDRED_PERCENT)
- fleet.SetMission(EXPEDITION)
- for shipID, nbr in ships {
- fleet.AddShips(shipID, nbr)
- }
- fleet.SetDuration(expeditionDuration)
- return fleet.SendNow()
- }
- for {
- hour, min, sec = Clock()
- hour+= 1
- if hour >= startHour && hour <= endHour {
- fleets, slots = GetFleets()
- // Find next expedition fleet that will come back
- bigNum = 999999999
- minSecs = bigNum
- for fleet in fleets {
- if fleet.Mission == EXPEDITION {
- minSecs = Min(fleet.BackIn, minSecs)
- }
- }
- // Sends new expeditions
- expeditionsPossible = slots.ExpTotal - slots.ExpInUse
- for expeditionsPossible > 0 {
- newFleet, err = sendExpedition()
- if err != nil {
- LogError(err)
- break
- } else {
- Print(newFleet)
- minSecs = Min(newFleet.BackIn, minSecs)
- expeditionsPossible--
- }
- Sleep(Random(10000, 20000))
- }
- // If we didn't found any expedition fleet and didn't create any, let's wait 5min
- if minSecs == bigNum {
- minSecs = Random(5, 15) * 60
- }
- Sleep((minSecs + 10) * 1000) // Sleep until one of the expedition fleet come back
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement