public void SwitchRole() { if (!HighLogic.LoadedSceneIsEditor && group > 0) { Utils.Message("Cannot change the role of an engine belonging to a group.\n" + "Use in-flight group controls instead."); return; } Role = RolesOrder[(++role_index) % NumRoles]; update_status(); //set the role of symmetry counterparts, if needed if (!Globals.Instance.RoleSymmetryInFlight && HighLogic.LoadedSceneIsFlight) { return; } foreach (var cp in part.symmetryCounterparts) { var einfo = cp.Modules.GetModule <TCAEngineInfo>(); if (einfo != null && (HighLogic.LoadedSceneIsEditor || einfo.Group == 0)) { einfo.SetRole(Role); } } }
public override void OnLoad(ConfigNode node) { base.OnLoad(node); Role = (TCARole)role; role_index = Array.FindIndex(RolesOrder, r => r == Role); update_status(); }
public void Update(EngineConfig c) { Name = c.Name; On = c.On; Limit = c.Limit; Role = c.Role; }
public static TCARole PrevRole(TCARole cur) { var i = Array.FindIndex(RolesOrder, r => r == cur) - 1; if (i < 0) { i = NumRoles - 1; } return(RolesOrder[i]); }
public override void OnLoad(ConfigNode node) { base.OnLoad(node); // legacy config conversion if (node.HasValue("role") && int.TryParse(node.GetValue("role"), out var role)) { Role = (TCARole)role; } update_events(); }
void RoleControl() { if (GUILayout.Button("<", Styles.normal_button, GUILayout.Width(15))) { Role = TCAEngineInfo.PrevRole(Role); Changed = true; } GUILayout.Label(TCAEngineInfo.RoleNames[(int)Role], GUILayout.Width(120)); if (GUILayout.Button(">", Styles.normal_button, GUILayout.Width(15))) { Role = TCAEngineInfo.NextRole(Role); Changed = true; } }
public void SwitchRole() { if (!HighLogic.LoadedSceneIsEditor && group > 0) { Utils.Message("Cannot change the role of an engine belonging to a group.\n" + "Use in-flight group controls instead."); return; } Role = Roles.Next(Role); update_events(); applyToCounterparts(e => e.SetRole(Role)); }
public void Update(EngineWrapper e, bool with_On = false) { Limit = e.thrustLimit; Role = e.Role; if (with_On) { On = e.engine.EngineIgnited; } else { Changed |= On != e.engine.EngineIgnited; } }
public static TCARole NextRole(TCARole cur) { return(RolesOrder[(Array.FindIndex(RolesOrder, r => r == cur) + 1) % NumRoles]); }
public void SetRoleAndMode(TCARole role, ManeuverMode mode) { Role = role; Mode = mode; update_events(); }
public override void Load(ConfigNode node) { base.Load(node); try { Role = (TCARole)Enum.Parse(typeof(TCARole), role); } catch { Role = default(TCARole); } }
public void SetRole(TCARole R) { Role = R; update_status(); }
public static TCARole PrevRole(TCARole cur) { var i = Array.FindIndex(RolesOrder, r => r == cur)-1; if(i < 0) i = NumRoles-1; return RolesOrder[i]; }
public static TCARole NextRole(TCARole cur) { return RolesOrder[(Array.FindIndex(RolesOrder, r => r == cur)+1) % NumRoles]; }
public void SetRole(TCARole role) { Role = role; update_events(); }
public void SwitchRole() { if(!HighLogic.LoadedSceneIsEditor && group > 0) { Utils.Message("Cannot change the role of an engine belonging to a group.\n" + "Use in-flight group controls instead."); return; } Role = RolesOrder[(++role_index) % NumRoles]; update_status(); //set the role of symmetry counterparts, if needed if(!Globals.Instance.RoleSymmetryInFlight && HighLogic.LoadedSceneIsFlight) return; foreach(var cp in part.symmetryCounterparts) { var einfo = cp.Modules.GetModule<TCAEngineInfo>(); if(einfo != null && (HighLogic.LoadedSceneIsEditor || einfo.Group == 0)) einfo.SetRole(Role); } }
public void SetRole(TCARole role) { info.SetRole(role); }