Decompiled source of FFU Quality v0.5.400

monomod/Assembly-CSharp.FFU_BR_Quality.mm.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using FFU_Beyond_Reach;
using Microsoft.CodeAnalysis;
using MonoMod;
using Ostranauts.Core;
using Ostranauts.Objectives;
using Ostranauts.Ships.AIPilots.Interfaces;
using Ostranauts.UI.MegaToolTip.DataModules.SubElements;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class patch_GUIInventory : GUIInventory
{
	private List<Vector2> vBase;

	private float colMaxWidth = 0f;

	[MonoModIgnore]
	public static patch_GUIInventory instance;

	public GUIInventoryWindow targetWindow = null;

	private extern Vector2 orig_GetWindowPosition(GUIInventoryWindow winCurrent, GUIInventoryWindow winPrev);

	private Vector2 GetWindowPosition(GUIInventoryWindow winCurrent, GUIInventoryWindow winPrev)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0236: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_042f: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0282: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0312: Unknown result type (might be due to invalid IL or missing references)
		//IL_0317: Unknown result type (might be due to invalid IL or missing references)
		//IL_0426: Unknown result type (might be due to invalid IL or missing references)
		//IL_042b: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		if (!FFU_BR_Defs.OrgInventoryMode || FFU_BR_Defs.OrgInventoryTweaks.Length != 6)
		{
			return orig_GetWindowPosition(winCurrent, winPrev);
		}
		RectTransform component = ((Component)((Component)this).transform.Find("PaperDoll")).GetComponent<RectTransform>();
		if (base.activeWindows.IndexOf(winCurrent) == 0)
		{
			RectTransform component2 = ((Component)((Component)this).transform.Find("Background")).GetComponent<RectTransform>();
			RectTransform component3 = ((Component)((Component)this).transform.Find("Border")).GetComponent<RectTransform>();
			if (vBase == null)
			{
				vBase = new List<Vector2>();
			}
			if (vBase.Count == 0)
			{
				vBase.Add(new Vector2(((Transform)component).localPosition.x, ((Transform)component).localPosition.y));
				vBase.Add(new Vector2(((Transform)component2).localPosition.x, ((Transform)component2).localPosition.y));
				vBase.Add(new Vector2(((Transform)component3).localPosition.x, ((Transform)component3).localPosition.y));
			}
			((Transform)component).localPosition = new Vector3(vBase[0].x + FFU_BR_Defs.OrgInventoryTweaks[0], vBase[0].y, 0f);
			((Transform)component2).localPosition = new Vector3(vBase[1].x + FFU_BR_Defs.OrgInventoryTweaks[0], vBase[1].y, 0f);
			((Transform)component3).localPosition = new Vector3(vBase[2].x + FFU_BR_Defs.OrgInventoryTweaks[0], vBase[2].y, 0f);
		}
		float num = 1f / (1.5f * CanvasManager.CanvasRatio);
		float x = ((Transform)component).localPosition.x;
		Rect rect = component.rect;
		float num2 = num * (x + ((Rect)(ref rect)).width / 2f + 5f) + 2f;
		float y = ((Transform)component).localPosition.y;
		rect = component.rect;
		float num3 = num * (y + ((Rect)(ref rect)).height / 2f) - FFU_BR_Defs.OrgInventoryTweaks[1];
		float num4 = num3;
		if ((Object)(object)winPrev != (Object)null)
		{
			num2 = ((Component)winPrev).transform.localPosition.x * num;
			float y2 = ((Component)winPrev).transform.localPosition.y;
			rect = winPrev.gridImageRect.rect;
			float num5 = y2 - ((Rect)(ref rect)).height;
			rect = ((Graphic)winPrev.tabImage).rectTransform.rect;
			num4 = num5 - ((Rect)(ref rect)).height * 1.7f;
			num4 *= num;
			rect = winCurrent.gridImageRect.rect;
			float height = ((Rect)(ref rect)).height;
			rect = ((Graphic)winCurrent.tabImage).rectTransform.rect;
			float num6 = (height + ((Rect)(ref rect)).height * 1.7f) * FFU_BR_Defs.OrgInventoryTweaks[5];
			rect = ((Graphic)winPrev.tabImage).rectTransform.rect;
			float num7 = ((Rect)(ref rect)).width + (float)Mathf.Max(winPrev.gridLayout.gridMaxX - 4, 0) * FFU_BR_Defs.OrgInventoryTweaks[4];
			if (num7 > colMaxWidth)
			{
				colMaxWidth = num7;
			}
			float num8 = num4 - num6;
			float num9 = 0f - num3 - 4f - FFU_BR_Defs.OrgInventoryTweaks[2];
			if (FFU_BR_Defs.ActLogging >= FFU_BR_Defs.ActLogs.Runtime)
			{
				Debug.Log((object)("#Info# Inventory Window: " + winCurrent.CO.strCODef + ", yOffset: " + $"{num4}, wHeight: {num6}, yOffsetRef: {num3}, yOffsetExpected: {num8}, yOffsetLimit: {num9}"));
			}
			if (num8 < num9)
			{
				num4 = num3;
				num2 += colMaxWidth + 42f + FFU_BR_Defs.OrgInventoryTweaks[3];
				colMaxWidth = 0f;
			}
		}
		else
		{
			colMaxWidth = 0f;
		}
		return new Vector2(num2, num4);
	}
}
public class patch_GUIQuickBar : GUIQuickBar
{
	private extern void orig_Start();

