public void Awake() { KJRJointUtils.LoadConstants(); updatedVessels = new List <Vessel>(); easingVessels = new HashSet <Vessel>(); multiJointManager = new KJRMultiJointManager(); updatingVessels = new List <Vessel>(); #if Compatible ModuleDecoupleType = Type.GetType("ModuleDecouple, Assembly-CSharp"); isDecoupledField = ModuleDecoupleType.GetField("isDecoupled"); // >= 1.7.1 KJRJointUtils.IRoboticServoType = Type.GetType("Expansions.Serenity.IRoboticServo, Assembly-CSharp"); // >= 1.7.1 // 1.7.1 detection onRoboticPartLockChangingField = typeof(GameEvents).GetField("onRoboticPartLockChanging"); // >= 1.7.2 if (onRoboticPartLockChangingField == null) { KJRJointUtils.BaseServoType = Type.GetType("Expansions.Serenity.BaseServo, Assembly-CSharp"); // 1.7.1 only } #endif _instance = this; }
public void OnDestroy() { GameEvents.onVesselCreate.Remove(OnVesselCreate); GameEvents.onVesselWasModified.Remove(OnVesselWasModified); GameEvents.onVesselDestroy.Remove(OnVesselDestroy); GameEvents.onVesselGoOffRails.Remove(OnVesselOffRails); GameEvents.onVesselGoOnRails.Remove(OnVesselOnRails); GameEvents.onPartDestroyed.Remove(RemovePartJoints); GameEvents.onPartDie.Remove(RemovePartJoints); GameEvents.onPartDeCouple.Remove(RemovePartJoints); GameEvents.onPhysicsEaseStart.Remove(OnEaseStart); GameEvents.onPhysicsEaseStop.Remove(OnEaseStop); #if Compatible // >= 1.7.2 if (onRoboticPartLockChangingField != null) { EventData <Part, bool> onRoboticPartLockChanging = (EventData <Part, bool>)onRoboticPartLockChangingField.GetValue(null); onRoboticPartLockChanging.Remove(OnRoboticPartLockChanging); } #endif #if !Compatible GameEvents.onRoboticPartLockChanging.Remove(OnRoboticPartLockChanging); #endif updatedVessels = null; easingVessels = null; multiJointManager = null; }
public void OnDestroy() { //if (!CompatibilityChecker.IsCompatible()) //return; GameEvents.onVesselCreate.Remove(OnVesselCreate); GameEvents.onVesselWasModified.Remove(OnVesselWasModified); GameEvents.onVesselGoOffRails.Remove(OnVesselOffRails); GameEvents.onVesselGoOnRails.Remove(OnVesselOnRails); GameEvents.onVesselDestroy.Remove(OnVesselOnRails); GameEvents.onPartDestroyed.Remove(OnPartDestroyed); GameEvents.onPartDie.Remove(OnPartDestroyed); if (InputLockManager.GetControlLock("KJRLoadLock") == ControlTypes.ALL_SHIP_CONTROLS) { InputLockManager.RemoveControlLock("KJRLoadLock"); } updatedVessels = null; vesselOffRails = null; vesselJointStrengthened = null; multiJointManager = null; }
public void Awake() { KJRJointUtils.LoadConstants(); updatedVessels = new List <Vessel>(); vesselOffRails = new HashSet <Vessel>(); vesselJointStrengthened = new Dictionary <Vessel, List <Joint> >(); multiJointManager = new KJRMultiJointManager(); }
public KJRMultiJointManager() { multiJointDict = new Dictionary<Part, List<ConfigurableJoint>>(); fetch = this; GameEvents.onVesselCreate.Add(VesselCreate); GameEvents.onPartUndock.Add(OnJointBreak); GameEvents.onPartDie.Add(OnJointBreak); }
public KJRMultiJointManager() { multiJointDict = new Dictionary <Part, List <ConfigurableJoint> >(); fetch = this; GameEvents.onVesselCreate.Add(VesselCreate); GameEvents.onPartUndock.Add(OnJointBreak); GameEvents.onPartDie.Add(OnJointBreak); }
public void Awake() { KJRJointUtils.LoadConstants(); updatedVessels = new List<Vessel>(); vesselOffRailsTick = new Dictionary<Vessel, int>(); vesselJointStrengthened = new Dictionary<Vessel, List<Joint>>(); multiJointManager = new KJRMultiJointManager(); }
public void Awake() { Log.dbg("Awake"); try { KJRJointUtils.LoadConstants(); } catch (Exception e) { Log.ex(this, e); Log.err("An error [{0}] was caught on initialization! The plugin WILL NOT work as expected!", e.Message); } updatedVessels = new List <Vessel>(); vesselOffRails = new HashSet <Vessel>(); vesselJointStrengthened = new Dictionary <Vessel, List <Joint> >(); multiJointManager = new KJRMultiJointManager(); }
public void OnDestroy() { GameEvents.onVesselWasModified.Remove(OnVesselWasModified); GameEvents.onVesselGoOffRails.Remove(OnVesselOffRails); GameEvents.onVesselGoOnRails.Remove(OnVesselOnRails); GameEvents.onVesselDestroy.Remove(OnVesselOnRails); if (InputLockManager.GetControlLock("KJRLoadLock") == ControlTypes.ALL_SHIP_CONTROLS) { InputLockManager.RemoveControlLock("KJRLoadLock"); } updatedVessels = null; vesselOffRails = null; vesselJointStrengthened = null; multiJointManager.OnDestroy(); multiJointManager = null; }
public void OnDestroy() { if (!CompatibilityChecker.IsAllCompatible()) return; GameEvents.onVesselWasModified.Remove(OnVesselWasModified); GameEvents.onVesselGoOffRails.Remove(OnVesselOffRails); GameEvents.onVesselGoOnRails.Remove(OnVesselOnRails); if (InputLockManager.GetControlLock("KJRLoadLock") == ControlTypes.ALL_SHIP_CONTROLS) InputLockManager.RemoveControlLock("KJRLoadLock"); updatedVessels = null; vesselOffRailsTick = null; vesselJointStrengthened = null; multiJointManager.OnDestroy(); multiJointManager = null; }
public static void WasModified(Vessel v) { if (!bShow) { return; } Clear(v); // zuerst rausräumen, falls schon vorhanden KJRMultiJointManager mjm = KJRManager.Instance.GetMultiJointManager(); itemlist l = new itemlist(); l.vessel = v; l.items = new List <item>(); foreach (Part p in v.Parts) { ConfigurableJoint[] joints = p.GetComponents <ConfigurableJoint>(); for (int i = 0; i < joints.Length; i++) { item t = new item(); t.joint = joints[i]; switch (mjm.GetJointReason(t.joint)) { case KJRMultiJointManager.Reason.None: if (!WindowManager.Instance.ShowKSPJoints) { continue; } t.color = Color.green; break; case KJRMultiJointManager.Reason.AdditionalJointToParent: if (!WindowManager.Instance.ShowAdditionalJointToParent) { continue; } t.color = Color.magenta; break; case KJRMultiJointManager.Reason.MultiPartJointTreeChildren: if (!WindowManager.Instance.ShowMultiPartJointTreeChildren) { continue; } t.color = Color.yellow; break; case KJRMultiJointManager.Reason.MultiPartJointTreeChildrenRoot: if (!WindowManager.Instance.ShowMultiPartJointTreeChildrenRoot) { continue; } t.color = Color.cyan; break; } t.line = new LineDrawer(); l.items.Add(t); } } if (l.items.Count > 0) { lists.Add(l); } }