Decompiled source of MeridianArk v1.6.0
Mods/StationShip.dll
Decompiled 8 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading.Tasks; using BoneLib; using BoneLib.BoneMenu; using BoneLib.Notifications; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Marrow; using Il2CppSLZ.Marrow.AI; using Il2CppSLZ.Marrow.Combat; using Il2CppSLZ.Marrow.Data; using Il2CppSLZ.Marrow.Interaction; using Il2CppSLZ.Marrow.Pool; using Il2CppSLZ.Marrow.PuppetMasta; using Il2CppSLZ.Marrow.Utilities; using Il2CppSLZ.Marrow.Warehouse; using Il2CppSLZ.VRMK; using Il2CppSystem.Collections.Generic; using Il2CppUltEvents; using LabFusion.Entities; using LabFusion.Marrow.Integration; using LabFusion.Network; using LabFusion.Network.Serialization; using LabFusion.Player; using LabFusion.SDK.Modules; using LabFusion.Senders; using LabFusion.Voice; using LabFusion.Voice.Unity; using MelonLoader; using MelonLoader.Preferences; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using StationShip; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(StationMod), "StationShip", "1.6.0", "callofike", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: MelonAdditionalDependencies(new string[] { "BoneLib" })] [assembly: MelonOptionalDependencies(new string[] { "LabFusion" })] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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; } } } namespace StationShip { internal sealed class Station : INetThing { private enum AirPhase { Idle, InnerOpen, Count, Vent, Closing } private sealed class AirParts { public Transform OuterPivot; public Transform InnerPivot; public Transform Cover; public Vector3 OuterHome; public Vector3 InnerHome; public Quaternion CoverHome; public GameObject AlarmRoom; public GameObject AlarmTunnel; public GameObject BeepRoom; public GameObject BeepTunnel; public GameObject Rush; public GameObject DoorIn; public GameObject DoorOut; public GameObject ThunkIn; public GameObject ThunkOut; public GameObject Burst; public GameObject Swirl; public GameObject[] Beacons; public Canvas Tunnel; public Canvas Room; public Canvas Big; } private enum AirNet { Phase = 7 } private sealed class Pad { public int N; public Transform Root; public Canvas Screen; public readonly List<Material> Rgb = new List<Material>(); public readonly List<Material> Faces = new List<Material>(); public readonly Dictionary<string, Material> KeyMat = new Dictionary<string, Material>(); public readonly Dictionary<string, float> KeyFlash = new Dictionary<string, float>(); public readonly List<(Transform cap, string key)> Caps = new List<(Transform, string)>(); public Material Bar; public Material Slot0; public Material Slot1; public Material Main; public GameObject Ok; public GameObject Bad; public GameObject Alarm; public GameObject Beep; public string Typed = ""; public string Msg = ""; public string Msg2 = ""; public string Drawn = ""; public Color32 MsgColor; public float MsgUntil; public float GreenUntil; public float RedUntil; public float AlarmUntil; public float NextHand; public float IntruderUntil; public Transform BoltGroup; public Transform Flash; public Transform[] Segs; public Transform[] Forks; public ParticleSystem Sparks; public GameObject Zap; public GameObject Thunder; public float BoltUntil = -1f; public float NextJag; public float ThunderAt = -1f; public byte Victim; public bool Mine; } private enum KeyNetEv { State = 9, Alarm } private sealed class Track { public string Word; public string Env; public AudioClip Clip; public float Drop; public int Id; public SongBook.Song File; public float Length { get { if (!((Object)(object)Clip != (Object)null)) { return 0f; } return Clip.length; } } public bool Ready() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 if (File != null) { bool num = SongBook.Ready(File); if (num) { Clip = File.Clip; Env = File.Env; } return num; } if ((int)Clip.loadState != 2) { Clip.LoadAudioData(); return false; } return true; } } private enum PodPhase { Docked, Sealing, Away, Landed, Redock, Return } private enum PodNet { Phase = 8 } private sealed class PodParts { public Transform Pod; public Transform Dock; public Transform Hatch; public Transform Chute; public Transform Tunnel; public Transform Collar; public Rigidbody Body; public GameObject Flames; public GameObject Hiss; public GameObject Thrust; public GameObject Pop; public GameObject Thud; public GameObject HatchMove; public GameObject TunnelMove; public GameObject Clamps; public Seat[] Seats; public Rigidbody[] Loose; public Collider[] Solid; public Canvas Panel; public Canvas Sign; public Canvas CamName; public Vector3 ChuteScale; public Transform Cover; public Quaternion CoverHome; public Camera Cam; public readonly Transform[] Mounts = (Transform[])(object)new Transform[3]; public readonly List<Material> Rgb = new List<Material>(); public readonly List<(Renderer r, Material shared)> Restore = new List<(Renderer, Material)>(); } private sealed class Part { public Rigidbody Rb; public Vector3 Pos; public Quaternion Rot; public RigidbodyInterpolation Was; } private sealed class Load { public Transform Top; public readonly List<Part> Parts = new List<Part>(); public InteractableHost[] Hosts; public bool Settled; public float Fall; public float Half; } private enum Go { None, Launch, Land } private enum ArkEvent { Tell, Say, Speak, Sound, Trigger, TowerShow, Notify } private sealed class Line { public string Name; public GameObject Go; public AudioSource Source; public bool Was; public bool Check; public bool Far; } public enum Run : byte { None, Load, InStand, Count, Climb } private const float AirCount = 3f; private const float AirVent = 3.4f; private const float AirOutOpen = 0.55f; private const float AirOutClose = 2.4f; private const float AirInMove = 1.4f; private const float AirPushFrom = 0.3f; private const float AirOutSlide = 2.147f; private const float AirInSlide = 1.681f; private const float AirOutDoorZ = 0.35f; private static readonly Vector3 AirRoomMin = new Vector3(-3.98f, -2.1f, -1.24f); private static readonly Vector3 AirRoomMax = new Vector3(-1.9f, 2.2f, 2.6f); private static readonly Vector3 AirDoorMin = new Vector3(-4.8f, -2.1f, -0.6f); private static readonly Vector3 AirDoorMax = new Vector3(-3.9f, 0.45f, 1.3f); private static readonly Il2CppReferenceArray<Collider> AirHits = new Il2CppReferenceArray<Collider>(256L); private AirParts _air; private AirPhase _airPhase; private float _airAt; private float _airIn; private float _airOut; private float _airNextShare; private float _airNextDraw; private float _airThrown = -100f; private float _airLastBeep = -1f; private bool _airInMoving; private bool _airOutMoving; private bool _airVentFx; private bool _airWarned; private string _airDrawn = ""; private readonly HashSet<IntPtr> _airPushed = new HashSet<IntPtr>(); private Rigidbody[] _airRig; private int _airErrors; private const float AirOutBackX = -3.9f; private const float AirSpeed = 11f; private const float AirAccel = 48f; private static readonly Color32 AirRed = new Color32(byte.MaxValue, (byte)50, (byte)40, byte.MaxValue); private static readonly Color32 AirGreen = new Color32((byte)70, byte.MaxValue, (byte)110, byte.MaxValue); private static readonly Color32 AirAmber = new Color32(byte.MaxValue, (byte)175, (byte)40, byte.MaxValue); private static readonly Color32 AirWhite = new Color32((byte)225, (byte)235, byte.MaxValue, byte.MaxValue); private const byte DimStage = 95; private const float DimRate = 0.7f; private static readonly Color NightTint = new Color(0.1f, 0.14f, 0.42f); private static readonly int BaseColor = Shader.PropertyToID("_BaseColor"); private readonly List<(Material m, Color c)> _dimMats = new List<(Material, Color)>(); private float _dimWant = 1f; private float _dimNow = 1f; private float _nightWant; private float _nightNow; private static readonly float[] EqEdges = new float[6] { 20f, 150f, 500f, 2000f, 6000f, 16000f }; private Il2CppStructArray<float> _spec; private readonly float[] _eqLvl = new float[5]; private bool _specBroken; private float _binHz = -1f; private Quaternion _stickRest; private Quaternion _knobHome; private Rigidbody _stickRb; private Rigidbody _knobRb; private Vector3 _stickHome; private Transform _knob; private Vector2 _thumb; private bool _piloting; private bool _flying; private bool _landAfterFly; private bool _flySaid; private Vector3 _flyVel; private Vector3 _flyWant; private float _flyYawV; private float _quietFor; private float _nextParkedHint; private float _noTakeOver; private float _nextFlyLog; private float _grip; private int _rateSaid; private string _holdWord = "NOT HELD"; private string _dbg1 = ""; private string _dbg2 = ""; private Camera _camTop; private Camera _camTgt; private Camera _camChase; private float _nextTop; private float _nextPip; private int _view; private Vector3 _camRestPos; private Quaternion _camRestRot; private bool _camSeen; private bool _bDown; private GameObject[] _viewWall; private GameObject[] _viewStrip; private GameObject _crossWall; private GameObject _crossStrip; private static readonly string[] ViewWords = new string[5] { "TARGET", "BELOW", "FRONT", "REAR", "OUTSIDE CHASE" }; private readonly List<(AudioSource src, float was)> _clicks = new List<(AudioSource, float)>(); private string _lastTouch = "none yet"; private float _nextClickLog; private static readonly int KpColor = Shader.PropertyToID("_BaseColor"); private readonly List<Pad> _pads = new List<Pad>(); private readonly List<(Renderer r, Material shared)> _kpRestore = new List<(Renderer, Material)>(); private readonly KeyLock _lock = new KeyLock(); private bool _kLocked = true; private bool _kNeeds; private bool _kReady; private int _kOwner = -1; private readonly HashSet<byte> _kAccess = new HashSet<byte>(); private float _kNextShare; private float _kNextOwner; private float _kNextSet; private float _kNextDraw; private float _kNextLight; private float _kNextLeft; private float _kMyOutUntil; private float _kNextDeny; private int _kTries = 3; private uint _kSentFlags = uint.MaxValue; private string _kSentAccess = ""; private readonly Dictionary<byte, float> _kDenyTo = new Dictionary<byte, float>(); private float _outsidePressAt = -10f; private float _nextRefuse; private static readonly Color32 KGreen = new Color32((byte)70, byte.MaxValue, (byte)120, byte.MaxValue); private static readonly Color32 KRed = new Color32(byte.MaxValue, (byte)60, (byte)50, byte.MaxValue); private static readonly Color32 KAmber = new Color32(byte.MaxValue, (byte)180, (byte)50, byte.MaxValue); private static readonly Color32 KDim = new Color32((byte)120, (byte)170, (byte)210, byte.MaxValue); private static readonly Color32 KWhite = new Color32((byte)230, (byte)240, byte.MaxValue, byte.MaxValue); private const int MovieNetEv = 11; private const float MovieNear = 15f; private Transform _mvRoot; private Transform _mvScreen; private Transform _mvPanelT; private VideoPlayer _vp; private MeshRenderer _vidR; private AudioSource _mvAudio; private Canvas _mvOsd; private Canvas _mvPanel; private readonly List<Material> _mvRgb = new List<Material>(); private readonly List<(Renderer r, Material shared)> _mvRestore = new List<(Renderer, Material)>(); private readonly MovieState _mv = new MovieState(); private string _mvUrl = ""; private string _mvDrawn = ""; private string _mvMsgLogged = ""; private bool _mvPrepared; private bool _vpPlaying; private bool _mvSeekBroken; private bool _mvNearWas; private bool _mvFailed; private float _mvLen = -1f; private float _mvPrepAt; private float _mvNextSync; private float _mvNextShare; private float _mvOsdUntil; private float _mvNextDraw; private float _mvNextLight; private float _mvNextSeek; private float _mvLastPress; private ButtonGate.Entry _mvHold; private float _mvHoldAt; private float _mvHoldRate; private int _mvHoldDir; private const float PodMovieNear = 4f; private Transform _pmScreen; private MeshRenderer _pmVidR; private Canvas _pmOsd; private Vector3 _mvAudioHome; private bool _mvAudioInPod; private readonly Canvas[] _mvStrips = new Canvas[2]; private bool _mvHeldJuke; private string _mvUrlId = ""; private static readonly Color32 MvWhite = new Color32((byte)230, (byte)238, (byte)250, byte.MaxValue); private static readonly Color32 MvCyan = new Color32((byte)90, (byte)220, byte.MaxValue, byte.MaxValue); private static readonly Color32 MvDim = new Color32((byte)110, (byte)140, (byte)170, byte.MaxValue); private static readonly Color32 MvBar = new Color32((byte)40, (byte)50, (byte)60, byte.MaxValue); private static readonly Color32 MvBack = new Color32((byte)5, (byte)7, (byte)11, (byte)210); private static readonly Color32 MvRed = new Color32(byte.MaxValue, (byte)80, (byte)70, byte.MaxValue); private const byte MusicStage = 98; private const float NotPlaying = -1f; private const float StateOnly = -2f; private const int LaunchOffFlag = 100; private readonly List<Track> _tracks = new List<Track>(); private readonly List<AudioSource> _spkMusic = new List<AudioSource>(); private readonly List<AudioSource> _spkVoice = new List<AudioSource>(); private readonly List<Behaviour> _spkFilters = new List<Behaviour>(); private readonly Material[] _rings = (Material[])(object)new Material[8]; private AudioSource _big; private Canvas _jukeScreen; private int _choice; private int _lightMode; private int _lightColor; private float _sharedVol; private float _sharedShown; private float _musicFade; private float _duck = 1f; private float _inside; private float _musicPos; private float _lightClock; private float _jukeAt; private float _startedAt = -100f; private float _nextJuke; private float _farMusicAt = -100f; private float _farMusicPos; private float _nextMusicNet; private float _nextDrift; private float _nextLight; private bool _farWant; private bool _wantWas; private bool _liftSaid; private bool _launchOn = true; private bool _jukeOn; private bool _hushed; private bool _isLaunch; private bool _missing; private Track _playing; private static readonly int ColorId = Shader.PropertyToID("_BaseColor"); private bool _jukeHeld; private float _jukeHeldPos; private float _lightLevel = -1f; private float _lightFlash; private const float PodSep = 5.5f; private const float PodRedock = 4.5f; private const float PodHatchSecs = 1.6f; private static readonly string[] PodViews = new string[3] { "DOWN", "FRONT", "REAR" }; private PodParts _pod; private PodPhase _podPhase; private float _podAt; private float _podPrevT; private float _podHatch = 1f; private float _podTunnel = 1f; private float _podNextShare; private float _podNextDraw; private float _podNextBelt; private float _podNextCam; private float _podNextLight; private bool _podHatchOpen = true; private bool _podHatchMoving; private bool _podCapsHeld; private bool _podLate; private bool _podFromReturn; private bool _podCamLive; private int _podView; private PodPath _podPath; private ReturnPath _podReturn; private Vector3 _podLandPos; private float _podLandYaw; private float _podYaw; private Seat _podStrapped; private readonly List<(Collider a, Collider b)> _podIgnored = new List<(Collider, Collider)>(); private string _podDrawn = ""; private float _podRefusedUntil; private bool _podBoarded; private int _podErrors; private bool _pinOn; private Vector3 _pinLocal; private float _pinFrom; private float _pinWorst; private Rigidbody[] _pinBodies; private int _pinSteps; private readonly List<(Transform cap, string send)> _podHandButtons = new List<(Transform, string)>(); private bool _podLiveDot; private static readonly Color32 LiveRed = new Color32(byte.MaxValue, (byte)45, (byte)40, byte.MaxValue); private const float RoomR = 4.35f; private const float RoomAft = -12.8f; private const float RoomFore = 14.7f; private static readonly Il2CppReferenceArray<Collider> RideHits = new Il2CppReferenceArray<Collider>(1024L); private readonly List<Load> _loads = new List<Load>(); private readonly HashSet<IntPtr> _loadTops = new HashSet<IntPtr>(); private Vector3 _shipP; private Quaternion _shipR; private bool _shipSet; private float _nextRide; private float _stunUntil = -1f; private bool _stunned; private readonly Random _jag = new Random(); private const int SeatNetEv = 12; private const float SitHold = 1f; private bool _sitChoice; private readonly Dictionary<string, byte> _seatTaken = new Dictionary<string, byte>(); private string _seatSent = ""; private float _seatNextShare; private float _seatNextClean; private bool _bHeld; private bool _bNeedRelease; private float _bAt; private Seat _bTarget; private Canvas _sitHint; private GameObject _sitHintGo; private string _sitDrawn = ""; private const float SafeDistance = 30f; private const float ShipHalf = 22f; private const float GroundFromAbove = 900f; private const float Lift = 5.9f; private const float Reach = 16f; private const float Countdown = 5f; private const float DeckY = -2f; private const float Belly = 6.5f; private const float BeamLen = 476f; private const float MostSlope = 2.5f; private static readonly Vector3[] Feet = (Vector3[])(object)new Vector3[4] { new Vector3(-4.7f, 0f, -14f), new Vector3(4.7f, 0f, -14f), new Vector3(-4.7f, 0f, 16.5f), new Vector3(4.7f, 0f, 16.5f) }; private static readonly Vector3 CabinCentre = new Vector3(0f, 1f, 1f); private static readonly Vector3 CabinHalf = new Vector3(7f, 5.5f, 17f); private static readonly Il2CppStructArray<RaycastHit> Hits = new Il2CppStructArray<RaycastHit>(64L); private static readonly Il2CppReferenceArray<Collider> Overlaps = new Il2CppReferenceArray<Collider>(128L); public readonly Transform Root; public readonly Transform HullT; public readonly Rigidbody Hull; private readonly Animator _a; private readonly int _doorLayer; private readonly float _born = Time.time; private FishTank _fishTank; private float _nextStand; private bool _placed; public readonly ShipSim Sim = new ShipSim(); private readonly GameObject _doorFree; private readonly GameObject _sndLaunch; private readonly GameObject _sndLand; private readonly Transform _beamRig; private readonly Transform _pilotRig; private readonly Transform _coneRig; private readonly Transform _charge; private readonly List<Rigidbody> _loose = new List<Rigidbody>(); private readonly List<Rigidbody> _cargo = new List<Rigidbody>(); private readonly HashSet<IntPtr> _cargoSeen = new HashSet<IntPtr>(); private Go _pending; private float _goAt = -1f; private float _nextCargo; private float _nextToggle; private float _height; private RideMethod _method; private bool _frozen; private bool _hasLz; private Vector3 _lz; private float _worstAbove; private float _worstBelow; private float _flightStart; private float _lastFrame; private float _worstFrame; private int _aboardSteps; private int _steps; private bool _lostSaid; private bool _aboardAtStart; private float _waitAfterDoors; private readonly Canvas _data; private readonly Canvas _logScreen; private readonly Canvas _wall; private readonly Canvas _wallTop; private readonly Canvas _wallOrbit; private readonly Canvas _wallRight; private readonly GameObject _wallTx; private readonly GameObject _wallSafe; private readonly GameObject _armedLamp; private readonly GameObject _wallClose; private readonly GameObject _wallNone; private readonly GameObject _wallFire; private readonly GameObject _wallFlash; private readonly GameObject _lit; private readonly GameObject _bcWarning; private readonly GameObject _bcWatched; private readonly GameObject _bcCount; private readonly GameObject _say0; private readonly GameObject _say1; private readonly GameObject _lockInd; private readonly Transform _scan; private string _wallSaid = ""; private readonly PanelData _p = new PanelData(); private readonly List<string> _mission = new List<string>(); private readonly List<Vector3> _npcAt = new List<Vector3>(); private readonly List<Vector3> _playerAt = new List<Vector3>(); private float _nextLive; private float _nextScan; private float _missionStart = -1f; private float _flashUntil; private float _lastAlt; private int _killsSeen; private bool _wasBcW; private bool _wasBcS; private bool _wasBcC; private bool _wasSay0; private bool _wasSay1; private bool _wasTalkLog; private bool _wasLock; private bool _wasArmed; private bool _wasFall; private bool _wasMoving; private readonly List<string> _lines = new List<string>(); private float _nextDraw; private string _lzSaid = ""; private static readonly Color32 Green = new Color32((byte)90, byte.MaxValue, (byte)150, byte.MaxValue); private static readonly Color32 Amber = new Color32(byte.MaxValue, (byte)190, (byte)70, byte.MaxValue); private static readonly Color32 White = new Color32((byte)225, (byte)235, (byte)245, byte.MaxValue); private static readonly Color32 Red = new Color32(byte.MaxValue, (byte)80, (byte)70, byte.MaxValue); private bool _wasBeamLog; private float _nextKillLog; private float _nextWords; private bool _wasHitNow; private static readonly Il2CppStructArray<RaycastHit> GroundHits = new Il2CppStructArray<RaycastHit>(32L); private readonly Rigidbody _probe; private readonly Transform _probeT; private readonly Transform _strike; private readonly Transform _aimF; private readonly Transform _aimR; private readonly Transform _mark; private readonly Transform _fireT; private readonly Transform _fireD; private readonly Transform _safeOn; private bool _safeSeen; private bool _lastSafe; private bool _wantApply; private float _applyAt; private int _safetyVersion; private readonly GameObject _tooClose; private readonly GameObject _tooCloseMain; private readonly GameObject _noBeacon; private readonly GameObject _noBeaconMain; private readonly Il2CppArrayBase<CrateSpawner> _spawners; private Transform _target; private bool _wasStriking; private bool _abortSent; private bool _wasFired; private bool _wasBeam; private bool _wasImpact; private float _pressAt = -100f; private float _talkSince; private float _talkLast; private bool _talking; private bool _hearApplied; private bool _hearOk; private readonly GameObject _sayOn; private readonly GameObject _bcAllowed; private readonly GameObject _shockHit; private readonly GameObject _shockEnd; private bool _hitWasOn; private bool _endWasOn; private float _nextPulse; private float _txLevel; private float _nextTxLog; private readonly GameObject _txPanel; private readonly GameObject _txLight; private readonly GameObject _txMuted; private readonly GameObject _voiceOut; private readonly Transform _txBar; private readonly GameObject _gTalk; private readonly GameObject _gSolo; private readonly GameObject _gPref; private readonly GameObject _talkLamp; private readonly UltEventHolder _talkRelease; private readonly Laser _laser = new Laser(); private readonly Transform[] _yields = (Transform[])(object)new Transform[4]; private float _nextGround; private float _groundY = float.NaN; private readonly Transform _stick; private readonly Transform _stickHandle; private readonly Dictionary<string, UltEventHolder> _sends = new Dictionary<string, UltEventHolder>(); private bool _aDown; private float _nextZoom; private bool _wasCloseArmed; private bool _wasOpening; private bool _wasClosing; private int _txPos; private (string name, Action run)[] _frame = new(string, Action)[0]; private readonly Dictionary<string, int> _stepErrors = new Dictionary<string, int>(); private readonly List<TriggerEvents3D> _entries = new List<TriggerEvents3D>(); private readonly Dictionary<string, UltEventHolder> _rpcs = new Dictionary<string, UltEventHolder>(); private readonly ShipFollower _fm = new ShipFollower(); private uint _sentFlags = uint.MaxValue; private ushort _shareSeq; private ushort _poseSeq; private ushort _sentTower; private float _nextShare; private float _nextPose; private float _nextPilot; private float _farPilotAt = -100f; private float _lastInput = -100f; private float _silentUntil; private float _sentSegStart = float.NaN; private float _sentRate = float.NaN; private bool _fAway; private bool _wasPilot; private bool _snapDone; private bool _wasBoss = true; private Vector2 _farTilt; private Vector2 _farThumb; private static readonly string[] BoolParams = new string[7] { "On", "Over", "Beam", "AutoCount", "Home", "Up", "Fly" }; private static readonly string[] IntParams = new string[7] { "Weapon", "Pip", "Zoom", "BeaconMode", "BeamW", "Dim", "ShipSpeed" }; private static readonly string[] BossTriggers = new string[25] { "Launch", "LandCmd", "SetLz", "MusicNext", "MusicUp", "MusicDown", "MusicLaunch", "JukePlay", "JukeLights", "TowerGo", "TowerLoad", "FlightAbort", "DimDown", "DimUp", "Dim100", "Dim60", "Dim30", "DimNight", "AirOpen", "AirClose", "AirEject", "AirRoom", "PodLaunch", "PodHatch", "PodReturn" }; private static readonly string[] AllTriggers = new string[33] { "Arm", "Fire", "Abort", "BeaconNext", "Launch", "LandCmd", "SetLz", "Toggle", "TowerGo", "TowerLoad", "FlightAbort", "CamNext", "MusicNext", "MusicUp", "MusicDown", "MusicLaunch", "JukePlay", "JukeLights", "DimDown", "DimUp", "Dim100", "Dim60", "Dim30", "DimNight", "Debounce", "AirOpen", "AirClose", "AirEject", "AirRoom", "PodLaunch", "PodHatch", "PodReturn", "PodCam" }; private bool _jammed; private bool _gliding; private bool _noRoomSaid; private Vector3 _glideTo; private float _jamSince; private static bool _measured; private static Vector3 _boxMid; private static Vector3 _boxHalf; private readonly List<Line> _lines2 = new List<Line>(); private AudioSource _pa; private AudioSource _humSound; private readonly List<string> _sayNext = new List<string>(); private float _voiceFree; private string _forced; private const float CountFrom = 14f; private Run _run; private LaunchTower _tw; private TowerPath _path; private float _tt; private float _rate = 1f; private float _cnt; private float _climbT; private float _height2; private float _nextHum; private float _runSpeed; private float _nextSync; private float _nextBelt; private float _legU; private float _beltLog; private bool _auto; private bool _abortClimb; private bool _wasHooked; private bool _wasLocked; private bool _flatDone; private bool _belts; private bool _beltFree; private Vector3 _padHull; private Vector3 _flatPivot; private Vector3 _lastPos; private float _flatYaw; private ShipPath _climb; private readonly Transform[] _legs = (Transform[])(object)new Transform[12]; private readonly Quaternion[] _legRest = (Quaternion[])(object)new Quaternion[12]; private Seat _strapped; private Seat[] _seats; private readonly List<(Collider a, Collider b)> _ignored = new List<(Collider, Collider)>(); private readonly Dictionary<string, GameObject> _voices = new Dictionary<string, GameObject>(); private GameObject _hum; private GameObject _flames; private GameObject _outsidePanel; private GameObject _post; private Transform _outsidePanelT; private readonly List<(Transform cap, string send)> _handButtons = new List<(Transform, string)>(); private float _nextHandPress; private float _craneVoiceAt = -1f; private bool _clampsSaid; private bool _pitchSaid; private bool _sideSeen; private bool _rider; private float _nextCatch; private readonly List<Collider> _contacts = new List<Collider>(); private float AirT => Time.time - _airAt; private bool AirCoverOpen { get { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (_air != null) { return Quaternion.Angle(_air.Cover.localRotation, _air.CoverHome) > 35f; } return false; } } private bool AirLetsGo { get { if (_air != null) { if (!(Time.time - _airThrown < 25f)) { if (_airPhase == AirPhase.Vent) { return AirMeInside(); } return false; } return true; } return false; } } private int RateNow => ManualFlight.Rate(_a.GetInteger("ShipSpeed")); private float TopSpeed => StationMod.PrefFlySpeed.Value * ManualFlight.RateK[RateNow]; private static byte Me => ArkBus.Me; private bool MyAccess => KeyLock.Allowed(_kLocked, _kOwner, _kNeeds, _kAccess, Me); private bool MyLockout => Time.time < _kMyOutUntil; public bool IOwnIt => _kOwner == Me; public string LockWord { get { if (_kLocked) { if (!MyAccess) { return "LOCKED"; } return "LOCKED, YOU HAVE ACCESS"; } return "LOCK OFF"; } } private Track Current { get { if (_missing || _choice <= 0 || _choice > _tracks.Count) { return null; } return _tracks[_choice - 1]; } } private string SongWord { get { if (Current == null) { return "NONE"; } return Current.Word; } } private string MusicWord { get { if (!_launchOn) { return "OFF"; } return SongWord; } } private static float Now => Time.realtimeSinceStartup; private int ChoiceId { get { if (Current == null) { return 0; } return Current.Id; } } private Vector3 LightWord => new Vector3((float)(_lightMode + ((!_launchOn) ? 100 : 0)), (float)_lightColor, _lightClock); private float PodT => Time.time - _podAt; private bool PodHoldsDoor { get { if (_pod != null) { if (_podPhase != PodPhase.Docked) { if (_podPhase == PodPhase.Redock) { return PodT > 2.8f; } return false; } return true; } return false; } } private bool PodOnDoor { get { if (_pod != null && _podPhase != PodPhase.Away) { return _podPhase != PodPhase.Landed; } return false; } } private bool PodHolds { get { if (_pod != null) { if (!((Object)(object)_podStrapped != (Object)null) && !MeInPod()) { if (_podTunnel > 0.9f) { return MeInTunnel(); } return false; } return true; } return false; } } private bool PodFlying { get { if (_podPhase != PodPhase.Sealing && _podPhase != PodPhase.Away) { return _podPhase == PodPhase.Return; } return true; } } private bool PodCapsHeld => _podCapsHeld; private bool PodOnDock { get { if (_podPhase != PodPhase.Docked && _podPhase != PodPhase.Sealing) { return _podPhase == PodPhase.Redock; } return true; } } private bool Parked => Sim.Phase == ShipPhase.Parked; public FishTank Fish => _fishTank; public bool Gone { get { if (!((Object)(object)Root == (Object)null)) { return !((Component)Root).gameObject.activeInHierarchy; } return true; } } public bool Moving { get { if (!Sim.Moving) { return _flying; } return true; } } public bool Riding { get { if (Sim.Moving || _flying) { return Aboard(); } return false; } } public bool Mine { get; private set; } private bool Striking { get { if (!State("Countdown") && !State("Beam") && !State("Charge") && !State("Deploy")) { return State("Fall"); } return true; } } public ushort Uid { get; set; } public Transform RootT => Root; public int Type => 0; public float Born => _born; public bool Disposed { get; private set; } public bool Boss => ArkBus.Boss; private bool Pressed => NetRules.PressedRecently(_lastInput, Time.time); private bool FarPilot => Time.time - _farPilotAt < 0.35f; private bool Piloted { get { if (!_piloting) { return FarPilot; } return true; } } private Vector2 PilotTilt { get { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (!FarPilot) { return StickTilt(); } return _farTilt; } } private Vector2 PilotThumb { get { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (!FarPilot) { return _thumb; } return _farThumb; } } public bool Still { get { if (Parked && _pending == Go.None && _run == Run.None && !_flying) { return !Sim.Moving; } return false; } } public Footprint Print { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = HullT.position + HullT.rotation * _boxMid; return Footprint.At(val, ShipSpace.YawOf(HullT.rotation), _boxHalf.x, _boxHalf.z, val.y - _boxHalf.y, val.y + _boxHalf.y); } } public bool InRun => _run != Run.None; private void AirSetup() { //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) try { Transform root = World.Deep(Root, "Airlock"); if ((Object)(object)root == (Object)null) { MelonLogger.Msg("[StationShip] no airlock on this ship (a pack older than 1.1.0)"); return; } AirParts airParts = new AirParts(); airParts.OuterPivot = World.Deep(HullT, "AirlockOuterPivot"); airParts.InnerPivot = World.Deep(HullT, "AirlockInnerPivot"); airParts.Cover = World.Deep(root, "Cover_AIREJECT"); airParts.AlarmRoom = G("AirAlarmRoom"); airParts.AlarmTunnel = G("AirAlarmTunnel"); airParts.BeepRoom = G("AirBeepRoom"); airParts.BeepTunnel = G("AirBeepTunnel"); airParts.Rush = G("AirRush"); airParts.DoorIn = G("AirDoorIn"); airParts.DoorOut = G("AirDoorOut"); airParts.ThunkIn = G("AirThunkIn"); airParts.ThunkOut = G("AirThunkOut"); airParts.Burst = G("AirBurst"); airParts.Swirl = G("AirSwirl"); airParts.Beacons = (GameObject[])(object)new GameObject[3] { ((Component)World.Deep(root, "AirBeaconTunnel").Find("On")).gameObject, ((Component)World.Deep(root, "AirBeaconRoom0").Find("On")).gameObject, ((Component)World.Deep(root, "AirBeaconRoom1").Find("On")).gameObject }; AirParts airParts2 = airParts; airParts2.OuterHome = airParts2.OuterPivot.localPosition; airParts2.InnerHome = airParts2.InnerPivot.localPosition; airParts2.CoverHome = airParts2.Cover.localRotation; airParts2.Tunnel = new Canvas(World.Deep(root, "ModOverlay_AirTunnel"), 150, 48, blank: true); airParts2.Room = new Canvas(World.Deep(root, "ModOverlay_AirRoom"), 110, 45, blank: true); airParts2.Big = new Canvas(World.Deep(root, "ModOverlay_AirBig"), 198, 72, blank: true); (string, string)[] array = new(string, string)[4] { ("Btn_AIROPEN", "Send_AirOpen"), ("Btn_AIRCLOSE", "Send_AirClose"), ("Btn_AIREJECT", "Send_AirEject"), ("Btn_AIRROOM", "Send_AirRoom") }; for (int i = 0; i < array.Length; i++) { var (name, item) = array[i]; _handButtons.Add((World.Deep(root, name), item)); } _air = airParts2; MelonLogger.Msg("[StationShip] airlock ready: inner door shut, outer door shut"); GameObject G(string n) { return ((Component)World.Deep(root, n)).gameObject; } } catch (Exception ex) { _air = null; MelonLogger.Warning("[StationShip] airlock not found or incomplete, it stays shut: " + ex.Message); } } private void AirDispose() { if (_air != null) { _air.Tunnel?.Dispose(); _air.Room?.Dispose(); _air.Big?.Dispose(); } } private bool InBox(Vector3 l, Vector3 min, Vector3 max) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (l.x > min.x && l.x < max.x && l.y > min.y && l.y < max.y && l.z > min.z) { return l.z < max.z; } return false; } private bool InAirlock(Vector3 world) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) Vector3 l = HullT.InverseTransformPoint(world); if (!InBox(l, AirRoomMin, AirRoomMax)) { return InBox(l, AirDoorMin, AirDoorMax); } return true; } private void AirButtons() { string[] array = new string[4] { "AirOpen", "AirClose", "AirEject", "AirRoom" }; foreach (string text in array) { if (_a.GetBool(text)) { _a.ResetTrigger(text); if (_air != null) { AirPress(text); } } } } private void AirPress(string what) { MelonLogger.Msg($"[StationShip] AIRLOCK {what} pressed, phase {_airPhase}"); switch (what) { case "AirOpen": if (_airPhase == AirPhase.Idle) { AirGo(AirPhase.InnerOpen, "AIRLOCK: INNER DOOR OPENING"); } else if (_airPhase == AirPhase.Count) { AirGo(AirPhase.InnerOpen, "AIRLOCK: EJECT CANCELLED"); } else if (_airPhase != AirPhase.InnerOpen) { Say("AIRLOCK CYCLING - WAIT"); } break; case "AirClose": if (_airPhase == AirPhase.InnerOpen) { AirGo(AirPhase.Idle, "AIRLOCK: INNER DOOR CLOSING"); } break; case "AirRoom": if (_airPhase == AirPhase.Idle) { AirGo(AirPhase.InnerOpen, "AIRLOCK: INNER DOOR OPENING"); } else if (_airPhase == AirPhase.Count) { AirGo(AirPhase.InnerOpen, "AIRLOCK: EJECT CANCELLED FROM INSIDE"); } else if (_airPhase == AirPhase.InnerOpen) { AirGo(AirPhase.Idle, "AIRLOCK: INNER DOOR CLOSING"); } else { Say("AIRLOCK CYCLING - WAIT"); } break; case "AirEject": if (_airPhase == AirPhase.InnerOpen || _airIn > 0.01f) { Say("AIRLOCK: CLOSE THE INNER DOOR FIRST"); NotifyAll("Airlock: close the inner door first"); } else if (_run != Run.None) { Say("AIRLOCK: NOT DURING A TOWER LAUNCH"); } else if (PodOnDoor) { Say("AIRLOCK: ESCAPE POD DOCKED - NO EJECT"); NotifyAll("Airlock: the escape pod is docked on the outer door"); } else if (_airPhase == AirPhase.Idle) { AirGo(AirPhase.Count, "AIRLOCK: EJECT IN 3"); } break; } } private void AirGo(AirPhase p, string line) { AirEnter(p, Time.time); Say(line); AirShare(now: true); } private void AirEnter(AirPhase p, float at) { if (_airPhase == p) { if (Mathf.Abs(_airAt - at) > 0.25f) { _airAt = at; } return; } AirPhase airPhase = _airPhase; _airPhase = p; _airAt = at; _airVentFx = false; _airWarned = false; _airLastBeep = -1f; _airPushed.Clear(); _airRig = null; ArkBus.Line($"airlock {airPhase} -> {p}"); } private void AirRun() { if (Boss) { if (_airPhase == AirPhase.Count && AirT >= 3f) { AirGo(AirPhase.Vent, "AIRLOCK: VENTING"); } else if (_airPhase == AirPhase.Vent && AirT >= 3.4f) { AirGo(AirPhase.Closing, "AIRLOCK: OUTER DOOR CLOSING"); } else if (_airPhase == AirPhase.Closing && _airOut <= 0f && AirT >= 2.4f) { AirGo(AirPhase.Idle, "AIRLOCK READY"); } } } private void AirShare(bool now = false) { if (_air != null && ArkNet.InLobby && Boss && Uid != 0 && (now || !(Time.time < _airNextShare))) { _airNextShare = Time.time + ((_airPhase == AirPhase.Idle) ? 6f : 2f); float num = ArkBus.NetNow - AirT; ArkWire arkWire = new ArkWire(); arkWire.Kind = ArkKind.Event; arkWire.Uid = Uid; arkWire.Index = 7; arkWire.Flags = (uint)_airPhase; arkWire.Nums = new float[1] { num }; ArkNet.SendWire(arkWire, now); } } private void AirIn(ArkWire w) { if (_air != null && w.Nums != null && w.Nums.Length >= 1) { AirPhase p = (AirPhase)Mathf.Clamp((int)w.Flags, 0, 4); float num = ArkBus.Core.HostNow() - w.Nums[0]; AirEnter(p, Time.time - Mathf.Max(0f, num)); } } private void AirStep() { //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) if (_air == null) { return; } if (Boss) { AirButtons(); } AirRun(); AirShare(); float airT = AirT; bool flag = _airPhase == AirPhase.Count || _airPhase == AirPhase.Vent || _airPhase == AirPhase.Closing; if (_air.AlarmRoom.activeSelf != flag) { _air.AlarmRoom.SetActive(flag); _air.AlarmTunnel.SetActive(flag); } bool flag2 = flag && Time.time * 3f % 1f < 0.5f; GameObject[] beacons = _air.Beacons; foreach (GameObject val in beacons) { if (val.activeSelf != flag2) { val.SetActive(flag2); } } if (_airPhase == AirPhase.Count) { int num = Mathf.FloorToInt(airT); if (num != (int)_airLastBeep && (float)num < 3f) { _airLastBeep = num; Sound(_air.BeepRoom); Sound(_air.BeepTunnel); } if (!_airWarned && AirMeInside()) { _airWarned = true; World.Notify("AIRLOCK EJECT IN 3 SECONDS - press OPEN DOOR to stop it"); } } if (_airPhase == AirPhase.Vent && !_airVentFx) { _airVentFx = true; Sound(_air.Rush); Sound(_air.DoorOut); Sound(_air.Burst); Sound(_air.Swirl); if (AirMeInside()) { ImpactShake.Pulse(((Object)(object)Player.Head != (Object)null) ? Player.Head.position : Hull.position); } } AirScreens(airT); } private void AirDoors(float dt) { //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) if (_air != null) { float num = ((_airPhase == AirPhase.InnerOpen) ? 1f : 0f); float num2 = ((_airPhase == AirPhase.Vent || PodHoldsDoor) ? 1f : 0f); float airIn = _airIn; float airOut = _airOut; _airIn = Mathf.MoveTowards(_airIn, num, dt / 1.4f); _airOut = Mathf.MoveTowards(_airOut, num2, dt / ((num2 > _airOut && _airPhase == AirPhase.Vent) ? 0.55f : 2.4f)); bool flag = _airIn != airIn; bool flag2 = _airOut != airOut; if (flag && !_airInMoving) { Sound(_air.DoorIn); } if (!flag && _airInMoving) { Sound(_air.ThunkIn); } if (flag2 && !_airOutMoving && num2 < 0.5f) { Sound(_air.DoorOut); } if (!flag2 && _airOutMoving && _airOut <= 0f) { Sound(_air.ThunkOut); } _airInMoving = flag; _airOutMoving = flag2; float num3 = Mathf.SmoothStep(0f, 1f, _airIn); float num4 = Mathf.SmoothStep(0f, 1f, _airOut); _air.InnerPivot.localPosition = _air.InnerHome + Vector3.forward * (1.681f * num3); _air.OuterPivot.localPosition = _air.OuterHome + Vector3.forward * (2.147f * num4); } } private bool AirMeInside() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) RigManager rigManager = Player.RigManager; if ((Object)(object)rigManager == (Object)null || (Object)(object)rigManager.physicsRig == (Object)null) { return false; } if (!InAirlock(rigManager.physicsRig.rbFeet.position)) { if ((Object)(object)Player.Head != (Object)null) { return InAirlock(Player.Head.position); } return false; } return true; } private bool AirTakes(Vector3 world) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (_air != null && _airPhase == AirPhase.Vent && AirT >= 0.3f) { return InAirlock(world); } return false; } private Vector3 AirWind(Vector3 world) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = HullT.InverseTransformPoint(world); Vector3 val2 = ((val.x < -3.9f) ? new Vector3(-1f, 0.06f, -0.05f) : new Vector3(-1f, 0.12f, Mathf.Clamp((0.35f - val.z) * 0.9f, -1.2f, 1.2f))); return HullT.TransformDirection(((Vector3)(ref val2)).normalized); } private void AirPush(float dt) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: 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_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) if (_air == null || _airPhase != AirPhase.Vent || AirT < 0.3f) { return; } Vector3 val = HullT.TransformPoint((AirRoomMin + AirRoomMax) / 2f + new Vector3(-0.45f, 0f, 0f)); Vector3 val2 = (AirRoomMax - AirRoomMin) / 2f + new Vector3(0.45f, 0f, 0f); int num = Physics.OverlapBoxNonAlloc(val, val2, AirHits, HullT.rotation, -1, (QueryTriggerInteraction)1); RigManager rigManager = Player.RigManager; for (int i = 0; i < num; i++) { Rigidbody val3 = (((Object)(object)((Il2CppArrayBase<Collider>)(object)AirHits)[i] != (Object)null) ? ((Il2CppArrayBase<Collider>)(object)AirHits)[i].attachedRigidbody : null); if (!((Object)(object)val3 == (Object)null) && !val3.isKinematic && !((Component)val3).transform.IsChildOf(Root) && !World.InAShip(((Component)val3).transform) && !((Object)(object)((Component)val3).GetComponentInParent<RigManager>() != (Object)null) && InAirlock(val3.worldCenterOfMass)) { Vector3 val4 = Hull.GetPointVelocity(val3.worldCenterOfMass) + AirWind(val3.worldCenterOfMass) * 11f; val3.WakeUp(); val3.velocity = Vector3.MoveTowards(val3.velocity, val4, 48f * dt); if (_airPushed.Add(((Il2CppObjectBase)val3).Pointer)) { MelonLogger.Msg($"[StationShip] AIRLOCK: blowing out {((Object)val3).name}, {val3.mass:F0} kg"); } } } if ((Object)(object)rigManager == (Object)null || (Object)(object)rigManager.physicsRig == (Object)null || !AirMeInside()) { return; } if (_airRig == null) { _airRig = new List<Rigidbody>((IEnumerable<Rigidbody>)((Component)rigManager.physicsRig).GetComponentsInChildren<Rigidbody>(false)).ToArray(); if ((Object)(object)_strapped != (Object)null) { Unstrap(); } MelonLogger.Msg($"[StationShip] AIRLOCK: you are being blown out of the ship at {Sim.Height:F0} m"); } _airThrown = Time.time; Vector3 position = rigManager.physicsRig.rbFeet.position; Vector3 val5 = Hull.GetPointVelocity(position) + AirWind(position) * 11f; Rigidbody[] airRig = _airRig; foreach (Rigidbody val6 in airRig) { if ((Object)(object)val6 != (Object)null && !val6.isKinematic) { val6.velocity = Vector3.MoveTowards(val6.velocity, val5, 48f * dt); } } } private void AirScreens(float t) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) if (Time.time < _airNextDraw) { return; } _airNextDraw = Time.time + 0.1f; float num; if (!((Object)(object)Player.Head != (Object)null)) { num = 0f; } else { Vector3 val = Player.Head.position - Hull.position; num = ((Vector3)(ref val)).sqrMagnitude; } if (!(num > 2025f)) { int num2 = Mathf.Max(1, Mathf.CeilToInt(3f - t)); string text; string text2; string text3; string text4; Color32 val2; switch (_airPhase) { case AirPhase.InnerOpen: text = "DOOR OPEN"; text2 = "CLOSE TO EJECT"; text3 = "DOOR OPEN"; text4 = "DOOR OPEN"; val2 = AirAmber; break; case AirPhase.Count: text = "EJECT IN " + num2; text2 = "OPEN STOPS IT"; text3 = "EJECT IN " + num2; text4 = "PRESS TO STOP"; val2 = AirRed; break; case AirPhase.Vent: text = "VENTING"; text2 = "STAND CLEAR"; text3 = "VENTING"; text4 = "VENTING"; val2 = AirRed; break; case AirPhase.Closing: text = "CYCLING"; text2 = "PLEASE WAIT"; text3 = "CYCLING"; text4 = "CYCLING"; val2 = AirAmber; break; default: text = (PodOnDoor ? "POD DOCKED" : "READY"); text2 = ((_airIn > 0f) ? "DOOR CLOSING" : (PodOnDoor ? "NO EJECT" : "LIFT COVER")); text3 = (PodOnDoor ? "POD DOCKED" : "AIRLOCK"); text4 = "DOOR SHUT"; val2 = AirGreen; break; } string text5 = text + text2 + text3 + text4; if (!(text5 == _airDrawn)) { _airDrawn = text5; Draw(_air.Tunnel, text, 2, val2, text2, AirWhite); Draw(_air.Room, text4, 1, val2, (_airPhase == AirPhase.Count) ? ("EJECT IN " + num2) : ((_airPhase == AirPhase.Idle) ? "OPEN DOOR" : ""), AirWhite); Draw(_air.Big, text3, 3, val2, "", val2); } } } private static void Draw(Canvas cv, string a, int scale, Color32 ca, string b, Color32 cb) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) cv.Clear(); int num = a.Length * 6 * scale; int num2 = ((b.Length > 0) ? 9 : 0); int num3 = cv.H / 2 + (7 * scale + num2) / 2; cv.Text(a, Mathf.Max(1, (cv.W - num) / 2), num3, ca, scale); if (b.Length > 0) { cv.Text(b, Mathf.Max(1, (cv.W - b.Length * 6) / 2), num3 - 7 * scale - 4, cb); } cv.Show(); } private void DimSetup() { //IL_0105: Unknown result type (might be due to invalid IL or missing references) HashSet<IntPtr> seen = new HashSet<IntPtr>(); foreach (MeshRenderer componentsInChild in ((Component)HullT.Find("Rooms")).GetComponentsInChildren<MeshRenderer>(true)) { Take((Renderer)(object)componentsInChild); } foreach (MeshRenderer componentsInChild2 in ((Component)HullT).GetComponentsInChildren<MeshRenderer>(true)) { if (!((Object)componentsInChild2).name.Contains("Lining") && !((Object)componentsInChild2).name.Contains("Door")) { continue; } foreach (Material item in (Il2CppArrayBase<Material>)(object)((Renderer)componentsInChild2).sharedMaterials) { if ((Object)(object)item != (Object)null && ((Object)item).name.StartsWith("st_liner") && item.HasProperty(BaseColor) && seen.Add(((Il2CppObjectBase)item).Pointer)) { _dimMats.Add((item, item.GetColor(BaseColor))); } } } MeshRenderer component = ((Component)World.Deep(Root, "GalleryLight")).GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null) { Take((Renderer)(object)component); } _dimWant = (_dimNow = Mathf.Clamp01(StationMod.PrefCabinLight.Value / 100f)); _nightWant = (_nightNow = (StationMod.PrefCabinNight.Value ? 1f : 0f)); DimApply(); MelonLogger.Msg($"[StationShip] cabin lights: {_dimMats.Count} materials under the dimmer, {_dimWant * 100f:F0}%{((_nightWant > 0f) ? " night" : "")}"); void Take(Renderer r) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) foreach (Material item2 in (Il2CppArrayBase<Material>)(object)r.sharedMaterials) { if (!((Object)(object)item2 == (Object)null) && ((Object)item2).name.StartsWith("st_") && item2.HasProperty(BaseColor) && seen.Add(((Il2CppObjectBase)item2).Pointer)) { _dimMats.Add((item2, item2.GetColor(BaseColor))); } } } } private void DimApply() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) Color val = Color.Lerp(Color.white * _dimNow, NightTint, _nightNow); foreach (var (val2, val3) in _dimMats) { if ((Object)(object)val2 != (Object)null) { val2.SetColor(BaseColor, new Color(val3.r * val.r, val3.g * val.g, val3.b * val.b, val3.a)); } } } private void DimReset() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) foreach (var (val, val2) in _dimMats) { if ((Object)(object)val != (Object)null) { val.SetColor(BaseColor, val2); } } } private void DimStep() { if (_dimNow != _dimWant || _nightNow != _nightWant) { _dimNow = Mathf.MoveTowards(_dimNow, _dimWant, 0.7f * Time.deltaTime); _nightNow = Mathf.MoveTowards(_nightNow, _nightWant, 0.7f * Time.deltaTime); DimApply(); } } public void DimSet(float level, bool night, bool share) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) _dimWant = Mathf.Clamp01(level); _nightWant = (night ? 1f : 0f); StationMod.SetCabin(_dimWant * 100f, night); Say(night ? "LIGHTS: NIGHT" : $"LIGHTS: {_dimWant * 100f:F0}%"); if (share && ArkNet.InLobby) { if (Boss) { ArkNet.SendRun(Root, 95, _dimWant, Vector3.zero, night ? 1f : 0f, 0f); } else { Ask("Dim", _dimWant, night ? 1f : 0f); } } } private void DimButtons() { On("DimDown", delegate { DimSet(Mathf.Max(0.1f, Mathf.Round(_dimWant * 10f) / 10f - 0.1f), night: false, share: true); }); On("DimUp", delegate { DimSet(Mathf.Min(1f, Mathf.Round(_dimWant * 10f) / 10f + 0.1f), night: false, share: true); }); On("Dim100", delegate { DimSet(1f, night: false, share: true); }); On("Dim60", delegate { DimSet(0.6f, night: false, share: true); }); On("Dim30", delegate { DimSet(0.3f, night: false, share: true); }); On("DimNight", delegate { DimSet(0.25f, night: true, share: true); }); void On(string t, Action a) { if (_a.GetBool(t)) { _a.ResetTrigger(t); a(); } } } private void EqBars(bool live) { //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) PixelPage page = _jukeScreen.Page; AudioSource val = null; if (live && _playing != null && !_specBroken) { foreach (AudioSource item in _spkMusic) { if ((Object)(object)item != (Object)null && ((Behaviour)item).isActiveAndEnabled && item.isPlaying) { val = item; break; } } } float[] array = new float[5]; if ((Object)(object)val != (Object)null) { try { if (_spec == null) { _spec = new Il2CppStructArray<float>(512L); } if (_binHz < 0f) { int num = 48000; try { num = AudioSettings.outputSampleRate; } catch { } _binHz = (float)num / 2f / 512f; } val.GetSpectrumData(_spec, 0, (FFTWindow)5); for (int i = 0; i < 5; i++) { int num2 = Mathf.Max(1, Mathf.FloorToInt(EqEdges[i] / _binHz)); int num3 = Mathf.Min(511, Mathf.CeilToInt(EqEdges[i + 1] / _binHz)); float num4 = 0f; for (int j = num2; j <= num3; j++) { num4 += ((Il2CppArrayBase<float>)(object)_spec)[j]; } float num5 = 20f * Mathf.Log10(num4 + 1E-06f) + ShipEq.Db(i); array[i] = Mathf.Clamp01((num5 + 54f) / 50f); } } catch (Exception ex) { _specBroken = true; MelonLogger.Warning("[StationShip] jukebox EQ bars: can't read the music's spectrum here (" + ex.Message + "): the bars stay still"); } } Color32 val3 = default(Color32); Color32 val4 = default(Color32); for (int k = 0; k < 5; k++) { _eqLvl[k] = ((array[k] > _eqLvl[k]) ? Mathf.Lerp(_eqLvl[k], array[k], 0.7f) : (_eqLvl[k] * 0.82f)); int num6 = Mathf.RoundToInt(_eqLvl[k] * 26f); Color val2 = SpeakerColor(k * 3); if (((Color)(ref val2)).maxColorComponent < 0.15f) { ((Color)(ref val2))..ctor(0.25f, 1f, 0.4f); } val2 /= Mathf.Max(1f, ((Color)(ref val2)).maxColorComponent); ((Color32)(ref val3))..ctor((byte)(val2.r * 255f), (byte)(val2.g * 255f), (byte)(val2.b * 255f), byte.MaxValue); ((Color32)(ref val4))..ctor((byte)(val2.r * 60f), (byte)(val2.g * 60f), (byte)(val2.b * 60f), byte.MaxValue); int x = 9 + k * 38; for (int l = 0; l < 26; l += 3) { page.Fill(x, 2 + l, 30, 2, (l < num6) ? val3 : val4); } } } private void NextView() { _view = (_view + 1) % ViewWords.Length; for (int i = 0; i < ViewWords.Length; i++) { _viewWall[i].SetActive(i == _view); _viewStrip[i].SetActive(i == _view); } _crossWall.SetActive(_view == 0); _crossStrip.SetActive(_view == 0); SayHere("CAMERA: " + ViewWords[_view]); } private void PoseCamera() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)_camTop).transform; if (!_camSeen) { _camSeen = true; _camRestPos = transform.localPosition; _camRestRot = transform.localRotation; } if (_view == 0) { transform.localPosition = _camRestPos; transform.localRotation = _camRestRot; _camTop.nearClipPlane = 4f; _camTop.farClipPlane = 1000f; return; } _camTop.nearClipPlane = 0.6f; _camTop.farClipPlane = 1800f; Vector3 val; Quaternion val2; if (_view == 1) { val = HullT.TransformPoint(0f, -7f, 2f); val2 = Quaternion.LookRotation(Vector3.down, HullT.forward); } else if (_view == 2) { val = HullT.TransformPoint(0f, 1f, 23f); val2 = Quaternion.LookRotation(HullT.forward, HullT.up); } else if (_view == 3) { val = HullT.TransformPoint(0f, 1f, -24f); val2 = Quaternion.LookRotation(-HullT.forward, HullT.up); } else { val = HullT.TransformPoint(0f, 20f, -60f); val2 = Quaternion.LookRotation(HullT.position - val, HullT.up); } transform.SetPositionAndRotation(val, val2); } private Vector2 StickTilt() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return ManualFlight.Tilt(_stickRest, _stick.localRotation); } private void KeepStick() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_00f8: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) bool flag = _piloting && _run == Run.None; if (flag == _stickRb.isKinematic) { _stickRb.interpolation = (RigidbodyInterpolation)0; _stickRb.isKinematic = !flag; if (flag) { _stickRb.WakeUp(); } } if (flag) { if (_stickRb.interpolation != Hull.interpolation) { _stickRb.interpolation = Hull.interpolation; } } else if (_stick.localRotation != _stickRest || _stick.localPosition != _stickHome) { _stick.localRotation = Quaternion.RotateTowards(_stick.localRotation, _stickRest, 400f * Time.deltaTime); _stick.localPosition = _stickHome; if (_stick.localRotation == _stickRest) { _a.SetFloat("AimRV", 0f); _a.SetFloat("AimFV", 0f); } } if (_knobRb.interpolation != Hull.interpolation) { _knobRb.interpolation = Hull.interpolation; } } private void SoundWatch() { for (int num = 0; num < _clicks.Count; num++) { var (val, num2) = _clicks[num]; int num3; float num4; if ((Object)(object)val != (Object)null && ((Behaviour)val).isActiveAndEnabled) { num3 = (val.isPlaying ? 1 : 0); if (num3 != 0) { num4 = val.time; goto IL_004a; } } else { num3 = 0; } num4 = -1f; goto IL_004a; IL_004a: float num5 = num4; if (num3 != 0 && (num2 < 0f || num5 + 0.001f < num2) && Time.time >= _nextClickLog) { _nextClickLog = Time.time + 0.1f; MelonLogger.Msg($"[StationShip] console sound {((Object)val).name} ({(_frozen ? "ship moving" : "ship still")}), last touch: {_lastTouch}"); } _clicks[num] = (val, num5); } } private static float Dist(Hand h, Vector3 at) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)h != (Object)null)) { return float.MaxValue; } Vector3 val = ((Component)h).transform.position - at; return ((Vector3)(ref val)).magnitude; } private static bool OfHand(Hand h, Collider c) { if ((Object)(object)h != (Object)null) { return ((Component)c).transform.IsChildOf(((Component)h).transform); } return false; } private string WhoTouched(Collider c) { string text = (((Object)(object)c.attachedRigidbody != (Object)null) ? ((Object)c.attachedRigidbody).name : ((Object)c).name); RigManager rigManager = Player.RigManager; if (((Component)c).transform.IsChildOf(HullT)) { if (!((Object)(object)((Component)c).transform == (Object)(object)HullT)) { return "ship part " + text; } return "ShipHull"; } if ((Object)(object)rigManager != (Object)null && ((Component)c).transform.IsChildOf(((Component)rigManager).transform)) { return "player body " + text; } return text; } public bool Touched(ButtonGate.Entry e, Collider who) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) Vector3 position = e.Part.position; float num = Dist(Player.LeftHand, position); float num2 = Dist(Player.RightHand, position); float num3 = Mathf.Min(num, num2); string value = ((num <= num2) ? "LeftHand" : "RightHand"); if (ArkNet.InLobby) { foreach (Vector3 item in FusionPlayers.Hands()) { Vector3 val = item - position; if (((Vector3)(ref val)).magnitude < num3) { _lastTouch = e.Name + " by another player, ignored here"; return false; } } } bool flag; if (!e.Knob && Fingertip.Tips(out var left, out var right)) { float num4 = Fingertip.ToCap(e, left); float num5 = Fingertip.ToCap(e, right); Vector3 p = ((num4 <= num5) ? left : right); num3 = Mathf.Min(num4, num5); value = ((num4 <= num5) ? "LeftHand" : "RightHand") + " index finger"; flag = !e.TipIn && !_frozen && num3 < 0.03f && !Fingertip.Covered(e) && ButtonGate.NearestTo(e, p); } else { flag = (e.Knob ? TouchRule.Knob(InHand(Player.LeftHand, e.Part) || InHand(Player.RightHand, e.Part), _frozen, num3) : TouchRule.Button(num3, (Object)(object)who != (Object)null && ((Component)who).transform.IsChildOf(e.Part), (Object)(object)who != (Object)null && (OfHand(Player.LeftHand, who) || OfHand(Player.RightHand, who)), _frozen)); } string value2 = (((Object)(object)who != (Object)null) ? WhoTouched(who) : "nothing"); _lastTouch = $"{e.Name} by {value2}, {(flag ? "let through" : "ignored")}"; if (Time.time >= e.NextLog) { e.NextLog = Time.time + (flag ? 0.2f : 2f); string value3 = ((e.Quiet > 0) ? $", and {e.Quiet} more like it" : ""); MelonLogger.Msg(flag ? $"[StationShip] {e.Name} pressed by {value} ({num3 * 100f:F0} cm)" : $"[StationShip] ignored: {e.Name} touched by {value2} ({(_frozen ? "ship moving, " : "")}nearest hand {num3:F2} m{value3})"); e.Quiet = 0; } else if (!flag) { e.Quiet++; } return flag; } private void FlyBegin() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (!_flying) { _flying = true; _method = StationMod.Method; Freeze(on: true); _knobHome = _knob.localRotation; _knobRb.isKinematic = false; Hull.constraints = (RigidbodyConstraints)0; Hull.isKinematic = true; Hull.interpolation = RigDrawn(); _worstAbove = (_worstBelow = 0f); _steps = (_aboardSteps = 0); _lostSaid = false; _flightStart = Time.time; _worstFrame = 0f; _aboardAtStart = Aboard(); Mission("MANUAL FLIGHT"); MelonLogger.Msg("[StationShip] manual flight starts, " + (_aboardAtStart ? "aboard" : "not aboard")); } } private void FlyEnd() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (_flying) { _flying = false; _flyVel = Vector3.zero; _flyYawV = 0f; Hull.interpolation = (RigidbodyInterpolation)0; Sim.ManualStep(Hull.position, Vector3.zero); Freeze(on: false); Report("MANUAL FLIGHT STOPPED"); } } private void TakeOver() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (_landAfterFly || Parked || Time.time < _noTakeOver || !Piloted || !_a.GetBool("Fly")) { return; } ShipPhase phase = Sim.Phase; if (_pending != Go.Land && phase != ShipPhase.Descend && phase != ShipPhase.Cross && phase != ShipPhase.Brake && phase != ShipPhase.Side) { return; } Vector2 val = PilotTilt; if (((Vector2)(ref val)).sqrMagnitude < 0.01f) { val = PilotThumb; if (((Vector2)(ref val)).sqrMagnitude < 0.09f) { return; } } _pending = Go.None; _flyVel = Sim.Vel; if (Sim.Moving) { Sim.HoldAt(Sim.Pos, Sim.Home); } _sndLand.SetActive(false); Show(ArkEvent.Sound, "land-off"); _doorFree.SetActive(true); BeltsOff(); FlyBegin(); Say("FLY: YOU HAVE CONTROL"); World.Notify("Landing cancelled: you have control"); } private void PinKnob() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (InHand(Player.LeftHand, _knob) || InHand(Player.RightHand, _knob)) { _knobHome = _knob.localRotation; } else { _knob.localRotation = _knobHome; } } private void FlyStep(float dt) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; float num = 0f; int rateNow = RateNow; Vector2 pilotTilt = PilotTilt; Vector2 pilotThumb = PilotThumb; if (_a.GetBool("Fly") && !_landAfterFly && Piloted) { val = ManualFlight.Want(HullT.forward, pilotTilt, pilotThumb, TopSpeed, _lastAlt, rateNow); num = ManualFlight.WantYaw(pilotThumb, rateNow); } _flyWant = val; ManualFlight.Step(ref _flyVel, ref _flyYawV, val, num, rateNow, dt); bool flag = ((Vector3)(ref _flyVel)).sqrMagnitude > 0.0009f || Mathf.Abs(_flyYawV) > 0.05f || ((Vector3)(ref val)).sqrMagnitude > 0.01f || num != 0f; if (flag) { _quietFor = 0f; FlyBegin(); } else if (_flying) { _quietFor += dt; if (_quietFor > 1f) { FlyEnd(); } } if (_landAfterFly && !flag) { _landAfterFly = false; FlyEnd(); PressLand(); } else if (_flying) { PinKnob(); Vector3 val2 = Sim.Pos + _flyVel * dt; Quaternion val3 = Quaternion.AngleAxis(_flyYawV * dt, Vector3.up) * Hull.rotation; Hull.MovePosition(val2); Hull.MoveRotation(val3); Aim(val2, val3); Sim.ManualStep(val2, _flyVel); Sample(); } } private static string Sg(float v) { float num = Mathf.Round(Mathf.Abs(v) * 100f) / 100f; return ((v < 0f && num > 0f) ? "-" : "+") + num.ToString("0.00"); } private string StateWord() { if (_run == Run.None) { if (!_flying) { if (_pending != Go.Land) { if (_pending != Go.Launch) { if (!Parked) { if (Sim.Phase != ShipPhase.Hold) { if (Sim.Phase != ShipPhase.Climb) { return "AUTO LAND"; } return "CLIMBING"; } return "HOLDING"; } return "LAUNCH FIRST"; } return "COUNTDOWN"; } return "CLOSING"; } return "MANUAL"; } return "TOWER"; } private void FlyWatch() { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0205: 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_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) bool flag = _a.GetBool("Fly"); int rateNow = RateNow; if (flag != _flySaid) { _flySaid = flag; SayHere(flag ? "FLY MODE" : "AIM MODE"); SpeakHere(flag ? "ship_fly_mode" : "ship_aim_mode"); } if (rateNow != _rateSaid) { _rateSaid = rateNow; SayHere($"SPEED {ManualFlight.RateNames[rateNow]} {TopSpeed:F0} M/S"); } if (!flag) { _dbg1 = (_dbg2 = ""); return; } Vector2 val = StickTilt(); _dbg1 = $"IN X{Sg(val.x)} Y{Sg(val.y)} TH {Sg(_thumb.x)} {Sg(_thumb.y)}"; _dbg2 = $"{((Vector3)(ref _flyVel)).magnitude:F1}/{TopSpeed:F0} M/S {_holdWord} {StateWord()}"; bool flag2 = _piloting || _flying || val != Vector2.zero; if (!(Time.time < _nextFlyLog)) { _nextFlyLog = Time.time + (flag2 ? 1f : 5f); MelonLogger.Msg($"[StationShip] FLY: {StateWord()}, held {_holdWord}, grip {_grip:0.00}, stick {Sg(val.x)} {Sg(val.y)}, thumb {Sg(_thumb.x)} {Sg(_thumb.y)}, wants {((Vector3)(ref _flyWant)).magnitude:F1} m/s, going {((Vector3)(ref _flyVel)).magnitude:F1} m/s, turning {_flyYawV:F1} deg/s, knob {ManualFlight.RateNames[rateNow]} {TopSpeed:F0} m/s, console power {_lit.activeInHierarchy}, height {_lastAlt:F0} m"); } } private void AimSpeed() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) float num = (_a.GetBool("Fly") ? 0f : (StationMod.PrefAimSpeed.Value / 100f)); _a.SetFloat("AimRS", _a.GetFloat("AimRV") * num); _a.SetFloat("AimFS", _a.GetFloat("AimFV") * num); if (Parked && _piloting && _a.GetBool("Fly") && Time.time >= _nextParkedHint) { Vector2 val = StickTilt(); if (((Vector2)(ref val)).sqrMagnitude > 0.1f || ((Vector2)(ref _thumb)).sqrMagnitude > 0.1f) { _nextParkedHint = Time.time + 6f; SayHere("FLY: LAUNCH FIRST"); World.Notify("FLY works in the air. Launch first"); } } } private void CameraBeat() { bool activeInHierarchy = _lit.activeInHierarchy; bool flag = false; bool flag2 = false; if (activeInHierarchy) { PoseCamera(); } if (activeInHierarchy) { float unscaledTime = Time.unscaledTime; if (unscaledTime >= _nextTop) { _nextTop = Mathf.Max(_nextTop + 1f / 30f, unscaledTime); flag = true; } else if (unscaledTime >= _nextPip) { _nextPip = Mathf.Max(_nextPip + 1f / 15f, unscaledTime); flag2 = true; } } if (((Behaviour)_camTop).enabled != flag) { ((Behaviour)_camTop).enabled = flag; } int integer = _a.GetInteger("Pip"); if (_podCamLive) { flag2 = false; } bool flag3 = flag2 && integer != 1; bool flag4 = flag2 && integer == 1; if (((Behaviour)_camTgt).enabled != flag3) { ((Behaviour)_camTgt).enabled = flag3; } if (((Behaviour)_camChase).enabled != flag4) { ((Behaviour)_camChase).enabled = flag4; } } private void KeySetup() { try { for (int i = 0; i < 3; i++) { Transform root = World.Deep(Root, "Keypad" + i); if ((Object)(object)root == (Object)null) { continue; } Pad pad = new Pad { N = i, Root = root }; Transform val = World.Deep(Root, "ModOverlay_Kp" + i); if ((Object)(object)val != (Object)null) { pad.Screen = new Canvas(val, (i == 0) ? 236 : 192, 100, blank: true); } Transform val2 = World.Deep(Root, "KpRgb" + i); if ((Object)(object)val2 != (Object)null) { List<(int, Renderer)> list = new List<(int, Renderer)>(); foreach (MeshRenderer componentsInChild in ((Component)val2).GetComponentsInChildren<MeshRenderer>(true)) { if (((Object)componentsInChild).name.StartsWith("Rgb") && int.TryParse(((Object)componentsInChild).name.Substring(3), out var result)) { list.Add((result, (Renderer)(object)componentsInChild)); } } list.Sort(((int i, Renderer r) a, (int i, Renderer r) b) => a.i.CompareTo(b.i)); foreach (var item2 in list) { Renderer item = item2.Item2; pad.Rgb.Add(Own(item)); } } if (i == 0) { Transform val3 = World.Deep(Root, "KpRgbPost"); if ((Object)(object)val3 != (Object)null) { foreach (MeshRenderer componentsInChild2 in ((Component)val3).GetComponentsInChildren<MeshRenderer>(true)) { pad.Rgb.Add(Own((Renderer)(object)componentsInChild2)); } } } foreach (MeshRenderer componentsInChild3 in ((Component)root).GetComponentsInChildren<MeshRenderer>(true)) { if (((Object)componentsInChild3).name == "KeyFace") { Transform parent = ((Component)componentsInChild3).transform.parent.parent; string text = ((((Object)parent).name.Length > 7) ? ((Object)parent).name.Substring(7) : "?"); Material value = Own((Renderer)(object)componentsInChild3); pad.KeyMat[text] = value; pad.Caps.Add((((Component)componentsInChild3).transform.parent, text)); } else if (((Object)componentsInChild3).name == "KpBar") { pad.Bar = Own((Renderer)(object)componentsInChild3); } else if (((Object)componentsInChild3).name == "KpSlot0") { pad.Slot0 = Own((Renderer)(object)componentsInChild3); } else if (((Object)componentsInChild3).name == "KpSlot1") { pad.Slot1 = Own((Renderer)(object)componentsInChild3); } else if (((Object)componentsInChild3).name == "KpMain") { pad.Main = Own((Renderer)(object)componentsInChild3); } } if (i == 0 && (Object)(object)_outsidePanelT != (Object)null) { foreach (MeshRenderer componentsInChild4 in ((Component)_outsidePanelT).GetComponentsInChildren<MeshRenderer>(true)) { if (((Object)componentsInChild4).name == "BigFace" && !((Object)((Component)componentsInChild4).transform.parent.parent).name.Contains("ABORT")) { pad.Faces.Add(Own((Renderer)(object)componentsInChild4)); } } } pad.Ok = G("SndKpOk"); pad.Bad = G("SndKpBad"); pad.Alarm = G("SndKpAlarm"); pad.Beep = G("SndKpBeep"); _pads.Add(pad); GameObject G(string s) { Transform val4 = World.Deep(root, s); if (!((Object)(object)val4 != (Object)null)) { return null; } return ((Component)val4).gameObject; } } _lock.Owner = (ArkNet.InLobby ? (-1) : Me); if (_lock.Owner == Me) { _lock.Settings(StationMod.PrefShipCode.Value, StationMod.PrefLockOnSpawn.Value, StationMod.PrefOwnerNeedsCode.Value, StationMod.Trap); } KeyMirror(); foreach (Pad pad2 in _pads) { ShockSetup(pad2); } MelonLogger.Msg($"[StationShip] keypad lock: {_pads.Count} keypads, {(_lock.Locked ? "locked" : "lock off")} at spawn, owner {((_lock.Owner >= 0) ? ("player " + _lock.Owner) : "not known yet")}"); } catch (Exception ex) { MelonLogger.Warning("[StationShip] keypads not found or incomplete, the lock stays as it is: " + ex.Message); } Material Own(Renderer r) { _kpRestore.Add((r, r.sharedMaterial)); return r.material; } } private void KeyDispose() { foreach (Pad pad in _pads) { pad.Screen?.Dispose(); } foreach (var (val, val2) in _kpRestore) { try { if ((Object)(object)val != (Object)null) { Material sharedMaterial = val.sharedMaterial; val.sharedMaterial = val2; if ((Object)(object)sharedMaterial != (Object)null && (Object)(object)sharedMaterial != (Object)(object)val2) { Object.Destroy((Object)(object)sharedMaterial); } } } catch { } } _kpRestore.Clear(); _pads.Clear(); } private void KeyMirror() { _kLocked = _lock.Locked; _kNeeds = _lock.OwnerNeedsCode || _lock.Sealed; _kReady = _lock.Ready; _kOwner = _lock.Owner; _kAccess.Clear(); foreach (byte item in _lock.Access) { _kAccess.Add(item); } } public bool MayLocal(string name, bool outside, bool tower = false) { if (!KeyLock.LockedButton(name, outside) || MyAccess) { return true; } KeyDeniedHere(name); return false; } public bool MayPress(ButtonGate.Entry e) { return MayLocal(e.Name, e.Outside); } public bool MaySend(string name) { if (!KeyLock.LockedSend(name) || MyAccess) { return true; } KeyDeniedHere(name); return false; } public bool HostMay(int index, string name, byte who) { bool flag; if (index < 0) { flag = index switch { -1 => KeyLock.LockedSend(name), -2 => KeyLock.LockedAsk(name), _ => KeyLock.LockedButton(name, outside: false), }; } else { if (index >= _entries.Count || (Object)(object)_entries[index] == (Object)null) { return true; } Transform transform = ((Component)_entries[index]).transform; string name2 = ((Object)transform.parent).name; if (name2.StartsWith("Btn_KP")) { return true; } flag = KeyLock.LockedButton(name2, (Object)(object)_outsidePanelT != (Object)null && transform.IsChildOf(_outsidePanelT)); name = name2; } if (!flag || _lock.Has(who)) { return true; } KeyDenyTo(who, name); return false; } private void KeyDenyTo(byte who, string what) { ArkBus.Line($"KEYPAD: player {who} may not use {what}: no access"); float value; if (who == Me) { KeyDeniedHere(what); } else if (!_kDenyTo.TryGetValue(who, out value) || !(Time.time < value)) { _kDenyTo[who] = Time.time + 0.8f; ArkNet.SendTo(who, new ArkWire { Kind = ArkKind.KeyAnswer, Uid = Uid, Who = who, Index = -1, Flags = 5u, Nums = new float[2] }); } } private void KeyDeniedHere(string what) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (!(Time.time < _kNextDeny)) { _kNextDeny = Time.time + 0.8f; Pad pad = NearestPad(); if (pad != null) { PadMsg(pad, "LOCKED", MyLockout ? $"LOCKED OUT {Mathf.CeilToInt(_kMyOutUntil - Time.time)} S" : "ENTER CODE ON A KEYPAD", KRed, 2.5f); pad.RedUntil = Time.time + 1.2f; Sound(pad.Bad); } World.Notify("Ship locked: enter the code on a keypad"); MelonLogger.Msg("[StationShip] KEYPAD: " + what + " needs access"); } } public void NoteOutsidePress() { _outsidePressAt = Time.time; } private Pad OutsidePad() { return _pads.Find((Pad x) => x.N == 0); } public bool MayNow(ButtonGate.Entry e) { if (e.Name == "Btn_OPEN/CLOSE" && !_doorFree.activeSelf) { string small = ((_run != Run.None) ? "TOWER LAUNCH RUNNING" : ((_pending == Go.Launch) ? "LAUNCH COUNTDOWN" : ((_pending == Go.Land) ? "SHIP IS LANDING" : ((!Parked) ? "WHILE FLYING" : "DOORS ARE BUSY")))); RefuseHere(e, Door("Open") ? "CAN'T CLOSE" : "CAN'T OPEN", small); return false; } r