	private void Start()
	{
		QuickBarOverride();
		orig_Start();
	}

	private extern void orig_ExpandCollapse(bool refreshSizeOnly = false);

	private void ExpandCollapse(bool refreshSizeOnly = false)
	{
		QuickBarOverride();
		orig_ExpandCollapse(refreshSizeOnly);
	}

	private void QuickBarOverride()
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		if (FFU_BR_Defs.QuickBarPinning && FFU_BR_Defs.QuickBarTweaks.Length == 3)
		{
			base._pinPosition = new Vector3(FFU_BR_Defs.QuickBarTweaks[0], FFU_BR_Defs.QuickBarTweaks[1], 0f);
			base.bExpanded = FFU_BR_Defs.QuickBarTweaks[2] == 1f;
		}
	}
}
public class patch_GUIInventoryItem : GUIInventoryItem
{
	public extern void orig_OnShiftPointerDown();

	public void OnShiftPointerDown()
	{
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Invalid comparison between Unknown and I4
		if (!FFU_BR_Defs.BetterInvTransfer || (Object)(object)patch_GUIInventory.instance.targetWindow == (Object)null || (Object)(object)patch_GUIInventory.instance.targetWindow.CO == (Object)null || (Object)(object)base.windowData == (Object)(object)patch_GUIInventory.instance.targetWindow)
		{
			orig_OnShiftPointerDown();
			return;
		}
		CondOwner cO = patch_GUIInventory.instance.targetWindow.CO;
		if ((Object)(object)base.windowData != (Object)null && (int)base.windowData.type == 1 && (Object)(object)((GUIInventoryItem)this).CO.RootParent((string)null) == (Object)(object)cO)
		{
			if (!((Object)(object)((GUIInventoryItem)this).CO.objCOParent.DropCO(((GUIInventoryItem)this).CO, false, (Ship)null, 0f, 0f, true, (Func<int[], int[]>)null) == (Object)null))
			{
				((GUIInventoryItem)this).AttachToCursor((Ship)null);
			}
			return;
		}
		if ((Object)(object)base.windowData == (Object)null)
		{
			if (!((Object)(object)((GUIInventoryItem)this).CO.objCOParent.DropCO(((GUIInventoryItem)this).CO, false, (Ship)null, 0f, 0f, true, (Func<int[], int[]>)null) == (Object)null))
			{
				((GUIInventoryItem)this).AttachToCursor((Ship)null);
			}
			return;
		}
		((GUIInventoryItem)this).CO.RemoveFromCurrentHome(false);
		GUIInventory.RemoveTooltip((string)null);
		if ((Object)(object)base.windowData != (Object)null)
		{
			base.windowData.RemoveAndDestroy(((GUIInventoryItem)this).CO.strID);
		}
		else
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
		CondOwner val = cO.AddCO(((GUIInventoryItem)this).CO, true, true, false);
		if ((Object)(object)val == (Object)null)
		{
			if (GUIInventory.instance.IsCOShown(CrewSim.coPlayer) && CrewSim.coPlayer.HasCond("TutorialClothesWaiting"))
			{
				CrewSim.coPlayer.ZeroCondAmount("TutorialClothesWaiting");
				MonoSingleton<ObjectiveTracker>.Instance.CheckObjective(CrewSim.coPlayer.strID);
			}
			CrewSimTut.CheckHelmetAtmoTutorial();
			if (GUIInventory.CTOpenInv.Triggered(((GUIInventoryItem)this).CO, (string)null, true))
			{
				GUIInventory.instance.SpawnInventoryWindow(((GUIInventoryItem)this).CO, (InventoryWindowType)1, true);
			}
			GUIInventory.instance.RedrawAllWindows();
		}
		else
		{
			GUIInventoryItem val2 = GUIInventoryItem.SpawnInventoryItem(val.strID, (GUIInventoryWindow)null);
			if ((Object)(object)val2 != (Object)null)
			{
				val2.AttachToCursor((Ship)null);
			}
		}
	}

