public void Load(ConfigNode node) { ConfigNode.LoadObjectFromConfig(this, node); allowedCrewedParts = new HashSet <string>(); foreach (ConfigNode partsNode in node.GetNodes("ALLOWED_PARTS")) { foreach (string partName in partsNode.GetValues("part")) { if (string.IsNullOrEmpty(partName)) { continue; } allowedCrewedParts.Add(FixPartName(partName)); } } bodyOverrides = new Dictionary <string, BodyOverride>(); foreach (ConfigNode bodyNode in node.GetNodes("BODY")) { BodyOverride body = new BodyOverride(); body.Load(bodyNode); bodyOverrides.Add(body.name, body); } }
public double GetMinPeriapsis(CelestialBody body) { int minJitter = periapsisMinJitter; double minPeriapsis = this.minPeriapsis; if (bodyOverrides.ContainsKey(body.name)) { BodyOverride bodyOverride = bodyOverrides[body.name]; if (bodyOverride.periapsisMinJitter >= 0) { minJitter = bodyOverride.periapsisMinJitter; } if (bodyOverride.minPeriapsis >= 0) { minPeriapsis = bodyOverride.minPeriapsis; } } if (body.atmosphere) { minPeriapsis = Math.Max(body.atmosphereDepth, minPeriapsis); } return(minPeriapsis + minJitter); }
public int GetJitter(CelestialBody body) { int minJitter = periapsisMinJitter; int maxJitter = periapsisMaxJitter; if (bodyOverrides.ContainsKey(body.name)) { BodyOverride bodyOverride = bodyOverrides[body.name]; if (bodyOverride.periapsisMinJitter >= 0) { minJitter = bodyOverride.periapsisMinJitter; } if (bodyOverride.periapsisMaxJitter >= 0) { maxJitter = bodyOverride.periapsisMaxJitter; } } return(Math.Max(0, maxJitter - minJitter)); }