void landingPistonLoad(IMyTerminalBlock r, LandingPiston gr) { Func <string, bool> asBool = (txt) => { txt = txt.Trim().ToLower(); return(txt == "True" || txt == "true"); }; gr.p = r as IMyPistonBase; Echo("Loading Landing Piston:" + r.CustomName); float maxVelocity = gr.p.MaxVelocity; gr.maxVelocity = maxVelocity; Echo("piston maxV=" + maxVelocity); Echo("Status=" + gr.p.Status.ToString()); Echo("MaxLimit=" + gr.p.MaxLimit.ToString()); Echo("MinLimit=" + gr.p.MinLimit.ToString()); 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('='); // Echo(lines[i]); } // Echo("Max Velocity=" + gr.maxVelocity.ToString()); // sub-rotors & Pistons }
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); }