	public extern bool orig_MoveInventories(GUIInventoryWindow destination, Vector2 position, bool canPlaceSelf);

	public bool MoveInventories(GUIInventoryWindow destination, Vector2 position, bool canPlaceSelf)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		bool flag = orig_MoveInventories(destination, position, canPlaceSelf);
		if (flag)
		{
			patch_GUIInventory.instance.targetWindow = destination;
		}
		return flag;
	}
}
public class patch_GUIHelmet : GUIHelmet
{
	private double fPwrLast;

	private extern void orig_Init();

	private void Init()
	{
		orig_Init();
		base.ghTempInt.DangerLow = 289.15;
		base.ghTempInt.DangerHigh = 315.15;
	}

	[MonoModReplace]
	public void UpdateUI(CondOwner coRoomIn, CondOwner coRoomOut)
	{
		if ((Object)(object)coRoomIn == (Object)null || !coRoomIn.HasCond("IsHuman"))
		{
			((GUIHelmet)this).Style = (HelmetStyle)0;
			((GUIHelmet)this).Visible = false;
		}
		else
		{
			if ((Object)(object)coRoomOut == (Object)null)
			{
				return;
			}
			if (!base.bInit)
			{
				Init();
			}
			((GUIHelmet)this).Visible = true;
			List<CondOwner> list = new List<CondOwner>();
			bool flag = true;
			bool flag2 = true;
			bool flag3 = false;
			bool flag4 = false;
			if (coRoomIn.HasCond("IsEVAHUD"))
			{
				list = coRoomIn.compSlots.GetCOs("shirt_out", false, base.ctEVA);
				if (list.Count > 0)
				{
					CondOwner val = list[0];
					flag3 = true;
					if (flag3)
					{
						list = val.GetCOs(false, (CondTrigger)null);
						bool flag5 = false;
						bool flag6 = false;
						if (list != null)
						{
							double num = 0.0;
							double num2 = 0.0;
							double num3 = 0.0;
							double num4 = 0.0;
							double num5 = 0.0;
							double num6 = 0.0;
							foreach (CondOwner item in list)
							{
								if (base.ctEVABottle.Triggered(item, (string)null, false))
								{
									if (!flag5)
									{
										flag5 = true;
									}
									double condAmount = item.GetCondAmount("StatGasMolO2");
									double condAmount2 = item.GetCondAmount("StatRef");
									if (FFU_BR_Defs.ShowEachO2Battery)
									{
										num5 += condAmount / condAmount2 * 100.0;
										continue;
									}
									num += condAmount;
									num3 += condAmount2;
								}
								else if (base.ctEVABatt.Triggered(item, (string)null, false))
								{
									if (!flag6)
									{
										flag6 = true;
									}
									Powered component = ((Component)item).GetComponent<Powered>();
									double condAmount3 = item.GetCondAmount("StatPower");
									double num7 = item.GetCondAmount("StatPowerMax") * item.GetDamageState();
									if ((Object)(object)component != (Object)null)
									{
										num7 = component.PowerStoredMax;
									}
									if (num7 == 0.0)
									{
										num7 = 1.0;
									}
									if (FFU_BR_Defs.ShowEachO2Battery)
									{
										num6 += condAmount3 / num7 * 100.0;
										continue;
									}
									num2 += condAmount3;
									num4 += num7;
								}
							}
							if (flag5)
							{
								flag2 = false;
								if (!FFU_BR_Defs.ShowEachO2Battery)
								{
									num5 = num / num3 * 100.0;
								}
								base.txtO2.text = num5.ToString("n2") + "%";
								if (num5 != base.fO2Last)
								{
									if (num5 < (double)FFU_BR_Defs.SuitOxygenNotify)
									{
										base.asO2Beep.Play();
									}
									base.fO2Last = num5;
								}
							}
							if (flag6)
							{
								flag = false;
								if (!FFU_BR_Defs.ShowEachO2Battery)
								{
									num6 = num2 / num4 * 100.0;
								}
								base.txtBatt.text = num6.ToString("n2") + "%";
								if (num6 != fPwrLast)
								{
									if (num6 < (double)FFU_BR_Defs.SuitPowerNotify)
									{
										base.asO2Beep.Play();
									}
									fPwrLast = num6;
								}
							}
						}
					}
				}
				if (flag)
				{
					((GUIHelmet)this).Style = (HelmetStyle)1;
				}
				else
				{
					((GUIHelmet)this).Style = (HelmetStyle)2;
				}
			}
			else if (coRoomIn.HasCond("IsPSHUD"))
			{
				flag4 = true;
				((GUIHelmet)this).Style = (HelmetStyle)2;
			}
			((GUIHelmet)this).HUDOn = flag3;
			((GUIHelmet)this).GaugeOn = flag4;
			bool flag7 = (int)Time.realtimeSinceStartup % 2 == 0;
			double condAmount4 = coRoomIn.GetCondAmount("StatGasPpO2");
			double condAmount5 = coRoomIn.GetCondAmount("StatGasPpCO2");
			if (condAmount4 <= base.fO2PPMin || condAmount5 >= base.fCO2Max)
			{
				((GUIHelmet)this).TriggerTutorial();
			}
			if (flag4)
			{
				((GUIHelmet)this).UpdatePSGauge(condAmount4, condAmount5);
			}
			else if (flag3)
			{
				if (flag2)
				{
					base.txtO2.text = "ERROR";
				}
				base.ghO2Int.Value = coRoomIn.GetCondAmount("StatGasPpO2");
				base.ghO2Ext.Value = coRoomOut.GetCondAmount("StatGasPpO2");
				base.ghPressInt.Value = coRoomIn.GetCondAmount("StatGasPressure");
				base.ghPressExt.Value = coRoomOut.GetCondAmount("StatGasPressure");
				base.ghTempInt.Value = coRoomIn.GetCondAmount("StatGasTemp");
				base.ghTempExt.Value = coRoomOut.GetCondAmount("StatGasTemp");
				base.ghPressExt.DangerLow = base.ghPressInt.Value - base.fPressureDiffMax;
				base.ghPressExt.DangerHigh = base.ghPressInt.Value + base.fPressureDiffMax;
			}
		}
	}
}
namespace Ostranauts.UI.MegaToolTip.DataModules
{
	public class patch_NumberModule : NumberModule
	{
		public void SetData(CondOwner co)
		{
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)co == (Object)null || co.mapConds == null)
			{
				((ModuleBase)this)._IsMarkedForDestroy = true;
				return;
			}
			base._numbList.Clear();
			base._co = co;
			int num = 0;
			foreach (Condition value in co.mapConds.Values)
			{
				if (value.nDisplayType != 1)
				{
					continue;
				}
				NumbElement component = Object.Instantiate<GameObject>(base._numberElement, ((Component)base._tfNumbContainer).transform).GetComponent<NumbElement>();
				string text;
				if (value.strName == "StatGasTemp")
				{
					if (FFU_BR_Defs.AltTempEnabled)
					{
						double num2 = value.fCount * (double)value.fConversionFactor;
						double num3 = value.fCount * (double)FFU_BR_Defs.AltTempMult + (double)FFU_BR_Defs.AltTempShift;
						text = num2.ToString("N3") + value.strDisplayBonus + " | " + num3.ToString("N1") + FFU_BR_Defs.AltTempSymbol;
					}
					else
					{
						text = MathUtils.GetTemperatureString(value.fCount * (double)value.fConversionFactor);
					}
				}
				else
				{
					text = (value.fCount * (double)value.fConversionFactor).ToString("N3") + value.strDisplayBonus;
				}
				component.SetData(value.strNameFriendly, value.strName, text, GrammarUtils.GetInflectedString(value.strDesc, value, co), DataHandler.GetColor(value.strColor));
				base._numbList.Add(component);
				num++;
				Transform transform = ((Component)this).transform;
				LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)(object)((transform is RectTransform) ? transform : null));
				component.ForceMeshUpdate();
			}
			Transform transform2 = ((Component)this).transform;
			LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)(object)((transform2 is RectTransform) ? transform2 : null));
			Transform parent = ((Component)this).transform.parent;
			LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)(object)((parent is RectTransform) ? parent : null));
			if (num == 0)
			{
				((ModuleBase)this)._IsMarkedForDestroy = true;
			}
		}

		protected void OnUpdateUI()
		{
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			if (base._numbList.Count == 0)
			{
				return;
			}
			foreach (NumbElement numb in base._numbList)
			{
				Condition cond = DataHandler.GetCond(numb.CondName);
				double condAmount = base._co.GetCondAmount(numb.CondName);
				string text;
				if (cond.strName == "StatGasTemp")
				{
					if (FFU_BR_Defs.AltTempEnabled)
					{
						double num = condAmount * (double)cond.fConversionFactor;
						double num2 = condAmount * (double)FFU_BR_Defs.AltTempMult + (double)FFU_BR_Defs.AltTempShift;
						text = num.ToString("N3") + cond.strDisplayBonus + " | " + num2.ToString("N1") + FFU_BR_Defs.AltTempSymbol;
					}
					else
					{
						text = MathUtils.GetTemperatureString(condAmount * (double)cond.fConversionFactor);
					}
				}
				else
				{
					text = (condAmount * (double)cond.fConversionFactor).ToString("N3") + cond.strDisplayBonus;
				}
				numb.SetData(cond.strNameFriendly, numb.CondName, text, GrammarUtils.GetInflectedString(cond.strDesc, cond, base._co), DataHandler.GetColor(cond.strColor));
			}
			Transform parent = ((Component)this).transform.parent;
			LayoutRebuilder.MarkLayoutForRebuild((RectTransform)(object)((parent is RectTransform) ? parent : null));
		}
	}
}
namespace Ostranauts.Ships.Commands
{
	public class patch_HoldStationAutoPilot : HoldStationAutoPilot
	{
		[MonoModIgnore]
		public patch_HoldStationAutoPilot(IAICharacter pilot)
			: base(pilot)
		{
		}

