diff --git a/AssetBundles/conversation.manifest b/AssetBundles/conversation.manifest index 97537df4..a496a95a 100644 --- a/AssetBundles/conversation.manifest +++ b/AssetBundles/conversation.manifest @@ -6,19 +6,19 @@ Hashes: Hash: 55d90dfc169d4fd552679840c1474222 TypeTreeHash: serializedVersion: 2 - Hash: ada4a25185647e82d8755c81f5cf6401 + Hash: 6ce89620af51ba381c9e4f226a2ebb1b HashAppended: 0 ClassTypes: - Class: 1 Script: {instanceID: 0} -- Class: 114 - Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} -- Class: 114 - Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} - Class: 114 Script: {fileID: 1741964061, guid: f70555f144d8491a825f0804e09c671c, type: 3} +- Class: 114 + Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} - Class: 114 Script: {fileID: -900027084, guid: f70555f144d8491a825f0804e09c671c, type: 3} +- Class: 114 + Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} - Class: 115 Script: {instanceID: 0} - Class: 222 diff --git a/AssetBundles/debug.manifest b/AssetBundles/debug.manifest index c5b57b23..906fcb0f 100644 --- a/AssetBundles/debug.manifest +++ b/AssetBundles/debug.manifest @@ -6,7 +6,7 @@ Hashes: Hash: 5677b7876f2afae05c0920067ef29e8a TypeTreeHash: serializedVersion: 2 - Hash: db9699da20a38563d48dd92ea5fae0ee + Hash: 4d6a73cb377370ba69c96eb5da1b5028 HashAppended: 0 ClassTypes: - Class: 1 @@ -17,10 +17,10 @@ ClassTypes: Script: {instanceID: 0} - Class: 48 Script: {instanceID: 0} -- Class: 114 - Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} - Class: 114 Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} +- Class: 114 + Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} - Class: 115 Script: {instanceID: 0} - Class: 128 diff --git a/AssetBundles/instruments b/AssetBundles/instruments index ecd3ae37..0a4958b0 100644 Binary files a/AssetBundles/instruments and b/AssetBundles/instruments differ diff --git a/AssetBundles/instruments.manifest b/AssetBundles/instruments.manifest index c93e30ec..c13bb169 100644 --- a/AssetBundles/instruments.manifest +++ b/AssetBundles/instruments.manifest @@ -1,14 +1,16 @@ ManifestFileVersion: 0 -CRC: 1507627652 +CRC: 2593345828 Hashes: AssetFileHash: serializedVersion: 2 - Hash: 956e49974e4fb0e1a12a59be8c945f24 + Hash: d97fbc9cde41b6514223a2f68ba96af8 TypeTreeHash: serializedVersion: 2 - Hash: 0a4381b8d24d7546af2f9b5d2b1de238 + Hash: ff0e1233df027a80b5add90668c49830 HashAppended: 0 ClassTypes: +- Class: 43 + Script: {instanceID: 0} - Class: 74 Script: {instanceID: 0} - Class: 91 @@ -24,6 +26,7 @@ Assets: - Assets/Riebeck/Riebeck_Playing.anim - Assets/Chert/Chert_Chatter_Panicked.anim - Assets/Chert/Chert_Chatter_Nervous.anim +- Assets/Chert/hourglasstwinsmeshescharacters2.asset - Assets/Riebeck/Playing_banjo.anim - Assets/Riebeck/Playing_to_idle.anim - Assets/Chert/Chert_Dream.anim diff --git a/QSB/Animation/AnimationSync.cs b/QSB/Animation/AnimationSync.cs index e96c151e..0b935b79 100644 --- a/QSB/Animation/AnimationSync.cs +++ b/QSB/Animation/AnimationSync.cs @@ -26,8 +26,6 @@ namespace QSB.Animation private RuntimeAnimatorController _feldsparController; private RuntimeAnimatorController _gabbroController; private RuntimeAnimatorController _riebeckController; - private RuntimeAnimatorController _solanumController; - public AnimatorMirror Mirror { get; private set; } public AnimationType CurrentType = AnimationType.PlayerUnsuited; @@ -218,9 +216,6 @@ namespace QSB.Animation case AnimationType.Riebeck: controller = _riebeckController; break; - case AnimationType.Solanum: - controller = _solanumController; - break; } _anim.runtimeAnimatorController = controller; _bodyAnim.runtimeAnimatorController = controller; diff --git a/QSB/Animation/AnimationType.cs b/QSB/Animation/AnimationType.cs index cc08269d..6b6e44ba 100644 --- a/QSB/Animation/AnimationType.cs +++ b/QSB/Animation/AnimationType.cs @@ -8,7 +8,6 @@ Gabbro, PlayerSuited, PlayerUnsuited, - Riebeck, - Solanum + Riebeck } } \ No newline at end of file diff --git a/QSB/Animation/Events/ChangeAnimTypeEvent.cs b/QSB/Animation/Events/ChangeAnimTypeEvent.cs index cb9235a1..f204ee8c 100644 --- a/QSB/Animation/Events/ChangeAnimTypeEvent.cs +++ b/QSB/Animation/Events/ChangeAnimTypeEvent.cs @@ -1,4 +1,5 @@ using QSB.EventsCore; +using QSB.Instruments; using QSB.MessagesCore; using QSB.Player; @@ -23,6 +24,7 @@ namespace QSB.Animation.Events public override void OnReceiveRemote(EnumMessage message) { QSBPlayerManager.GetPlayer(message.AboutId).Animator.SetAnimationType(message.Value); + QSBPlayerManager.GetSyncObject(message.AboutId).CheckInstrumentProps(message.Value); } } } \ No newline at end of file diff --git a/QSB/Animation/PlayerHeadRotationSync.cs b/QSB/Animation/PlayerHeadRotationSync.cs new file mode 100644 index 00000000..bf68b3d6 --- /dev/null +++ b/QSB/Animation/PlayerHeadRotationSync.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace QSB.Animation +{ + class PlayerHeadRotationSync + { + } +} diff --git a/QSB/Instruments/InstrumentsManager.cs b/QSB/Instruments/InstrumentsManager.cs index 6e4e0210..3953ea16 100644 --- a/QSB/Instruments/InstrumentsManager.cs +++ b/QSB/Instruments/InstrumentsManager.cs @@ -1,19 +1,22 @@ -using QSB.Animation; +using OWML.Common; +using QSB.Animation; using QSB.EventsCore; using QSB.Instruments.QSBCamera; using QSB.Player; +using QSB.Utility; using UnityEngine; namespace QSB.Instruments { - public class InstrumentsManager : MonoBehaviour + public class InstrumentsManager : PlayerSyncObject { - public static InstrumentsManager Instance; + private Transform rootObj; private AnimationType _savedType; + private GameObject ChertDrum; - private void Awake() + public void InitLocal(Transform root) { - Instance = this; + rootObj = root; gameObject.AddComponent(); QSBInputManager.ChertTaunt += () => StartInstrument(AnimationType.Chert); @@ -21,35 +24,83 @@ namespace QSB.Instruments QSBInputManager.FeldsparTaunt += () => StartInstrument(AnimationType.Feldspar); QSBInputManager.GabbroTaunt += () => StartInstrument(AnimationType.Gabbro); QSBInputManager.RiebeckTaunt += () => StartInstrument(AnimationType.Riebeck); - QSBInputManager.SolanumTaunt += () => StartInstrument(AnimationType.Solanum); QSBInputManager.ExitTaunt += () => ReturnToPlayer(); + + QSB.Helper.Events.Unity.RunWhen(() => Locator.GetPlayerBody() != null, SetupInstruments); + + QSBPlayerManager.PlayerSyncObjects.Add(this); + } + + public void InitRemote(Transform root) + { + rootObj = root; + QSB.Helper.Events.Unity.RunWhen(() => Locator.GetPlayerBody() != null, SetupInstruments); + + QSBPlayerManager.PlayerSyncObjects.Add(this); } private void OnDestroy() { + if (!isLocalPlayer) + { + return; + } + DebugLog.DebugWrite($"OnDestroy {PlayerId}"); QSBInputManager.ChertTaunt -= () => StartInstrument(AnimationType.Chert); QSBInputManager.EskerTaunt -= () => StartInstrument(AnimationType.Esker); QSBInputManager.FeldsparTaunt -= () => StartInstrument(AnimationType.Feldspar); QSBInputManager.GabbroTaunt -= () => StartInstrument(AnimationType.Gabbro); QSBInputManager.RiebeckTaunt -= () => StartInstrument(AnimationType.Riebeck); - QSBInputManager.SolanumTaunt -= () => StartInstrument(AnimationType.Solanum); QSBInputManager.ExitTaunt -= () => ReturnToPlayer(); } + private void SetupInstruments() + { + DebugLog.DebugWrite($"Setup instruments {PlayerId}"); + var bundle = QSB.InstrumentAssetBundle; + ChertDrum = MakeChertDrum(bundle); + } + + // EyeCompatibility : Need to find right object. + private GameObject MakeChertDrum(AssetBundle bundle) + { + var drum = new GameObject(); + var mf = drum.AddComponent(); + mf.sharedMesh = bundle.LoadAsset("assets/Chert/hourglasstwinsmeshescharacters2.asset") as Mesh; + var mr = drum.AddComponent(); + mr.sharedMaterial = GameObject.Find("NewDrum:polySurface2").GetComponent().material; + foreach (var item in mr.sharedMaterial.shaderKeywords) + { + DebugLog.DebugWrite(item); + } + drum.transform.parent = rootObj; + drum.transform.rotation = rootObj.rotation; + drum.transform.localPosition = Vector3.zero; + drum.transform.localScale = new Vector3(16.0f, 16.5f, 16.0f); + drum.SetActive(false); + + return drum; + } + public void StartInstrument(AnimationType type) { - if (QSBPlayerManager.LocalPlayer.PlayingInstrument) + if (!isLocalPlayer) + { + DebugLog.DebugWrite("Error - Tried to start instrument on non-local player!", MessageType.Error); + return; + } + if (Player.PlayingInstrument || !Locator.GetPlayerController().IsGrounded()) { return; } - _savedType = QSBPlayerManager.LocalPlayer.Animator.CurrentType; + _savedType = Player.Animator.CurrentType; CameraManager.Instance.SwitchTo3rdPerson(); SwitchToType(type); } public void ReturnToPlayer() { - if (!QSBPlayerManager.LocalPlayer.PlayingInstrument) + if (!Player.PlayingInstrument) { return; } @@ -59,8 +110,24 @@ namespace QSB.Instruments public void SwitchToType(AnimationType type) { + DebugLog.DebugWrite($"switch to type {type} player {PlayerId}"); GlobalMessenger.FireEvent(EventNames.QSBChangeAnimType, QSBPlayerManager.LocalPlayerId, type); QSBPlayerManager.LocalPlayer.Animator.SetAnimationType(type); + CheckInstrumentProps(type); + } + + public void CheckInstrumentProps(AnimationType type) + { + switch (type) + { + case AnimationType.Chert: + ChertDrum.SetActive(true); + break; + case AnimationType.PlayerSuited: + case AnimationType.PlayerUnsuited: + ChertDrum.SetActive(false); + break; + } } } } diff --git a/QSB/Instruments/QSBCamera/CameraManager.cs b/QSB/Instruments/QSBCamera/CameraManager.cs index 1f562c02..41c95668 100644 --- a/QSB/Instruments/QSBCamera/CameraManager.cs +++ b/QSB/Instruments/QSBCamera/CameraManager.cs @@ -18,20 +18,10 @@ namespace QSB.Instruments.QSBCamera public void Start() { Instance = this; - QSBSceneManager.OnSceneLoaded += OnSceneLoaded; + SetupCamera(); } - private void OnSceneLoaded(OWScene scene, bool inUniverse) - { - if (!inUniverse) - { - return; - } - IsSetUp = false; - QSB.Helper.Events.Unity.RunWhen(() => Locator.GetPlayerCamera() != null && Locator.GetPlayerTransform() != null, Setup); - } - - private void Setup() + private void SetupCamera() { CameraBase = new GameObject(); CameraBase.SetActive(false); @@ -74,6 +64,8 @@ namespace QSB.Instruments.QSBCamera if (!IsSetUp) { DebugLog.ToConsole("Warning - Camera not set up!", MessageType.Warning); + OWInput.ChangeInputMode(InputMode.None); + Mode = CameraMode.ThirdPerson; return; } if (Mode == CameraMode.ThirdPerson) @@ -103,6 +95,8 @@ namespace QSB.Instruments.QSBCamera if (!IsSetUp) { DebugLog.ToConsole("Warning - Camera not set up!", MessageType.Warning); + OWInput.ChangeInputMode(InputMode.Character); + Mode = CameraMode.FirstPerson; return; } if (Mode == CameraMode.FirstPerson) @@ -116,15 +110,5 @@ namespace QSB.Instruments.QSBCamera Camera.enabled = false; Mode = CameraMode.FirstPerson; } - - public void ToggleViewMode() - { - if (Mode == CameraMode.FirstPerson) - { - SwitchTo3rdPerson(); - return; - } - SwitchTo1stPerson(); - } } } diff --git a/QSB/Player/QSBPlayerManager.cs b/QSB/Player/QSBPlayerManager.cs index 6e0d11c5..f4999ae0 100644 --- a/QSB/Player/QSBPlayerManager.cs +++ b/QSB/Player/QSBPlayerManager.cs @@ -22,7 +22,7 @@ namespace QSB.Player if (id == uint.MaxValue || id == 0U) { var stacktrace = new StackTrace(); - DebugLog.ToConsole($"GetPlayer() got uint.MaxValue or 0 - returning default. Ran from {stacktrace.GetFrame(1).GetMethod().DeclaringType.Name}.{stacktrace.GetFrame(1).GetMethod().Name}.", MessageType.Warning); + DebugLog.ToConsole($"GetPlayer() called with uint.MaxValue or 0 - returning default. Ran from {stacktrace.GetFrame(1).GetMethod().DeclaringType.Name}.{stacktrace.GetFrame(1).GetMethod().Name}.", MessageType.Warning); return default; } var player = PlayerList.FirstOrDefault(x => x.PlayerId == id); diff --git a/QSB/QSB.cs b/QSB/QSB.cs index 08c08fae..2e5a34ba 100644 --- a/QSB/QSB.cs +++ b/QSB/QSB.cs @@ -4,7 +4,6 @@ using OWML.ModHelper.Events; using QSB.ConversationSync; using QSB.ElevatorSync; using QSB.GeyserSync; -using QSB.Instruments; using QSB.OrbSync; using QSB.Patches; using QSB.SectorSync; @@ -59,7 +58,6 @@ namespace QSB gameObject.AddComponent(); gameObject.AddComponent(); gameObject.AddComponent(); - gameObject.AddComponent(); gameObject.AddComponent(); Helper.Events.Unity.RunWhen(() => PlayerData.IsLoaded(), RebuildSettingsSave); diff --git a/QSB/QSB.csproj b/QSB/QSB.csproj index b474cfbf..7b3a7cea 100644 --- a/QSB/QSB.csproj +++ b/QSB/QSB.csproj @@ -80,8 +80,9 @@ - - $(GameDir)\OuterWilds_Data\Managed\UnityEngine.dll + + False + E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.dll False @@ -90,10 +91,7 @@ $(GameDir)\OuterWilds_Data\Managed\UnityEngine.AudioModule.dll - - False - $(GameDir)\OuterWilds_Data\Managed\UnityEngine.CoreModule.dll - + False $(GameDir)\OuterWilds_Data\Managed\UnityEngine.IMGUIModule.dll diff --git a/QSB/QSBInputManager.cs b/QSB/QSBInputManager.cs index b305e155..ffd10ac0 100644 --- a/QSB/QSBInputManager.cs +++ b/QSB/QSBInputManager.cs @@ -7,12 +7,12 @@ namespace QSB public class QSBInputManager : MonoBehaviour { public static QSBInputManager Instance; + public static event InputEvent ChertTaunt; public static event InputEvent EskerTaunt; - public static event InputEvent FeldsparTaunt; - public static event InputEvent GabbroTaunt; public static event InputEvent RiebeckTaunt; - public static event InputEvent SolanumTaunt; + public static event InputEvent GabbroTaunt; + public static event InputEvent FeldsparTaunt; public static event InputEvent ExitTaunt; public void Awake() @@ -24,6 +24,7 @@ namespace QSB { if (Input.GetKey(KeyCode.T)) { + // Listed order is from sun to dark bramble if (Input.GetKeyDown(KeyCode.Alpha1)) { ChertTaunt?.Invoke(); @@ -32,21 +33,17 @@ namespace QSB { EskerTaunt?.Invoke(); } - else if (Input.GetKeyDown(KeyCode.Alpha3)) + else if (Input.GetKeyDown(KeyCode.Alpha5)) { - FeldsparTaunt?.Invoke(); + RiebeckTaunt?.Invoke(); } else if (Input.GetKeyDown(KeyCode.Alpha4)) { GabbroTaunt?.Invoke(); } - else if (Input.GetKeyDown(KeyCode.Alpha5)) + else if (Input.GetKeyDown(KeyCode.Alpha3)) { - RiebeckTaunt?.Invoke(); - } - else if (Input.GetKeyDown(KeyCode.Alpha6)) - { - SolanumTaunt?.Invoke(); + FeldsparTaunt?.Invoke(); } } diff --git a/QSB/QSBNetworkManager.cs b/QSB/QSBNetworkManager.cs index bbfcde08..4278f55a 100644 --- a/QSB/QSBNetworkManager.cs +++ b/QSB/QSBNetworkManager.cs @@ -5,6 +5,7 @@ using QSB.DeathSync; using QSB.ElevatorSync; using QSB.EventsCore; using QSB.GeyserSync; +using QSB.Instruments; using QSB.OrbSync; using QSB.Patches; using QSB.Player; @@ -48,6 +49,7 @@ namespace QSB playerPrefab.AddComponent(); playerPrefab.AddComponent(); playerPrefab.AddComponent(); + playerPrefab.AddComponent(); _shipPrefab = _assetBundle.LoadAsset("assets/networkship.prefab"); _shipPrefab.AddComponent(); diff --git a/QSB/TransformSync/PlayerTransformSync.cs b/QSB/TransformSync/PlayerTransformSync.cs index b07a5005..db80416a 100644 --- a/QSB/TransformSync/PlayerTransformSync.cs +++ b/QSB/TransformSync/PlayerTransformSync.cs @@ -1,4 +1,5 @@ using QSB.Animation; +using QSB.Instruments; using QSB.Player; using UnityEngine; @@ -28,6 +29,7 @@ namespace QSB.TransformSync var body = GetPlayerModel(); GetComponent().InitLocal(body); + GetComponent().InitLocal(body); Player.Body = body.gameObject; @@ -39,6 +41,7 @@ namespace QSB.TransformSync var body = Instantiate(GetPlayerModel()); GetComponent().InitRemote(body); + GetComponent().InitRemote(body); var marker = body.gameObject.AddComponent(); marker.Init(Player); diff --git a/QSB/Utility/DebugLog.cs b/QSB/Utility/DebugLog.cs index e8616400..141e5601 100644 --- a/QSB/Utility/DebugLog.cs +++ b/QSB/Utility/DebugLog.cs @@ -9,7 +9,7 @@ namespace QSB.Utility { public static void ToConsole(string message, MessageType type = MessageType.Message) { - // hack to make custom method name in owml log. + // make custom method name in owml log. // i wrote the owml code for this so this is fine?? shut up i dont want to change owml var console = (ModSocketOutput)QSB.Helper.Console; var method = console.GetType()