void landingRotorLoad(IMyTerminalBlock r, LandingRotor gr) { Func <string, bool> asBool = (txt) => { txt = txt.Trim().ToLower(); return(txt == "True" || txt == "true"); }; gr.r = r as IMyMotorStator; Echo("Loading Landing Rotor:" + r.CustomName); float maxVelocity = r.GetMaximum <float>("Velocity"); Echo("rotor maxV=" + maxVelocity); gr.maxVelocity = maxVelocity; string sData = r.CustomData; //Echo("data=" + sData); string[] lines = sData.Trim().Split('\n'); // Echo(lines.Length + " Lines"); for (int i = 0; i < lines.Length; i++) { string[] keys = lines[i].Trim().Split('='); // if (lines[i].Contains("GimbalZMinus")) // Echo(lines[i]); } // Echo("Max Velocity=" + gr.maxVelocity.ToString()); }
string landingsInit(IMyTerminalBlock blockOrientation) { landingRotorList.Clear(); landingPistonList.Clear(); var rotorsList = new List <IMyTerminalBlock>(); rotorsList = GetTargetBlocks <IMyMotorStator>(); // GridTerminalSystem.GetBlocksOfType<IMyMotorStator>(rotorsList, (x => x.CubeGrid == blockOrientation.CubeGrid)); for (int i = 0; i < rotorsList.Count; i++) { if (rotorsList[i].CustomName.Contains(sLandingID) || rotorsList[i].CustomData.Contains(sLandingID)) { LandingRotor gr = new LandingRotor(); landingRotorLoad(rotorsList[i], gr); Echo(gr.r.CustomName); landingRotorList.Add(gr); } } var pistonsList = new List <IMyTerminalBlock>(); pistonsList = GetTargetBlocks <IMyPistonBase>(); GridTerminalSystem.GetBlocksOfType <IMyPistonBase>(pistonsList, (x => x.CubeGrid == blockOrientation.CubeGrid)); for (int i = 0; i < pistonsList.Count; i++) { if (pistonsList[i].CustomName.Contains(sLandingID) || pistonsList[i].CustomData.Contains(sLandingID)) { LandingPiston gr = new LandingPiston(); landingPistonLoad(pistonsList[i], gr); Echo(gr.p.CustomName); landingPistonList.Add(gr); } } string s = ""; s += "LR" + landingRotorList.Count.ToString() + ":"; s += "LP" + landingPistonList.Count.ToString() + ":"; return(s); }