		public CommandCode RunCommand()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			Ship shipStationKeepingTarget = ((BaseCommand)this).ShipUs.shipStationKeepingTarget;
			if (shipStationKeepingTarget == null || shipStationKeepingTarget.objSS == null || ((BaseCommand)this).ShipUs == null)
			{
				return (CommandCode)8;
			}
			if (shipStationKeepingTarget.bDestroyed)
			{
				((BaseCommand)this).ShipUs.shipStationKeepingTarget = CrewSim.system.GetShipByRegID(shipStationKeepingTarget.strRegID);
				if (((BaseCommand)this).ShipUs.shipStationKeepingTarget == null)
				{
					return (CommandCode)8;
				}
				shipStationKeepingTarget = ((BaseCommand)this).ShipUs.shipStationKeepingTarget;
			}
			else if ((((BaseCommand)this).ShipUs.IsDocked() && (!FFU_BR_Defs.TowBraceAllowsKeep || !((BaseCommand)this).ShipUs.TowBraceSecured())) || shipStationKeepingTarget.HideFromSystem)
			{
				return (CommandCode)1;
			}
			GUIOrbitDraw val = null;
			GUIDockSys val2 = null;
			Dictionary<string, string> dictionary = null;
			if ((Object)(object)CrewSim.goUI != (Object)null)
			{
				val = CrewSim.goUI.GetComponent<GUIOrbitDraw>();
				val2 = CrewSim.goUI.GetComponent<GUIDockSys>();
			}
			if ((Object)(object)val != (Object)null)
			{
				dictionary = ((GUIData)val).GetPropMap();
			}
			if (((HoldStationAutoPilot)this).PauseDuringPlayerInput(val, val2))
			{
				return (CommandCode)4;
			}
			float num = 0f;
			float num2 = 0f;
			float num3 = 0f;
			float num4 = (float)(shipStationKeepingTarget.objSS.vVelX - ((BaseCommand)this).ShipUs.objSS.vVelX);
			float num5 = (float)(shipStationKeepingTarget.objSS.vVelY - ((BaseCommand)this).ShipUs.objSS.vVelY);
			float num6 = (float)(shipStationKeepingTarget.objSS.vPosx - ((BaseCommand)this).ShipUs.objSS.vPosx);
			float num7 = (float)(shipStationKeepingTarget.objSS.vPosy - ((BaseCommand)this).ShipUs.objSS.vPosy);
			float num8 = Mathf.Cos(((BaseCommand)this).ShipUs.objSS.fRot);
			float num9 = Mathf.Sin(((BaseCommand)this).ShipUs.objSS.fRot);
			float num10 = 0f;
			num10 += Mathf.Atan2(num6 * num8 + num7 * num9, (0f - num6) * num9 + num7 * num8) * (-0.2f + -0.3f / Time.timeScale);
			num10 -= ((BaseCommand)this).ShipUs.objSS.fW * 0.3f;
			float num11 = 1f / Time.timeScale;
			num3 = MathUtils.Clamp(num10, 0f - num11, num11);
			float num12 = Mathf.Abs(num4);
			float num13 = Mathf.Abs(num5);
			if ((double)num12 <= 1E-11 && (double)num13 <= 1E-11 && Mathf.Abs(num3) <= 0.05f && ((BaseCommand)this).ShipUs.objSS.fW == 0f)
			{
				((BaseCommand)this).ShipUs.Maneuver(0f, 0f, 0f, 0, 1E-10f, (EngineMode)1);
				return (CommandCode)4;
			}
			if ((double)num12 > 1E-11 && num12 > num13)
			{
				num = ((!(num4 < 0f)) ? 1f : (-1f));
			}
			else
			{
				((BaseCommand)this).ShipUs.objSS.vVelX = shipStationKeepingTarget.objSS.vVelX;
			}
			if ((double)num13 > 1E-11 && num13 > num12)
			{
				num2 = ((!(num5 < 0f)) ? 1f : (-1f));
			}
			else
			{
				((BaseCommand)this).ShipUs.objSS.vVelY = shipStationKeepingTarget.objSS.vVelY;
			}
			float num14 = num * num8 + num2 * num9;
			float num15 = 0f - (num * num9 - num2 * num8);
			if (dictionary != null)
			{
				base._engineMode = ((!dictionary.TryGetValue("nKnobEngineMode", out var value)) ? 1 : int.Parse(value));
				base._throttleSld = ((!dictionary.TryGetValue("slidThrottle", out value)) ? 0.25f : float.Parse(value));
			}
			((BaseCommand)this).ShipUs.Maneuver(num14 * base._throttleSld, num15 * base._throttleSld, num3 * base._throttleSld, 0, CrewSim.TimeElapsedScaled(), (EngineMode)base._engineMode);
			return (CommandCode)4;
		}
	}
}
namespace FFU_Beyond_Reach
{
	[MonoModIgnore]
	public class FFU_BR_Defs
	{
		public enum SyncLogs
		{
			None,
			ModChanges,
			DeepCopy,
			ModdedDump,
			ExtendedDump,
			ContentDump,
			SourceDump
		}

		public enum ActLogs
		{
			None,
			Interactions,
			Runtime
		}

		public static SyncLogs SyncLogging;

		public static ActLogs ActLogging;

		public static bool DynamicRandomRange;

		public static int MaxLogTextSize;

		public static bool ModSyncLoading;

		public static bool EnableCodeFixes;

		public static bool ModifyUpperLimit;

		public static float BonusUpperLimit;

		public static float SuitOxygenNotify;

		public static float SuitPowerNotify;

		public static bool ShowEachO2Battery;

		public static bool StrictInvSorting;

		public static bool AltTempEnabled;

		public static string AltTempSymbol;

		public static float AltTempMult;

		public static float AltTempShift;

		public static bool TowBraceAllowsKeep;

		public static bool OrgInventoryMode;

		public static float[] OrgInventoryTweaks;

		public static bool BetterInvTransfer;

		public static bool QuickBarPinning;

		public static float[] QuickBarTweaks;

		public static bool NoSkillTraitCost;

		public static bool AllowSuperChars;

		public static float SuperCharMultiplier;

		public static string[] SuperCharacters;
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}