From 6db3de9b845e4a62be91ef88680c85048928a771 Mon Sep 17 00:00:00 2001 From: Jakeya Date: Sun, 5 Jun 2016 09:19:25 -0500 Subject: [PATCH 1/2] Updated Enable_Antennae function I would rather not have to manage a RT antenna function that calls each antenna exclusively. I played with the modules a bit and found a more comprehensive solution that should work with any ship regardless of its antenna configuration. This version assumes you are launching from Kerbin for the simplest, smallest footprint. I am working on a smarter version that takes into account your starting location and your targeted destination based on the mission profile. --- episodes/e037/herald_mission.ks | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/episodes/e037/herald_mission.ks b/episodes/e037/herald_mission.ks index 3cdac24..c0274e8 100644 --- a/episodes/e037/herald_mission.ks +++ b/episodes/e037/herald_mission.ks @@ -88,19 +88,27 @@ mission["next"](). } } - + function enable_antennae { - parameter mission. - local p is ship:partstitled("Comms DTS-M1")[0]. - local m is p:getmodule("ModuleRTAntenna"). - m:doevent("Activate"). - m:setfield("target", "Kerbin"). - - set p to ship:partstitled("Communotron 16")[0]. - set m to p:getmodule("ModuleRTAntenna"). - m:doevent("Activate"). - mission["next"](). - } + for rt in ship:modulesnamed("ModuleRTAntenna") { + if rt:hasevent("no target") rt:setfield("target", "Kerbin"). + if rt:hasevent("activate") rt:doevent("activate"). + } + mission["next"](). + } + +// function enable_antennae { +// parameter mission. +// local p is ship:partstitled("Comms DTS-M1")[0]. +// local m is p:getmodule("ModuleRTAntenna"). +// m:doevent("Activate"). +// m:setfield("target", "Kerbin"). + +// set p to ship:partstitled("Communotron 16")[0]. +// set m to p:getmodule("ModuleRTAntenna"). +// m:doevent("Activate"). +// mission["next"](). +// } function idle { parameter mission. From 618358c77d0f6706ade54e3b1c8e32d4dda8d0df Mon Sep 17 00:00:00 2001 From: Jakeya Date: Sun, 5 Jun 2016 10:50:22 -0500 Subject: [PATCH 2/2] Updated enable antennae function Apologies. I left out the mission parameter. --- episodes/e037/herald_mission.ks | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/episodes/e037/herald_mission.ks b/episodes/e037/herald_mission.ks index c0274e8..d6fd596 100644 --- a/episodes/e037/herald_mission.ks +++ b/episodes/e037/herald_mission.ks @@ -90,26 +90,14 @@ } function enable_antennae { - for rt in ship:modulesnamed("ModuleRTAntenna") { - if rt:hasevent("no target") rt:setfield("target", "Kerbin"). - if rt:hasevent("activate") rt:doevent("activate"). + parameter mission. + for rt in ship:modulesnamed("ModuleRTAntenna") { + if rt:hasevent("no target") rt:setfield("target", "Kerbin"). + if rt:hasevent("activate") rt:doevent("activate"). } - mission["next"](). + mission["next"](). } -// function enable_antennae { -// parameter mission. -// local p is ship:partstitled("Comms DTS-M1")[0]. -// local m is p:getmodule("ModuleRTAntenna"). -// m:doevent("Activate"). -// m:setfield("target", "Kerbin"). - -// set p to ship:partstitled("Communotron 16")[0]. -// set m to p:getmodule("ModuleRTAntenna"). -// m:doevent("Activate"). -// mission["next"](). -// } - function idle { parameter mission. // Do nothing