fixed and added stuff

This commit is contained in:
Mister_Nebula 2020-11-20 19:50:31 +00:00
parent af51ff4ddd
commit 6732b1aae8
17 changed files with 130 additions and 71 deletions

View File

@ -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

View File

@ -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

Binary file not shown.

View File

@ -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

View File

@ -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;

View File

@ -8,7 +8,6 @@
Gabbro,
PlayerSuited,
PlayerUnsuited,
Riebeck,
Solanum
Riebeck
}
}

View File

@ -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<AnimationType> message)
{
QSBPlayerManager.GetPlayer(message.AboutId).Animator.SetAnimationType(message.Value);
QSBPlayerManager.GetSyncObject<InstrumentsManager>(message.AboutId).CheckInstrumentProps(message.Value);
}
}
}

View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace QSB.Animation
{
class PlayerHeadRotationSync
{
}
}

View File

@ -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<CameraManager>();
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<MeshFilter>();
mf.sharedMesh = bundle.LoadAsset("assets/Chert/hourglasstwinsmeshescharacters2.asset") as Mesh;
var mr = drum.AddComponent<MeshRenderer>();
mr.sharedMaterial = GameObject.Find("NewDrum:polySurface2").GetComponent<MeshRenderer>().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<uint, AnimationType>.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;
}
}
}
}

View File

@ -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();
}
}
}

View File

@ -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);

View File

@ -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<OrbManager>();
gameObject.AddComponent<QSBSectorManager>();
gameObject.AddComponent<ConversationManager>();
gameObject.AddComponent<InstrumentsManager>();
gameObject.AddComponent<QSBInputManager>();
Helper.Events.Unity.RunWhen(() => PlayerData.IsLoaded(), RebuildSettingsSave);

View File

@ -80,8 +80,9 @@
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.dll</HintPath>
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AnimationModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@ -90,10 +91,7 @@
<Reference Include="UnityEngine.AudioModule">
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.AudioModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Reference Include="UnityEngine.IMGUIModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>

View File

@ -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();
}
}

View File

@ -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<PlayerTransformSync>();
playerPrefab.AddComponent<AnimationSync>();
playerPrefab.AddComponent<WakeUpSync>();
playerPrefab.AddComponent<InstrumentsManager>();
_shipPrefab = _assetBundle.LoadAsset<GameObject>("assets/networkship.prefab");
_shipPrefab.AddComponent<ShipTransformSync>();

View File

@ -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<AnimationSync>().InitLocal(body);
GetComponent<InstrumentsManager>().InitLocal(body);
Player.Body = body.gameObject;
@ -39,6 +41,7 @@ namespace QSB.TransformSync
var body = Instantiate(GetPlayerModel());
GetComponent<AnimationSync>().InitRemote(body);
GetComponent<InstrumentsManager>().InitRemote(body);
var marker = body.gameObject.AddComponent<PlayerHUDMarker>();
marker.Init(Player);

View File

@ -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()