diff --git a/QSB/AssetBundles/network b/QSB/AssetBundles/network index afbe5dfe..5ed8c12c 100644 Binary files a/QSB/AssetBundles/network and b/QSB/AssetBundles/network differ diff --git a/QSB/AssetBundles/network.manifest b/QSB/AssetBundles/network.manifest index 38a60887..9bbc58fc 100644 --- a/QSB/AssetBundles/network.manifest +++ b/QSB/AssetBundles/network.manifest @@ -1,9 +1,9 @@ ManifestFileVersion: 0 -CRC: 1236337440 +CRC: 2877256378 Hashes: AssetFileHash: serializedVersion: 2 - Hash: 91db39439a02545ccbd81737830d763f + Hash: 8d7ea522fab30919b9da9d6fcc291d2b TypeTreeHash: serializedVersion: 2 Hash: 7c361b9660415c98c90cf08b6645985a diff --git a/QSB/PlayerBodySetup/Local/LocalPlayerCreation.cs b/QSB/PlayerBodySetup/Local/LocalPlayerCreation.cs index 5d8d72d4..2ff7f66e 100644 --- a/QSB/PlayerBodySetup/Local/LocalPlayerCreation.cs +++ b/QSB/PlayerBodySetup/Local/LocalPlayerCreation.cs @@ -3,6 +3,7 @@ using QSB.Player; using QSB.Player.Messages; using QSB.SectorSync; using QSB.Tools; +using QSB.Utility; using QSB.WorldSync; using System.Linq; using UnityEngine; @@ -19,6 +20,8 @@ namespace QSB.PlayerBodySetup.Local out Transform visibleStickPivot, out Transform visibleStickTip) { + DebugLog.DebugWrite($"CREATE PLAYER"); + sectorDetector.Init(Locator.GetPlayerSectorDetector(), TargetType.Player); // player body diff --git a/QSB/PlayerBodySetup/Remote/FixMaterialsInAllChildren.cs b/QSB/PlayerBodySetup/Remote/FixMaterialsInAllChildren.cs index b89d8069..81d57bfe 100644 --- a/QSB/PlayerBodySetup/Remote/FixMaterialsInAllChildren.cs +++ b/QSB/PlayerBodySetup/Remote/FixMaterialsInAllChildren.cs @@ -1,4 +1,8 @@ -using System.Collections.Generic; +using QSB.Utility; +using QSB.WorldSync; +using System; +using System.Collections.Generic; +using System.Linq; using UnityEngine; namespace QSB.PlayerBodySetup.Remote @@ -28,9 +32,19 @@ namespace QSB.PlayerBodySetup.Remote public static void ReplaceMaterials(Transform rootObject) { + DebugLog.DebugWrite($"Replace materials on children of {rootObject.name}"); + if (_materialDefinitions.Count == 0) { - GenerateMaterialDefinitions(); + try + { + GenerateMaterialDefinitions(); + } + catch (Exception ex) + { + DebugLog.ToConsole($"Exception when generating material definitions. {ex}", OWML.Common.MessageType.Error); + return; + } } foreach (var renderer in rootObject.GetComponentsInChildren(true)) @@ -44,31 +58,28 @@ namespace QSB.PlayerBodySetup.Remote private static void GenerateMaterialDefinitions() { - var localPlayerAnimController = Locator.GetPlayerBody().GetComponentInChildren(true); + var matNameList = new List() + { + "Traveller_HEA_Player_Skin_mat", + "Traveller_HEA_Player_Clothes_mat", + "Traveller_HEA_PlayerSuit_mat", + "Props_HEA_Jetpack_mat" + }; - var playerClothesMat = localPlayerAnimController._unsuitedGroup.transform.GetChild(0).GetComponent().material; - var playerSkinMat = localPlayerAnimController._unsuitedGroup.transform.GetChild(1).GetComponent().material; - var playerSuitMat = localPlayerAnimController._suitedGroup.transform.GetChild(0).GetComponent().material; - var playerJetpackMat = localPlayerAnimController._suitedGroup.transform.GetChild(4).GetComponent().material; + var allMaterials = (Material[])Resources.FindObjectsOfTypeAll(typeof(Material)); - var roastingSystem = Locator.GetPlayerCamera().transform.Find("RoastingSystem"); - var stickRoot = roastingSystem.GetChild(0); - var stickPivot = stickRoot.GetChild(0); - var stickTip = stickPivot.GetChild(0); + foreach (var name in matNameList) + { + var matchingMaterial = allMaterials.FirstOrDefault(x => x.name == name); - var localMallowRoot = stickTip.Find("Mallow_Root"); - var localMallowFlames = localMallowRoot.Find("Effects_HEA_MarshmallowFlames"); - var mallowFlamesMat = localMallowFlames.GetComponent().material; + if (matchingMaterial == default) + { + DebugLog.ToConsole($"Error - could not find material with the name {name}!", OWML.Common.MessageType.Error); + return; + } - var localStick = stickTip.Find("Props_HEA_RoastingSick").GetChild(0); - var roastingStickMat = localStick.GetComponent().material; - - _materialDefinitions.Add(new(playerSkinMat.name, playerSkinMat)); - _materialDefinitions.Add(new(playerClothesMat.name, playerClothesMat)); - _materialDefinitions.Add(new(playerSuitMat.name, playerSuitMat)); - _materialDefinitions.Add(new(playerJetpackMat.name, playerJetpackMat)); - _materialDefinitions.Add(new(mallowFlamesMat.name, mallowFlamesMat)); - _materialDefinitions.Add(new(roastingStickMat.name, roastingStickMat)); + _materialDefinitions.Add(new(name, matchingMaterial)); + } } } } diff --git a/QSB/PlayerBodySetup/Remote/RemotePlayerCreation.cs b/QSB/PlayerBodySetup/Remote/RemotePlayerCreation.cs index d0867fe7..34d748f0 100644 --- a/QSB/PlayerBodySetup/Remote/RemotePlayerCreation.cs +++ b/QSB/PlayerBodySetup/Remote/RemotePlayerCreation.cs @@ -17,10 +17,14 @@ namespace QSB.PlayerBodySetup.Remote out Transform visibleStickPivot, out Transform visibleStickTip) { + DebugLog.DebugWrite($"CREATE PLAYER"); + /* * CREATE PLAYER STRUCTURE */ + DebugLog.DebugWrite($"CREATE PLAYER STRUCTURE"); + // Variable naming convention is broken here to reflect OW unity project (with REMOTE_ prefixed) for readability var REMOTE_Player_Body = UnityEngine.Object.Instantiate(QSBCore.NetworkAssetBundle.LoadAsset("Assets/Prefabs/REMOTE_Player_Body.prefab")); @@ -36,6 +40,8 @@ namespace QSB.PlayerBodySetup.Remote * SET UP PLAYER BODY */ + DebugLog.DebugWrite($"SET UP PLAYER BODY"); + player.Body = REMOTE_Player_Body; FixMaterialsInAllChildren.ReplaceMaterials(REMOTE_Player_Body.transform); @@ -58,6 +64,8 @@ namespace QSB.PlayerBodySetup.Remote * SET UP PLAYER CAMERA */ + DebugLog.DebugWrite($"SET UP PLAYER CAMERA"); + REMOTE_PlayerCamera.GetComponent().enabled = false; var owcamera = REMOTE_PlayerCamera.GetComponent(); player.Camera = owcamera; @@ -70,6 +78,8 @@ namespace QSB.PlayerBodySetup.Remote * SET UP ROASTING STICK */ + DebugLog.DebugWrite($"SET UP ROASTING STICK"); + var REMOTE_Stick_Pivot = REMOTE_Stick_Root.transform.GetChild(0); REMOTE_Stick_Pivot.gameObject.SetActive(false); var mallowRoot = REMOTE_Stick_Pivot.Find("REMOTE_Stick_Tip/Mallow_Root"); @@ -78,7 +88,6 @@ namespace QSB.PlayerBodySetup.Remote player.RoastingStick = REMOTE_Stick_Pivot.gameObject; var marshmallow = mallowRoot.GetComponent(); player.Marshmallow = marshmallow; - marshmallow.enabled = true; visibleRoastingSystem = REMOTE_RoastingSystem.transform; visibleStickPivot = REMOTE_Stick_Pivot; diff --git a/QSB/Tools/PlayerToolsManager.cs b/QSB/Tools/PlayerToolsManager.cs index fb69c71b..335a4e93 100644 --- a/QSB/Tools/PlayerToolsManager.cs +++ b/QSB/Tools/PlayerToolsManager.cs @@ -68,60 +68,8 @@ namespace QSB.Tools private static void CreateStowTransforms(Transform cameraBody) { - var playerBody = cameraBody.parent; - StowTransform = cameraBody.Find("REMOTE_ToolStowTransform"); HoldTransform = cameraBody.Find("REMOTE_ToolHoldTransform"); - - /* - var item = new GameObject("REMOTE_ItemSocket"); - item.transform.parent = cameraBody; - item.transform.localPosition = new Vector3(0.125f, -0.12f, 0.2f); - item.transform.localRotation = Quaternion.Euler(0, 0, 15); - item.transform.localScale = new Vector3(0.33f, 0.33f, 0.33f); - - var scroll = new GameObject("REMOTE_ScrollSocket"); - scroll.transform.parent = cameraBody; - scroll.transform.localPosition = new Vector3(0.148f, -0.0522f, 0.2465f); - scroll.transform.localRotation = Quaternion.Euler(236.054f, 56.46799f, -152.472f); - scroll.transform.localScale = new Vector3(0.33f, 0.33f, 0.33f); - - var sharedStone = new GameObject("REMOTE_SharedStoneSocket"); - sharedStone.transform.parent = cameraBody; - sharedStone.transform.localPosition = new Vector3(0.1375f, -0.119f, 0.2236f); - sharedStone.transform.localRotation = Quaternion.Euler(-23.053f, -0.263f, 6.704f); - sharedStone.transform.localScale = new Vector3(0.33f, 0.33f, 0.33f); - - var warpCore = new GameObject("REMOTE_WarpCoreSocket"); - warpCore.transform.parent = cameraBody; - warpCore.transform.localPosition = new Vector3(0.161f, -0.107f, 0.223f); - warpCore.transform.localRotation = Quaternion.Euler(179.949f, 82.59f, 163.697f); - warpCore.transform.localScale = new Vector3(0.33f, 0.33f, 0.33f); - - var vesselCore = new GameObject("REMOTE_VesselCoreSocket"); - vesselCore.transform.parent = cameraBody; - vesselCore.transform.localPosition = new Vector3(0.177f, -0.106f, 0.2f); - vesselCore.transform.localRotation = Quaternion.Euler(3.142f, 14.827f, 12.094f); - vesselCore.transform.localScale = new Vector3(0.27f, 0.27f, 0.27f); - - var dreamLantern = new GameObject("REMOTE_DreamLanternSocket"); - dreamLantern.transform.parent = cameraBody; - dreamLantern.transform.localPosition = new Vector3(0.243f, -0.207f, 0.262f); - dreamLantern.transform.localRotation = Quaternion.Euler(0f, 0f, 0f); - dreamLantern.transform.localScale = new Vector3(0.33f, 0.33f, 0.33f); - - var slideReel = new GameObject("REMOTE_SlideReelSocket"); - slideReel.transform.parent = cameraBody; - slideReel.transform.localPosition = new Vector3(0.1353f, -0.0878f, 0.2878f); - slideReel.transform.localRotation = Quaternion.Euler(-145.532f, 6.589996f, -94.54901f); - slideReel.transform.localScale = new Vector3(0.3300001f, 0.33f, 0.3299999f); - - var visionTorch = new GameObject("REMOTE_VisionTorchSocket"); - visionTorch.transform.parent = cameraBody; - visionTorch.transform.localPosition = new Vector3(0.21f, -0.32f, 0.33f); - visionTorch.transform.localRotation = Quaternion.Euler(-4.5f, 0.03f, 9f); - visionTorch.transform.localScale = new Vector3(0.33f, 0.33f, 0.33f); - */ } internal static MeshRenderer GetRenderer(GameObject root, string gameObjectName) => diff --git a/QSB/Tools/SignalscopeTool/SignalscopeCreator.cs b/QSB/Tools/SignalscopeTool/SignalscopeCreator.cs index 76abcf06..dbcb70f5 100644 --- a/QSB/Tools/SignalscopeTool/SignalscopeCreator.cs +++ b/QSB/Tools/SignalscopeTool/SignalscopeCreator.cs @@ -6,8 +6,6 @@ namespace QSB.Tools.SignalscopeTool { internal static class SignalscopeCreator { - private static readonly Vector3 SignalscopeScale = new(1.5f, 1.5f, 1.5f); - internal static void CreateSignalscope(PlayerInfo player) { var signalscopeRoot = player.CameraBody.transform.Find("REMOTE_Signalscope").gameObject;