Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //create access to all the parts
- set hichute to ship:partstagged("hi")[0].
- set lochute to ship:partstagged("lo")[0].
- set comms to ship:partstagged("antenna")[0].
- set probe to ship:partstagged("core")[0].
- set battlist to ship:partsdubbed("z-200 rechargeable battery bank").
- set caplist to ship:partsdubbed("cap-101 capacitor").
- set goolist to ship:partstagged("goo").
- // program behavior variables
- set deployupperheight to 21000.
- set loweratmosphere to 18000.
- set deploylowerheight to 2500.
- set maxdropspeed to 12.
- set commtimeout to 15.
- set transmissiontimeout to 5.
- set lowbattlvl to 25. // for when no data is being transmitted
- set lowbattlvltrans to 150. // for when data is being transmitted
- set discharged to false.
- set transtime to 0.
- clearscreen.
- abort off.
- print "[" + time:clock + "] Program running... confirming systems".
- log "[" + time:clock + "] Program running... confirming systems" to droplog.
- print "[" + time:clock + "] " + battlist:length + " Battery(s) found".
- log "[" + time:clock + "] " + battlist:length + " Battery(s) found" to droplog.
- print "[" + time:clock + "] " + caplist:length + " Capacitor(s) found".
- log "[" + time:clock + "] " + caplist:length + " Capacitor(s) found" to droplog.
- print "[" + time:clock + "] " + goolist:length + " Goo canister(s) found".
- log "[" + time:clock + "] " + goolist:length + " Goo canister(s) found" to droplog.
- print "[" + time:clock + "] Operational systems confirmed".
- log "[" + time:clock + "] Operational systems confirmed" to droplog.
- for batt in battlist {
- set batt:resources[0]:enabled to true.
- }.
- print "[" + time:clock + "] All batteries enabled".
- log "[" + time:clock + "] All batteries enabled" to droplog.
- print "[" + time:clock + "] Awaiting chute deployment".
- log "[" + time:clock + "] Awaiting chute deployment" to droplog.
- until hichute:getmodule("realchutemodule"):allevents[0] = "(callable) cut chute, is kspevent" {
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- wait 0.001.
- }.
- Print "[" + time:clock + "] Chute deployment confirmed. Awaiting full deployment".
- log "[" + time:clock + "] Chute deployment confirmed. Awaiting full deployment" to droplog.
- until alt:radar < deployupperheight and ship:verticalspeed*-1 < maxdropspeed {
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- wait 0.001.
- }.
- Print "[" + time:clock + "] Full chute deployment confirmed".
- log "[" + time:clock + "] Full chute deployment confirmed" to droplog.
- comms:getmodule("modulertantenna"):doevent("activate").
- Print "[" + time:clock + "] Communications antenna deployed. Awaiting connection".
- log "[" + time:clock + "] Communications antenna deployed. Awaiting connection" to droplog.
- set timer to time:seconds.
- until probe:getmodule("modulespu"):getfield("spu") = "operational." {
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- if time:seconds - timer > commtimeout {
- Print "[" + time:clock + "] Communications link failed!".
- log "[" + time:clock + "] Communications link failed!" to droplog.
- shutdown.
- }
- wait 0.001.
- }.
- Print "[" + time:clock + "] Communications link established".
- log "[" + time:clock + "] Communications link established" to droplog.
- Print "[" + time:clock + "] First upper atmospheric experiment run commencing".
- log "[" + time:clock + "] First upper atmospheric experiment run commencing" to droplog.
- toggle AG4.
- // goo containers are only run once per atmosphere level (upper/lower)
- for goo in goolist {
- // we don't care which goo pod is run - if a goo container is unused, it will have an event available
- if goo:getmodule("modulescienceexperiment"):allevents:length > 0 {
- goo:getmodule("modulescienceexperiment"):doevent("observe mystery goo").
- break.
- }.
- }.
- Print "[" + time:clock + "] Awaiting data transmission".
- log "[" + time:clock + "] Awaiting data transmission" to droplog.
- set timer to time:seconds.
- set nodata to false.
- // until the comms message changes from "idle", nothing is being transmitted
- until comms:getmodule("modulertdatatransmitter"):getfield("comms") = "uploading data..." {
- // keep tabs on our power status - release capcitor charge as necessary
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- // keeps tabs on our connection to Mission Control
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- // if the user recycles all experiments, no data will be sent
- if time:seconds - timer > commtimeout {
- set nodata to true.
- break.
- }
- wait 0.001.
- }.
- if nodata {
- // aborts the second run as well - no data means no data for this entire biome level
- Print "[" + time:clock + "] Aborting upper atmospheric runs due to no data to transmit".
- log "[" + time:clock + "] Aborting upper atmospheric runs due to no data to transmit" to droplog.
- } else {
- Print "[" + time:clock + "] Data transmission has begun".
- log "[" + time:clock + "] Data transmission has begun" to droplog.
- until time:seconds - transtime > transmissiontimeout {
- if not discharged and ship:resources[0]:amount < lowbattlvltrans {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- if transtime < time:seconds and comms:getmodule("modulertdatatransmitter"):getfield("comms") = "uploading data..." {
- lock transtime to time:seconds.
- }.
- if transtime = time:seconds and comms:getmodule("modulertdatatransmitter"):getfield("comms") = "idle" {
- set transtime to time:seconds.
- }.
- wait 0.001.
- }.
- Print "[" + time:clock + "] Data transmission has ended".
- log "[" + time:clock + "] Data transmission has ended" to droplog.
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- // if we haven't reached the lower atmosphere yet, take a second run for additional data
- if alt:radar > loweratmosphere {
- Print "[" + time:clock + "] Second upper atmospheric experiment run commencing".
- log "[" + time:clock + "] Second upper atmospheric experiment run commencing" to droplog.
- toggle AG4.
- for goo in goolist {
- if goo:getmodule("modulescienceexperiment"):allevents:length > 0 {
- goo:getmodule("modulescienceexperiment"):doevent("observe mystery goo").
- break.
- }.
- }.
- Print "[" + time:clock + "] Awaiting data transmission".
- log "[" + time:clock + "] Awaiting data transmission" to droplog.
- set timer to time:seconds.
- set nodata to false.
- until comms:getmodule("modulertdatatransmitter"):getfield("comms") = "uploading data..." {
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- if time:seconds - timer > commtimeout {
- set nodata to true.
- break.
- }
- wait 0.001.
- }.
- if nodata {
- Print "[" + time:clock + "] Aborting second upper atmospheric run due to no data to transmit".
- log "[" + time:clock + "] Aborting second upper atmospheric run due to no data to transmit" to droplog.
- } else {
- Print "[" + time:clock + "] Data transmission has begun".
- log "[" + time:clock + "] Data transmission has begun" to droplog.
- until time:seconds - transtime > transmissiontimeout {
- if not discharged and ship:resources[0]:amount < lowbattlvltrans {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- if transtime < time:seconds and comms:getmodule("modulertdatatransmitter"):getfield("comms") = "uploading data..." {
- lock transtime to time:seconds.
- }.
- if transtime = time:seconds and comms:getmodule("modulertdatatransmitter"):getfield("comms") = "idle" {
- set transtime to time:seconds.
- }.
- wait 0.01.
- }.
- Print "[" + time:clock + "] Data transmission has ended".
- log "[" + time:clock + "] Data transmission has ended" to droplog.
- }.
- } else {
- Print "[" + time:clock + "] Aborting second upper atmospheric run due to altitude".
- log "[" + time:clock + "] Aborting second upper atmospheric run due to altitude" to droplog.
- }.
- }.
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- Print "[" + time:clock + "] Advancing to lower atmosphere".
- log "[" + time:clock + "] Advancing to lower atmosphere" to droplog.
- comms:getmodule("modulertantenna"):doevent("deactivate").
- Print "[" + time:clock + "] Communications antenna retracted".
- log "[" + time:clock + "] Communications antenna retracted" to droplog.
- hichute:getmodule("realchutemodule"):doevent("cut chute").
- Print "[" + time:clock + "] Chute cut".
- log "[" + time:clock + "] Chute cut" to droplog.
- Print "[" + time:clock + "] Awaiting chute deployment".
- log "[" + time:clock + "] Awaiting chute deployment" to droplog.
- until lochute:getmodule("realchutemodule"):allevents[0] = "(callable) cut chute, is kspevent" {
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- wait 0.001.
- }.
- Print "[" + time:clock + "] Chute deployment confirmed. Awaiting full deployment".
- log "[" + time:clock + "] Chute deployment confirmed. Awaiting full deployment" to droplog.
- until alt:radar < deploylowerheight and ship:verticalspeed*-1 < maxdropspeed {
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- wait 0.001.
- }.
- Print "[" + time:clock + "] Full chute deployment confirmed".
- log "[" + time:clock + "] Full chute deployment confirmed" to droplog.
- comms:getmodule("modulertantenna"):doevent("activate").
- Print "[" + time:clock + "] Communications antenna deployed. Awaiting connection".
- log "[" + time:clock + "] Communications antenna deployed. Awaiting connection" to droplog.
- set timer to time:seconds.
- until probe:getmodule("modulespu"):getfield("spu") = "operational." {
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- if time:seconds - timer > commtimeout {
- Print "[" + time:clock + "] Communications link failed!".
- log "[" + time:clock + "] Communications link failed!" to droplog.
- shutdown.
- }
- wait 0.001.
- }.
- Print "[" + time:clock + "] Communications link established".
- log "[" + time:clock + "] Communications link established" to droplog.
- Print "[" + time:clock + "] First lower atmospheric experiment run commencing".
- log "[" + time:clock + "] First lower atmospheric experiment run commencing" to droplog.
- toggle AG4.
- // goo containers are only run once per atmosphere level (upper/lower)
- for goo in goolist {
- // we don't care which goo pod is run - if a goo container is unused, it will have an event available
- if goo:getmodule("modulescienceexperiment"):allevents:length > 0 {
- goo:getmodule("modulescienceexperiment"):doevent("observe mystery goo").
- break.
- }.
- }.
- Print "[" + time:clock + "] Awaiting data transmission".
- log "[" + time:clock + "] Awaiting data transmission" to droplog.
- set timer to time:seconds.
- set nodata to false.
- // until the comms message changes from "idle", nothing is being transmitted
- until comms:getmodule("modulertdatatransmitter"):getfield("comms") = "uploading data..." {
- // keep tabs on our power status - release capcitor charge as necessary
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- // keeps tabs on our connection to Mission Control
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- // if the user recycles all experiments, no data will be sent
- if time:seconds - timer > commtimeout {
- set nodata to true.
- break.
- }
- wait 0.001.
- }.
- if nodata {
- // aborts the second run as well - no data means no data for this entire biome level
- Print "[" + time:clock + "] Aborting lower atmospheric runs due to no data to transmit".
- log "[" + time:clock + "] Aborting lower atmospheric runs due to no data to transmit" to droplog.
- } else {
- Print "[" + time:clock + "] Data transmission has begun".
- log "[" + time:clock + "] Data transmission has begun" to droplog.
- until time:seconds - transtime > transmissiontimeout {
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- if transtime < time:seconds and comms:getmodule("modulertdatatransmitter"):getfield("comms") = "uploading data..." {
- lock transtime to time:seconds.
- }.
- if transtime = time:seconds and comms:getmodule("modulertdatatransmitter"):getfield("comms") = "idle" {
- set transtime to time:seconds.
- }.
- wait 0.001.
- }.
- Print "[" + time:clock + "] Data transmission has ended".
- log "[" + time:clock + "] Data transmission has ended" to droplog.
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- // if we'haven't landed yet, take a second run for additional data
- if ship:verticalspeed < 0 {
- Print "[" + time:clock + "] Second lower atmospheric experiment run commencing".
- log "[" + time:clock + "] Second lower atmospheric experiment run commencing" to droplog.
- toggle AG4.
- for goo in goolist {
- if goo:getmodule("modulescienceexperiment"):allevents:length > 0 {
- goo:getmodule("modulescienceexperiment"):doevent("observe mystery goo").
- break.
- }.
- }.
- Print "[" + time:clock + "] Awaiting data transmission".
- log "[" + time:clock + "] Awaiting data transmission" to droplog.
- set timer to time:seconds.
- set nodata to false.
- until comms:getmodule("modulertdatatransmitter"):getfield("comms") = "uploading data..." {
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- if time:seconds - timer > commtimeout {
- set nodata to true.
- break.
- }
- wait 0.001.
- }.
- if nodata {
- Print "[" + time:clock + "] Aborting second lower atmospheric run due to no data to transmit".
- log "[" + time:clock + "] Aborting second lower atmospheric run due to no data to transmit" to droplog.
- } else {
- Print "[" + time:clock + "] Data transmission has begun".
- log "[" + time:clock + "] Data transmission has begun" to droplog.
- until time:seconds - transtime > transmissiontimeout {
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- if transtime < time:seconds and comms:getmodule("modulertdatatransmitter"):getfield("comms") = "uploading data..." {
- lock transtime to time:seconds.
- }.
- if transtime = time:seconds and comms:getmodule("modulertdatatransmitter"):getfield("comms") = "idle" {
- set transtime to time:seconds.
- }.
- wait 0.001.
- }.
- Print "[" + time:clock + "] Data transmission has ended".
- log "[" + time:clock + "] Data transmission has ended" to droplog.
- }.
- }.
- }.
- // go into a wait state if we haven't landed during the last transmission sequence
- if ship:verticalspeed < 0 {
- Print "[" + time:clock + "] Awaiting landing".
- until ship:verticalspeed >= 0 {
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- wait 0.001.
- }.
- }.
- Print "[" + time:clock + "] Landing confirmed. First ground level experiment run commencing".
- log "[" + time:clock + "] Landing confirmed. First ground level experiment run commencing" to droplog.
- toggle AG4.
- for goo in goolist {
- if goo:getmodule("modulescienceexperiment"):allevents:length > 0 {
- goo:getmodule("modulescienceexperiment"):doevent("observe mystery goo").
- break.
- }.
- }.
- Print "[" + time:clock + "] Awaiting data transmission".
- log "[" + time:clock + "] Awaiting data transmission" to droplog.
- set timer to time:seconds.
- set nodata to false.
- until comms:getmodule("modulertdatatransmitter"):getfield("comms") = "uploading data..." {
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- if time:seconds - timer > commtimeout {
- set nodata to true.
- break.
- }
- wait 0.001.
- }.
- if nodata {
- Print "[" + time:clock + "] Aborting ground level runs due to no data to transmit".
- log "[" + time:clock + "] Aborting ground level runs due to no data to transmit" to droplog.
- } else {
- Print "[" + time:clock + "] Data transmission has begun".
- log "[" + time:clock + "] Data transmission has begun" to droplog.
- until time:seconds - transtime > transmissiontimeout {
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- if transtime < time:seconds and comms:getmodule("modulertdatatransmitter"):getfield("comms") = "uploading data..." {
- lock transtime to time:seconds.
- }.
- if transtime = time:seconds and comms:getmodule("modulertdatatransmitter"):getfield("comms") = "idle" {
- set transtime to time:seconds.
- }.
- wait 0.001.
- }.
- Print "[" + time:clock + "] Data transmission has ended".
- log "[" + time:clock + "] Data transmission has ended" to droplog.
- if ship:resources[0]:amount > 0 {
- Print "[" + time:clock + "] Second ground level experiment run commencing".
- log "[" + time:clock + "] Second ground level experiment run commencing" to droplog.
- toggle AG4.
- for goo in goolist {
- if goo:getmodule("modulescienceexperiment"):allevents:length > 0 {
- goo:getmodule("modulescienceexperiment"):doevent("observe mystery goo").
- break.
- }.
- }.
- Print "[" + time:clock + "] Awaiting data transmission".
- log "[" + time:clock + "] Awaiting data transmission" to droplog.
- set timer to time:seconds.
- set nodata to false.
- until comms:getmodule("modulertdatatransmitter"):getfield("comms") = "uploading data..." {
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- if time:seconds - timer > commtimeout {
- set nodata to true.
- break.
- }
- wait 0.001.
- }.
- if nodata {
- Print "[" + time:clock + "] Aborting second ground level run due to no data to transmit".
- log "[" + time:clock + "] Aborting second ground level run due to no data to transmit" to droplog.
- } else {
- Print "[" + time:clock + "] Data transmission has begun".
- log "[" + time:clock + "] Data transmission has begun" to droplog.
- until time:seconds - transtime > transmissiontimeout {
- if not discharged and ship:resources[0]:amount < lowbattlvl {
- set capnum to 0.
- until capnum = caplist:length {
- if caplist[capnum]:getmodule("dischargecapacitor"):getfield("status") = "ready" {
- caplist[capnum]:getmodule("dischargecapacitor"):doevent("discharge capacitor").
- Print "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag.
- log "[" + time:clock + "] Power levels low, discharging capacitor " + caplist[capnum]:tag to droplog.
- break.
- }.
- set capnum to capnum + 1.
- }.
- if capnum = caplist:length {
- set discharged to true.
- Print "[" + time:clock + "] All capacitors drained".
- log "[" + time:clock + "] All capacitors drained" to droplog.
- }.
- }.
- if probe:getmodule("modulespu"):getfield("spu") <> "operational." {
- Print "[" + time:clock + "] Connection lost".
- log "[" + time:clock + "] Connection lost" to droplog.
- shutdown.
- }.
- if transtime < time:seconds and comms:getmodule("modulertdatatransmitter"):getfield("comms") = "uploading data..." {
- lock transtime to time:seconds.
- }.
- if transtime = time:seconds and comms:getmodule("modulertdatatransmitter"):getfield("comms") = "idle" {
- set transtime to time:seconds.
- }.
- wait 0.001.
- }.
- Print "[" + time:clock + "] Data transmission has ended".
- log "[" + time:clock + "] Data transmission has ended" to droplog.
- }.
- }.
- }.
- Print "[" + time:clock + "] All events have executed".
- log "[" + time:clock + "] All events have executed" to droplog.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement