protected override void Update100_Options_TargetingThread(TargetingOptions current) { if (CurrentControl == Control.Engager) { return; } //Log.DebugLog("Turret flag: " + current.FlagSet(TargetingFlags.Turret) + ", No motor turret: " + (MyMotorTurret == null) + ", CanControl = " + CanControl, "Update_Options()"); if (current.FlagSet(TargetingFlags.Turret)) { if (MyMotorTurret == null && CanControl) { //Log.DebugLog("MotorTurret is now enabled", "Update_Options()", Logger.severity.INFO); MyMotorTurret = new MotorTurret(CubeBlock, MyMotorTurret_OnStatorChange, 1, WeaponDefinition.RequiredAccuracyRadians); } } else { if (MyMotorTurret != null) { //Log.DebugLog("MotorTurret is now disabled", "Update_Options()", Logger.severity.INFO); MyMotorTurret.Dispose(); MyMotorTurret = null; // MyMotorTurret will not be updated, so it will be recreated later incase something weird happens to motors } } }
public void Update100() { if (m_termControl_faceSun) { FaceSun(); return; } if (m_nameCommand_faceSun) { FaceSun(); } else { Log.DebugLog("no longer facing the sun", Logger.severity.DEBUG, condition: myMotorTurret != null); if (myMotorTurret != null) { myMotorTurret.Dispose(); myMotorTurret = null; } } if (sinceNameChange > 2) { return; } if (sinceNameChange++ < 2) { return; } m_nameCommand_faceSun = myBlock.DisplayNameText.looseContains("[face sun]"); }