public void StoreData() { // disable for dead eva kerbals Vessel v = FlightGlobals.ActiveVessel; if (v == null || EVA.IsDead(v)) { return; } // transfer data Drive.transfer(v, vessel); }
void vesselDock(GameEvents.FromToAction<Part, Part> e) { // note: // we do not forget vessel data here, it just became inactive // and ready to be implicitly activated again on undocking // we do however tweak the data of the vessel being docked a bit, // to avoid states getting out of sync, leading to unintuitive behaviours VesselData vd = DB.Vessel(e.from.vessel); vd.msg_belt = false; vd.msg_signal = false; vd.storm_age = 0.0; vd.storm_time = 0.0; vd.storm_state = 0; vd.supplies.Clear(); vd.scansat_id.Clear(); // merge drives data Drive.transfer(e.from.vessel, e.to.vessel); }
void fromEVA(GameEvents.FromToAction<Part, Part> data) { // for each resource in the eva kerbal for(int i=0; i < data.from.Resources.Count; ++i) { // get the resource PartResource res = data.from.Resources[i]; // add leftovers to the vessel data.to.RequestResource(res.resourceName, -res.amount); } // merge drives data Drive.transfer(data.from.vessel, data.to.vessel); // forget vessel data DB.vessels.Remove(Lib.RootID(data.from.vessel)); // execute script DB.Vessel(data.to.vessel).computer.execute(data.to.vessel, ScriptType.eva_in); }