mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-25 15:35:22 +00:00
Merge pull request #334 from misternebula/some-dlc-support
Some dlc support
This commit is contained in:
commit
a53e599364
@ -37,7 +37,7 @@ namespace QSB.Animation.NPC.Patches
|
||||
|
||||
var playerId = ConversationManager.Instance.GetPlayerTalkingToTree(____dialogueTree);
|
||||
var player = QSBPlayerManager.GetPlayer(playerId);
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBCharacterAnimController, CharacterAnimController>(__instance); // OPTIMIZE : maybe cache this somewhere... or assess how slow this is
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBCharacterAnimController>(__instance); // OPTIMIZE : maybe cache this somewhere... or assess how slow this is
|
||||
|
||||
PlayerInfo playerToUse = null;
|
||||
if (____inConversation)
|
||||
@ -98,7 +98,7 @@ namespace QSB.Animation.NPC.Patches
|
||||
[HarmonyPatch(typeof(CharacterAnimController), nameof(CharacterAnimController.OnZoneExit))]
|
||||
public static bool HeadZoneExit(CharacterAnimController __instance)
|
||||
{
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBCharacterAnimController, CharacterAnimController>(__instance);
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBCharacterAnimController>(__instance);
|
||||
QSBEventManager.FireEvent(EventNames.QSBExitNonNomaiHeadZone, qsbObj.ObjectId);
|
||||
return false;
|
||||
}
|
||||
@ -107,7 +107,7 @@ namespace QSB.Animation.NPC.Patches
|
||||
[HarmonyPatch(typeof(CharacterAnimController), nameof(CharacterAnimController.OnZoneEntry))]
|
||||
public static bool HeadZoneEntry(CharacterAnimController __instance)
|
||||
{
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBCharacterAnimController, CharacterAnimController>(__instance);
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBCharacterAnimController>(__instance);
|
||||
QSBEventManager.FireEvent(EventNames.QSBEnterNonNomaiHeadZone, qsbObj.ObjectId);
|
||||
return false;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace QSB.Animation.NPC.Patches
|
||||
__instance._animatorStateEvents.OnEnterState += __instance.OnEnterAnimatorState;
|
||||
}
|
||||
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBSolanumAnimController, SolanumAnimController>(__instance);
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBSolanumAnimController>(__instance);
|
||||
var playersInHeadZone = qsbObj.GetPlayersInHeadZone();
|
||||
|
||||
var targetCamera = playersInHeadZone == null || playersInHeadZone.Count == 0
|
||||
@ -48,7 +48,7 @@ namespace QSB.Animation.NPC.Patches
|
||||
[HarmonyPatch(typeof(NomaiConversationManager), nameof(NomaiConversationManager.OnEnterWatchVolume))]
|
||||
public static bool EnterWatchZone(NomaiConversationManager __instance)
|
||||
{
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBSolanumAnimController, SolanumAnimController>(__instance._solanumAnimController);
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBSolanumAnimController>(__instance._solanumAnimController);
|
||||
QSBEventManager.FireEvent(EventNames.QSBEnterNomaiHeadZone, qsbObj.ObjectId);
|
||||
return false;
|
||||
}
|
||||
@ -57,7 +57,7 @@ namespace QSB.Animation.NPC.Patches
|
||||
[HarmonyPatch(typeof(NomaiConversationManager), nameof(NomaiConversationManager.OnExitWatchVolume))]
|
||||
public static bool ExitWatchZone(NomaiConversationManager __instance)
|
||||
{
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBSolanumAnimController, SolanumAnimController>(__instance._solanumAnimController);
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBSolanumAnimController>(__instance._solanumAnimController);
|
||||
QSBEventManager.FireEvent(EventNames.QSBExitNomaiHeadZone, qsbObj.ObjectId);
|
||||
return false;
|
||||
}
|
||||
@ -66,7 +66,7 @@ namespace QSB.Animation.NPC.Patches
|
||||
[HarmonyPatch(typeof(NomaiConversationManager), nameof(NomaiConversationManager.Update))]
|
||||
public static bool ReplacementUpdate(NomaiConversationManager __instance)
|
||||
{
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBSolanumAnimController, SolanumAnimController>(__instance._solanumAnimController);
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBSolanumAnimController>(__instance._solanumAnimController);
|
||||
__instance._playerInWatchVolume = qsbObj.GetPlayersInHeadZone().Any();
|
||||
|
||||
if (!__instance._initialized)
|
||||
|
@ -15,7 +15,7 @@ namespace QSB.CampfireSync.Patches
|
||||
[HarmonyPatch(typeof(Campfire), nameof(Campfire.OnPressInteract))]
|
||||
public static bool LightCampfireEvent(Campfire __instance)
|
||||
{
|
||||
var qsbCampfire = QSBWorldSync.GetWorldFromUnity<QSBCampfire, Campfire>(__instance);
|
||||
var qsbCampfire = QSBWorldSync.GetWorldFromUnity<QSBCampfire>(__instance);
|
||||
if (__instance._state == Campfire.State.LIT)
|
||||
{
|
||||
qsbCampfire.StartRoasting();
|
||||
|
@ -17,7 +17,7 @@ namespace QSB.ElevatorSync.Patches
|
||||
public static void Elevator_StartLift(Elevator __instance)
|
||||
{
|
||||
var isGoingUp = __instance.GetValue<bool>("_goingToTheEnd");
|
||||
var id = QSBWorldSync.GetIdFromUnity<QSBElevator, Elevator>(__instance);
|
||||
var id = QSBWorldSync.GetIdFromUnity<QSBElevator>(__instance);
|
||||
QSBEventManager.FireEvent(EventNames.QSBStartLift, id, isGoingUp);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using QSB.Events;
|
||||
using QSB.ItemSync.WorldObjects;
|
||||
using QSB.ItemSync.WorldObjects.Items;
|
||||
using QSB.Player;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
|
@ -29,7 +29,7 @@ namespace QSB.ItemSync.Events
|
||||
writer.Write(ObjectId);
|
||||
writer.Write(Position);
|
||||
writer.Write(Normal);
|
||||
var qsbSector = QSBWorldSync.GetWorldFromUnity<QSBSector, Sector>(Sector);
|
||||
var qsbSector = QSBWorldSync.GetWorldFromUnity<QSBSector>(Sector);
|
||||
writer.Write(qsbSector.ObjectId);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using QSB.Events;
|
||||
using QSB.ItemSync.WorldObjects;
|
||||
using QSB.ItemSync.WorldObjects.Items;
|
||||
using QSB.Player;
|
||||
using QSB.WorldSync;
|
||||
using QSB.WorldSync.Events;
|
||||
@ -48,6 +48,18 @@ namespace QSB.ItemSync.Events
|
||||
? player.VesselCoreSocket
|
||||
: player.WarpCoreSocket;
|
||||
break;
|
||||
case ItemType.Lantern:
|
||||
itemSocket = player.SimpleLanternSocket;
|
||||
break;
|
||||
case ItemType.DreamLantern:
|
||||
itemSocket = player.DreamLanternSocket;
|
||||
break;
|
||||
case ItemType.SlideReel:
|
||||
itemSocket = player.SlideReelSocket;
|
||||
break;
|
||||
case ItemType.VisionTorch:
|
||||
itemSocket = player.VisionTorchSocket;
|
||||
break;
|
||||
default:
|
||||
itemSocket = player.ItemSocket;
|
||||
break;
|
||||
|
@ -1,5 +1,7 @@
|
||||
using QSB.Events;
|
||||
using QSB.ItemSync.WorldObjects;
|
||||
using QSB.ItemSync.WorldObjects.Items;
|
||||
using QSB.ItemSync.WorldObjects.Sockets;
|
||||
using QSB.Player;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
|
@ -1,5 +1,6 @@
|
||||
using OWML.Common;
|
||||
using QSB.ItemSync.WorldObjects;
|
||||
using QSB.ItemSync.WorldObjects.Items;
|
||||
using QSB.ItemSync.WorldObjects.Sockets;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
|
||||
@ -10,80 +11,22 @@ namespace QSB.ItemSync
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
{
|
||||
DebugLog.DebugWrite("Rebuilding OWItems...", MessageType.Info);
|
||||
QSBWorldSync.Init<QSBScrollSocket, ScrollSocket>();
|
||||
|
||||
// Items
|
||||
QSBWorldSync.Init<QSBScrollItem, ScrollItem>();
|
||||
QSBWorldSync.Init<QSBSharedStoneSocket, SharedStoneSocket>();
|
||||
QSBWorldSync.Init<QSBSharedStone, SharedStone>();
|
||||
QSBWorldSync.Init<QSBWarpCoreSocket, WarpCoreSocket>();
|
||||
QSBWorldSync.Init<QSBWarpCoreItem, WarpCoreItem>();
|
||||
QSBWorldSync.Init<QSBNomaiConversationStoneSocket, NomaiConversationStoneSocket>();
|
||||
QSBWorldSync.Init<QSBNomaiConversationStone, NomaiConversationStone>();
|
||||
}
|
||||
QSBWorldSync.Init<QSBSimpleLanternItem, SimpleLanternItem>();
|
||||
QSBWorldSync.Init<QSBSlideReelItem, SlideReelItem>();
|
||||
|
||||
public static IQSBOWItem GetObject(OWItem unityObject)
|
||||
{
|
||||
if (unityObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Trying to run GetObject (Item) with null unity object!", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
IQSBOWItem worldObj = null;
|
||||
if (unityObject.GetType() == typeof(ScrollItem))
|
||||
{
|
||||
worldObj = QSBWorldSync.GetWorldFromUnity<QSBScrollItem, ScrollItem>((ScrollItem)unityObject);
|
||||
}
|
||||
else if (unityObject.GetType() == typeof(SharedStone))
|
||||
{
|
||||
worldObj = QSBWorldSync.GetWorldFromUnity<QSBSharedStone, SharedStone>((SharedStone)unityObject);
|
||||
}
|
||||
else if (unityObject.GetType() == typeof(WarpCoreItem))
|
||||
{
|
||||
worldObj = QSBWorldSync.GetWorldFromUnity<QSBWarpCoreItem, WarpCoreItem>((WarpCoreItem)unityObject);
|
||||
}
|
||||
else if (unityObject.GetType() == typeof(NomaiConversationStone))
|
||||
{
|
||||
worldObj = QSBWorldSync.GetWorldFromUnity<QSBNomaiConversationStone, NomaiConversationStone>((NomaiConversationStone)unityObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - couldn't work out type of OWItem {unityObject.name}.", MessageType.Warning);
|
||||
}
|
||||
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
public static IQSBOWItemSocket GetObject(OWItemSocket unityObject)
|
||||
{
|
||||
if (unityObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Trying to run GetObject (Socket) with null unity object!", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
IQSBOWItemSocket worldObj = null;
|
||||
if (unityObject.GetType() == typeof(ScrollSocket))
|
||||
{
|
||||
worldObj = QSBWorldSync.GetWorldFromUnity<QSBScrollSocket, ScrollSocket>((ScrollSocket)unityObject);
|
||||
}
|
||||
else if (unityObject.GetType() == typeof(SharedStoneSocket))
|
||||
{
|
||||
worldObj = QSBWorldSync.GetWorldFromUnity<QSBSharedStoneSocket, SharedStoneSocket>((SharedStoneSocket)unityObject);
|
||||
}
|
||||
else if (unityObject.GetType() == typeof(WarpCoreSocket))
|
||||
{
|
||||
worldObj = QSBWorldSync.GetWorldFromUnity<QSBWarpCoreSocket, WarpCoreSocket>((WarpCoreSocket)unityObject);
|
||||
}
|
||||
else if (unityObject.GetType() == typeof(NomaiConversationStoneSocket))
|
||||
{
|
||||
worldObj = QSBWorldSync.GetWorldFromUnity<QSBNomaiConversationStoneSocket, NomaiConversationStoneSocket>((NomaiConversationStoneSocket)unityObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - couldn't work out type of OWItemSocket {unityObject.name}.", MessageType.Warning);
|
||||
}
|
||||
|
||||
return worldObj;
|
||||
// Sockets
|
||||
QSBWorldSync.Init<QSBScrollSocket, ScrollSocket>();
|
||||
QSBWorldSync.Init<QSBSharedStoneSocket, SharedStoneSocket>();
|
||||
QSBWorldSync.Init<QSBWarpCoreSocket, WarpCoreSocket>();
|
||||
QSBWorldSync.Init<QSBNomaiConversationStoneSocket, NomaiConversationStoneSocket>();
|
||||
QSBWorldSync.Init<QSBSlideReelSocket, SlideReelSocket>();
|
||||
QSBWorldSync.Init<QSBSlideProjectorSocket, SlideProjectorSocket>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
using HarmonyLib;
|
||||
using OWML.Common;
|
||||
using QSB.Events;
|
||||
using QSB.ItemSync.WorldObjects.Items;
|
||||
using QSB.ItemSync.WorldObjects.Sockets;
|
||||
using QSB.Patches;
|
||||
using QSB.Player;
|
||||
using QSB.Utility;
|
||||
@ -18,7 +20,7 @@ namespace QSB.ItemSync.Patches
|
||||
[HarmonyPatch(typeof(ItemTool), nameof(ItemTool.MoveItemToCarrySocket))]
|
||||
public static bool ItemTool_MoveItemToCarrySocket(OWItem item)
|
||||
{
|
||||
var qsbObj = ItemManager.GetObject(item);
|
||||
var qsbObj = (IQSBOWItem)QSBWorldSync.GetWorldFromUnity(item);
|
||||
var itemId = QSBWorldSync.GetIdFromTypeSubset(qsbObj);
|
||||
QSBPlayerManager.LocalPlayer.HeldItem = qsbObj;
|
||||
QSBEventManager.FireEvent(EventNames.QSBMoveToCarry, itemId);
|
||||
@ -29,8 +31,8 @@ namespace QSB.ItemSync.Patches
|
||||
[HarmonyPatch(typeof(ItemTool), nameof(ItemTool.SocketItem))]
|
||||
public static bool ItemTool_SocketItem(OWItem ____heldItem, OWItemSocket socket)
|
||||
{
|
||||
var qsbObj = ItemManager.GetObject(____heldItem);
|
||||
var socketId = QSBWorldSync.GetIdFromTypeSubset(ItemManager.GetObject(socket));
|
||||
var qsbObj = (IQSBOWItem)QSBWorldSync.GetWorldFromUnity(____heldItem);
|
||||
var socketId = QSBWorldSync.GetIdFromTypeSubset((IQSBOWItemSocket)QSBWorldSync.GetWorldFromUnity(socket));
|
||||
var itemId = QSBWorldSync.GetIdFromTypeSubset(qsbObj);
|
||||
QSBPlayerManager.LocalPlayer.HeldItem = null;
|
||||
QSBEventManager.FireEvent(EventNames.QSBSocketItem, socketId, itemId, SocketEventType.Socket);
|
||||
@ -41,9 +43,9 @@ namespace QSB.ItemSync.Patches
|
||||
[HarmonyPatch(typeof(ItemTool), nameof(ItemTool.StartUnsocketItem))]
|
||||
public static bool ItemTool_StartUnsocketItem(OWItemSocket socket)
|
||||
{
|
||||
var item = ItemManager.GetObject(socket.GetSocketedItem());
|
||||
var item = (IQSBOWItem)QSBWorldSync.GetWorldFromUnity(socket.GetSocketedItem());
|
||||
QSBPlayerManager.LocalPlayer.HeldItem = item;
|
||||
var socketId = QSBWorldSync.GetIdFromTypeSubset(ItemManager.GetObject(socket));
|
||||
var socketId = QSBWorldSync.GetIdFromTypeSubset((IQSBOWItemSocket)QSBWorldSync.GetWorldFromUnity(socket));
|
||||
QSBEventManager.FireEvent(EventNames.QSBSocketItem, socketId, 0, SocketEventType.StartUnsocket);
|
||||
return true;
|
||||
}
|
||||
@ -52,7 +54,7 @@ namespace QSB.ItemSync.Patches
|
||||
[HarmonyPatch(typeof(ItemTool), nameof(ItemTool.CompleteUnsocketItem))]
|
||||
public static bool ItemTool_CompleteUnsocketItem(OWItem ____heldItem)
|
||||
{
|
||||
var itemId = QSBWorldSync.GetIdFromTypeSubset(ItemManager.GetObject(____heldItem));
|
||||
var itemId = QSBWorldSync.GetIdFromTypeSubset((IQSBOWItem)QSBWorldSync.GetWorldFromUnity(____heldItem));
|
||||
QSBEventManager.FireEvent(EventNames.QSBSocketItem, 0, itemId, SocketEventType.CompleteUnsocket);
|
||||
return true;
|
||||
}
|
||||
@ -88,7 +90,7 @@ namespace QSB.ItemSync.Patches
|
||||
var parent = (customDropTarget == null)
|
||||
? targetRigidbody.transform
|
||||
: customDropTarget.GetItemDropTargetTransform(hit.collider.gameObject);
|
||||
var objectId = QSBWorldSync.GetIdFromTypeSubset(ItemManager.GetObject(____heldItem));
|
||||
var objectId = QSBWorldSync.GetIdFromTypeSubset((IQSBOWItem)QSBWorldSync.GetWorldFromUnity(____heldItem));
|
||||
____heldItem.DropItem(hit.point, hit.normal, parent, sector, customDropTarget);
|
||||
____heldItem = null;
|
||||
QSBPlayerManager.LocalPlayer.HeldItem = null;
|
||||
|
@ -1,7 +1,7 @@
|
||||
using QSB.WorldSync;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.ItemSync.WorldObjects
|
||||
namespace QSB.ItemSync.WorldObjects.Items
|
||||
{
|
||||
public interface IQSBOWItem : IWorldObjectTypeSubset
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace QSB.ItemSync.WorldObjects
|
||||
namespace QSB.ItemSync.WorldObjects.Items
|
||||
{
|
||||
internal class QSBNomaiConversationStone : QSBOWItem<NomaiConversationStone>
|
||||
{
|
@ -1,10 +1,12 @@
|
||||
using OWML.Utils;
|
||||
using QSB.ItemSync.WorldObjects.Sockets;
|
||||
using QSB.Player;
|
||||
using QSB.SectorSync.WorldObjects;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.ItemSync.WorldObjects
|
||||
namespace QSB.ItemSync.WorldObjects.Items
|
||||
{
|
||||
internal class QSBOWItem<T> : WorldObject<T>, IQSBOWItem
|
||||
where T : OWItem
|
||||
@ -18,13 +20,25 @@ namespace QSB.ItemSync.WorldObjects
|
||||
|
||||
public override void Init(T attachedObject, int id)
|
||||
{
|
||||
if (attachedObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - AttachedObject is null! Type:{GetType().Name}", OWML.Common.MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
InitialParent = attachedObject.transform.parent;
|
||||
InitialPosition = attachedObject.transform.localPosition;
|
||||
InitialRotation = attachedObject.transform.localRotation;
|
||||
InitialSector = QSBWorldSync.GetWorldFromUnity<QSBSector, Sector>(attachedObject.GetSector());
|
||||
if (InitialParent.GetComponent<OWItemSocket>() != null)
|
||||
InitialSector = QSBWorldSync.GetWorldFromUnity<QSBSector>(attachedObject.GetSector());
|
||||
|
||||
if (InitialParent == null)
|
||||
{
|
||||
var qsbObj = ItemManager.GetObject(InitialParent.GetComponent<OWItemSocket>());
|
||||
DebugLog.ToConsole($"Warning - InitialParent of {attachedObject.name} is null!", OWML.Common.MessageType.Warning);
|
||||
}
|
||||
|
||||
if (InitialParent?.GetComponent<OWItemSocket>() != null)
|
||||
{
|
||||
var qsbObj = (IQSBOWItemSocket)QSBWorldSync.GetWorldFromUnity(InitialParent.GetComponent<OWItemSocket>());
|
||||
InitialSocket = qsbObj;
|
||||
}
|
||||
|
||||
@ -76,10 +90,10 @@ namespace QSB.ItemSync.WorldObjects
|
||||
{
|
||||
AttachedObject.transform.SetParent(sector.transform);
|
||||
AttachedObject.transform.localScale = Vector3.one;
|
||||
var localDropNormal = AttachedObject.GetValue<Vector3>("_localDropNormal");
|
||||
var localDropNormal = AttachedObject._localDropNormal;
|
||||
var lhs = Quaternion.FromToRotation(AttachedObject.transform.TransformDirection(localDropNormal), normal);
|
||||
AttachedObject.transform.rotation = lhs * AttachedObject.transform.rotation;
|
||||
var localDropOffset = AttachedObject.GetValue<Vector3>("_localDropOffset");
|
||||
var localDropOffset = AttachedObject._localDropOffset;
|
||||
AttachedObject.transform.position = sector.transform.TransformPoint(position) + AttachedObject.transform.TransformDirection(localDropOffset);
|
||||
AttachedObject.SetSector(sector);
|
||||
AttachedObject.SetColliderActivation(true);
|
@ -1,4 +1,4 @@
|
||||
namespace QSB.ItemSync.WorldObjects
|
||||
namespace QSB.ItemSync.WorldObjects.Items
|
||||
{
|
||||
internal class QSBScrollItem : QSBOWItem<ScrollItem>
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace QSB.ItemSync.WorldObjects
|
||||
namespace QSB.ItemSync.WorldObjects.Items
|
||||
{
|
||||
internal class QSBSharedStone : QSBOWItem<SharedStone>
|
||||
{
|
21
QSB/ItemSync/WorldObjects/Items/QSBSimpleLanternItem.cs
Normal file
21
QSB/ItemSync/WorldObjects/Items/QSBSimpleLanternItem.cs
Normal file
@ -0,0 +1,21 @@
|
||||
namespace QSB.ItemSync.WorldObjects.Items
|
||||
{
|
||||
class QSBSimpleLanternItem : QSBOWItem<SimpleLanternItem>
|
||||
{
|
||||
public override void Init(SimpleLanternItem attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
|
||||
public override void PlaySocketAnimation()
|
||||
=> AttachedObject.PlaySocketAnimation();
|
||||
|
||||
public override void PlayUnsocketAnimation()
|
||||
=> AttachedObject.PlayUnsocketAnimation();
|
||||
|
||||
public override void OnCompleteUnsocket()
|
||||
=> AttachedObject.OnCompleteUnsocket();
|
||||
}
|
||||
}
|
21
QSB/ItemSync/WorldObjects/Items/QSBSlideReelItem.cs
Normal file
21
QSB/ItemSync/WorldObjects/Items/QSBSlideReelItem.cs
Normal file
@ -0,0 +1,21 @@
|
||||
namespace QSB.ItemSync.WorldObjects.Items
|
||||
{
|
||||
class QSBSlideReelItem : QSBOWItem<SlideReelItem>
|
||||
{
|
||||
public override void Init(SlideReelItem attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
|
||||
public override void PlaySocketAnimation()
|
||||
=> AttachedObject.PlaySocketAnimation();
|
||||
|
||||
public override void PlayUnsocketAnimation()
|
||||
=> AttachedObject.PlayUnsocketAnimation();
|
||||
|
||||
public override void OnCompleteUnsocket()
|
||||
=> AttachedObject.OnCompleteUnsocket();
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace QSB.ItemSync.WorldObjects
|
||||
namespace QSB.ItemSync.WorldObjects.Items
|
||||
{
|
||||
internal class QSBWarpCoreItem : QSBOWItem<WarpCoreItem>
|
||||
{
|
@ -1,6 +1,7 @@
|
||||
using QSB.WorldSync;
|
||||
using QSB.ItemSync.WorldObjects.Items;
|
||||
using QSB.WorldSync;
|
||||
|
||||
namespace QSB.ItemSync.WorldObjects
|
||||
namespace QSB.ItemSync.WorldObjects.Sockets
|
||||
{
|
||||
public interface IQSBOWItemSocket : IWorldObjectTypeSubset
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace QSB.ItemSync.WorldObjects
|
||||
namespace QSB.ItemSync.WorldObjects.Sockets
|
||||
{
|
||||
internal class QSBNomaiConversationStoneSocket : QSBOWItemSocket<NomaiConversationStoneSocket>
|
||||
{
|
27
QSB/ItemSync/WorldObjects/Sockets/QSBOWItemDoubleSocket.cs
Normal file
27
QSB/ItemSync/WorldObjects/Sockets/QSBOWItemDoubleSocket.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using QSB.ItemSync.WorldObjects.Items;
|
||||
using QSB.WorldSync;
|
||||
|
||||
namespace QSB.ItemSync.WorldObjects.Sockets
|
||||
{
|
||||
internal class QSBOWItemDoubleSocket<T> : WorldObject<T>, IQSBOWItemSocket
|
||||
where T : OWItemSocket
|
||||
{
|
||||
public override void Init(T attachedObject, int id) { }
|
||||
|
||||
public virtual bool AcceptsItem(IQSBOWItem item)
|
||||
{
|
||||
var itemType = item.GetItemType();
|
||||
var acceptableType = AttachedObject._acceptableType;
|
||||
return (itemType & acceptableType) == itemType;
|
||||
}
|
||||
|
||||
public virtual bool IsSocketOccupied()
|
||||
=> AttachedObject.IsSocketOccupied();
|
||||
|
||||
public virtual bool PlaceIntoSocket(IQSBOWItem item)
|
||||
=> AttachedObject.PlaceIntoSocket((OWItem)(item as IWorldObject).ReturnObject());
|
||||
|
||||
public virtual IQSBOWItem RemoveFromSocket()
|
||||
=> (IQSBOWItem)QSBWorldSync.GetWorldFromUnity(AttachedObject.RemoveFromSocket());
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
using OWML.Utils;
|
||||
using QSB.ItemSync.WorldObjects.Items;
|
||||
using QSB.WorldSync;
|
||||
|
||||
namespace QSB.ItemSync.WorldObjects
|
||||
namespace QSB.ItemSync.WorldObjects.Sockets
|
||||
{
|
||||
internal class QSBOWItemSocket<T> : WorldObject<T>, IQSBOWItemSocket
|
||||
where T : OWItemSocket
|
||||
@ -11,7 +11,7 @@ namespace QSB.ItemSync.WorldObjects
|
||||
public virtual bool AcceptsItem(IQSBOWItem item)
|
||||
{
|
||||
var itemType = item.GetItemType();
|
||||
var acceptableType = AttachedObject.GetValue<ItemType>("_acceptableType");
|
||||
var acceptableType = AttachedObject._acceptableType;
|
||||
return (itemType & acceptableType) == itemType;
|
||||
}
|
||||
|
||||
@ -22,6 +22,6 @@ namespace QSB.ItemSync.WorldObjects
|
||||
=> AttachedObject.PlaceIntoSocket((OWItem)(item as IWorldObject).ReturnObject());
|
||||
|
||||
public virtual IQSBOWItem RemoveFromSocket()
|
||||
=> ItemManager.GetObject(AttachedObject.RemoveFromSocket());
|
||||
=> (IQSBOWItem)QSBWorldSync.GetWorldFromUnity(AttachedObject.RemoveFromSocket());
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace QSB.ItemSync.WorldObjects
|
||||
namespace QSB.ItemSync.WorldObjects.Sockets
|
||||
{
|
||||
internal class QSBScrollSocket : QSBOWItemSocket<ScrollSocket>
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace QSB.ItemSync.WorldObjects
|
||||
namespace QSB.ItemSync.WorldObjects.Sockets
|
||||
{
|
||||
internal class QSBSharedStoneSocket : QSBOWItemSocket<SharedStoneSocket>
|
||||
{
|
17
QSB/ItemSync/WorldObjects/Sockets/QSBSlideProjectorSocket.cs
Normal file
17
QSB/ItemSync/WorldObjects/Sockets/QSBSlideProjectorSocket.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace QSB.ItemSync.WorldObjects.Sockets
|
||||
{
|
||||
internal class QSBSlideProjectorSocket : QSBOWItemDoubleSocket<SlideProjectorSocket>
|
||||
{
|
||||
public override void Init(SlideProjectorSocket attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
}
|
||||
}
|
17
QSB/ItemSync/WorldObjects/Sockets/QSBSlideReelSocket.cs
Normal file
17
QSB/ItemSync/WorldObjects/Sockets/QSBSlideReelSocket.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace QSB.ItemSync.WorldObjects.Sockets
|
||||
{
|
||||
internal class QSBSlideReelSocket : QSBOWItemSocket<SlideReelSocket>
|
||||
{
|
||||
public override void Init(SlideReelSocket attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace QSB.ItemSync.WorldObjects
|
||||
namespace QSB.ItemSync.WorldObjects.Sockets
|
||||
{
|
||||
internal class QSBWarpCoreSocket : QSBOWItemSocket<WarpCoreSocket>
|
||||
{
|
@ -27,7 +27,7 @@ namespace QSB.Player
|
||||
if (_previousCollidingQuantumObject != collidingQuantumObject)
|
||||
{
|
||||
var objectIndex = (collidingQuantumObject != null)
|
||||
? QSBWorldSync.GetIdFromTypeSubset(QuantumManager.GetObject(collidingQuantumObject))
|
||||
? QSBWorldSync.GetIdFromTypeSubset((IQSBQuantumObject)QSBWorldSync.GetWorldFromUnity(collidingQuantumObject))
|
||||
: -1;
|
||||
|
||||
QSBEventManager.FireEvent(
|
||||
|
@ -4,6 +4,7 @@ using QSB.Animation.Player.Thrusters;
|
||||
using QSB.CampfireSync.WorldObjects;
|
||||
using QSB.ClientServerStateSync;
|
||||
using QSB.ItemSync.WorldObjects;
|
||||
using QSB.ItemSync.WorldObjects.Items;
|
||||
using QSB.Player.TransformSync;
|
||||
using QSB.ProbeSync;
|
||||
using QSB.QuantumSync;
|
||||
@ -94,6 +95,10 @@ namespace QSB.Player
|
||||
public Transform SharedStoneSocket => CameraBody.transform.Find("REMOTE_SharedStoneSocket");
|
||||
public Transform WarpCoreSocket => CameraBody.transform.Find("REMOTE_WarpCoreSocket");
|
||||
public Transform VesselCoreSocket => CameraBody.transform.Find("REMOTE_VesselCoreSocket");
|
||||
public Transform SimpleLanternSocket => CameraBody.transform.Find("REMOTE_SimpleLanternSocket");
|
||||
public Transform DreamLanternSocket => CameraBody.transform.Find("REMOTE_DreamLanternSocket");
|
||||
public Transform SlideReelSocket => CameraBody.transform.Find("REMOTE_SlideReelSocket");
|
||||
public Transform VisionTorchSocket => CameraBody.transform.Find("REMOTE_VisionTorchSocket");
|
||||
public QSBMarshmallow Marshmallow { get; set; }
|
||||
public QSBCampfire Campfire { get; set; }
|
||||
public IQSBOWItem HeldItem { get; set; }
|
||||
|
@ -1,5 +1,5 @@
|
||||
using OWML.Common;
|
||||
using QSB.ItemSync.WorldObjects;
|
||||
using QSB.ItemSync.WorldObjects.Items;
|
||||
using QSB.Player.Events;
|
||||
using QSB.Player.TransformSync;
|
||||
using QSB.Tools;
|
||||
|
@ -105,6 +105,11 @@
|
||||
<Compile Include="Instruments\QSBCamera\CameraManager.cs" />
|
||||
<Compile Include="Instruments\QSBCamera\CameraMode.cs" />
|
||||
<Compile Include="Instruments\InstrumentsManager.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Items\QSBSimpleLanternItem.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Items\QSBSlideReelItem.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Sockets\QSBOWItemDoubleSocket.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Sockets\QSBSlideProjectorSocket.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Sockets\QSBSlideReelSocket.cs" />
|
||||
<Compile Include="Menus\IMenuAPI.cs" />
|
||||
<Compile Include="Menus\MenuManager.cs" />
|
||||
<Compile Include="Messaging\BoolMessage.cs" />
|
||||
@ -126,18 +131,18 @@
|
||||
<Compile Include="ItemSync\Patches\ItemPatches.cs" />
|
||||
<Compile Include="ItemSync\SocketEventType.cs" />
|
||||
<Compile Include="PoolSync\CustomNomaiRemoteCamera.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\IQSBOWItem.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\IQSBOWItemSocket.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\QSBNomaiConversationStone.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\QSBNomaiConversationStoneSocket.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\QSBOWItem.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\QSBOWItemSocket.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\QSBScrollItem.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\QSBScrollSocket.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\QSBSharedStone.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\QSBSharedStoneSocket.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\QSBWarpCoreItem.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\QSBWarpCoreSocket.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Items\IQSBOWItem.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Sockets\IQSBOWItemSocket.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Items\QSBNomaiConversationStone.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Sockets\QSBNomaiConversationStoneSocket.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Items\QSBOWItem.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Sockets\QSBOWItemSocket.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Items\QSBScrollItem.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Sockets\QSBScrollSocket.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Items\QSBSharedStone.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Sockets\QSBSharedStoneSocket.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Items\QSBWarpCoreItem.cs" />
|
||||
<Compile Include="ItemSync\WorldObjects\Sockets\QSBWarpCoreSocket.cs" />
|
||||
<Compile Include="LogSync\Events\RevealFactEvent.cs" />
|
||||
<Compile Include="LogSync\Events\RevealFactMessage.cs" />
|
||||
<Compile Include="LogSync\Patches\LogPatches.cs" />
|
||||
|
@ -40,7 +40,7 @@ namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
if (WorldObjectManager.AllReady)
|
||||
{
|
||||
var socketedWorldObject = QSBWorldSync.GetWorldFromUnity<QSBSocketedQuantumObject, SocketedQuantumObject>(__instance);
|
||||
var socketedWorldObject = QSBWorldSync.GetWorldFromUnity<QSBSocketedQuantumObject>(__instance);
|
||||
if (socketedWorldObject.ControllingPlayer != QSBPlayerManager.LocalPlayerId)
|
||||
{
|
||||
return false;
|
||||
@ -154,8 +154,8 @@ namespace QSB.QuantumSync.Patches
|
||||
return;
|
||||
}
|
||||
|
||||
var objectWorldObject = QSBWorldSync.GetWorldFromUnity<QSBSocketedQuantumObject, SocketedQuantumObject>(__instance);
|
||||
var socketWorldObject = QSBWorldSync.GetWorldFromUnity<QSBQuantumSocket, QuantumSocket>(socket);
|
||||
var objectWorldObject = QSBWorldSync.GetWorldFromUnity<QSBSocketedQuantumObject>(__instance);
|
||||
var socketWorldObject = QSBWorldSync.GetWorldFromUnity<QSBQuantumSocket>(socket);
|
||||
|
||||
if (objectWorldObject == null)
|
||||
{
|
||||
@ -187,7 +187,7 @@ namespace QSB.QuantumSync.Patches
|
||||
QSBQuantumShuffleObject shuffleWorldObject = default;
|
||||
if (WorldObjectManager.AllReady)
|
||||
{
|
||||
shuffleWorldObject = QSBWorldSync.GetWorldFromUnity<QSBQuantumShuffleObject, QuantumShuffleObject>(__instance);
|
||||
shuffleWorldObject = QSBWorldSync.GetWorldFromUnity<QSBQuantumShuffleObject>(__instance);
|
||||
if (shuffleWorldObject.ControllingPlayer != QSBPlayerManager.LocalPlayerId)
|
||||
{
|
||||
return false;
|
||||
@ -230,7 +230,7 @@ namespace QSB.QuantumSync.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBMultiStateQuantumObject, MultiStateQuantumObject>(__instance);
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBMultiStateQuantumObject>(__instance);
|
||||
if (qsbObj.ControllingPlayer == 0)
|
||||
{
|
||||
return true;
|
||||
@ -266,7 +266,7 @@ namespace QSB.QuantumSync.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBMultiStateQuantumObject, MultiStateQuantumObject>(__instance);
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBMultiStateQuantumObject>(__instance);
|
||||
if (qsbObj.ControllingPlayer == 0 && qsbObj.CurrentState == -1)
|
||||
{
|
||||
return true;
|
||||
@ -291,7 +291,7 @@ namespace QSB.QuantumSync.Patches
|
||||
}
|
||||
|
||||
var allMultiStates = QSBWorldSync.GetWorldObjects<QSBMultiStateQuantumObject>();
|
||||
var stateObject = QSBWorldSync.GetWorldFromUnity<QSBQuantumState, QuantumState>(__instance);
|
||||
var stateObject = QSBWorldSync.GetWorldFromUnity<QSBQuantumState>(__instance);
|
||||
var owner = allMultiStates.FirstOrDefault(x => x.QuantumStates.Contains(stateObject));
|
||||
if (owner == default)
|
||||
{
|
||||
@ -363,7 +363,7 @@ namespace QSB.QuantumSync.Patches
|
||||
[HarmonyPatch(typeof(QuantumShrine), nameof(QuantumShrine.ChangeQuantumState))]
|
||||
public static bool QuantumShrine_ChangeQuantumState(QuantumShrine __instance)
|
||||
{
|
||||
var shrineWorldObject = QSBWorldSync.GetWorldFromUnity<QSBSocketedQuantumObject, SocketedQuantumObject>(__instance);
|
||||
var shrineWorldObject = QSBWorldSync.GetWorldFromUnity<QSBSocketedQuantumObject>(__instance);
|
||||
var isInControl = shrineWorldObject.ControllingPlayer == QSBPlayerManager.LocalPlayerId;
|
||||
return isInControl;
|
||||
}
|
||||
|
@ -132,39 +132,8 @@ namespace QSB.QuantumSync
|
||||
return Enumerable.Empty<PlayerInfo>();
|
||||
}
|
||||
|
||||
var worldObj = GetObject(obj);
|
||||
var worldObj = (IQSBQuantumObject)QSBWorldSync.GetWorldFromUnity(obj);
|
||||
return QSBPlayerManager.PlayerList.Where(x => x.EntangledObject == worldObj);
|
||||
}
|
||||
|
||||
public static IQSBQuantumObject GetObject(QuantumObject unityObject)
|
||||
{
|
||||
IQSBQuantumObject worldObj = null;
|
||||
if (unityObject.GetType() == typeof(SocketedQuantumObject) || unityObject.GetType() == typeof(QuantumShrine))
|
||||
{
|
||||
worldObj = QSBWorldSync.GetWorldFromUnity<QSBSocketedQuantumObject, SocketedQuantumObject>((SocketedQuantumObject)unityObject);
|
||||
}
|
||||
else if (unityObject.GetType() == typeof(MultiStateQuantumObject))
|
||||
{
|
||||
worldObj = QSBWorldSync.GetWorldFromUnity<QSBMultiStateQuantumObject, MultiStateQuantumObject>((MultiStateQuantumObject)unityObject);
|
||||
}
|
||||
else if (unityObject.GetType() == typeof(QuantumShuffleObject))
|
||||
{
|
||||
worldObj = QSBWorldSync.GetWorldFromUnity<QSBQuantumShuffleObject, QuantumShuffleObject>((QuantumShuffleObject)unityObject);
|
||||
}
|
||||
else if (unityObject.GetType() == typeof(QuantumMoon))
|
||||
{
|
||||
worldObj = QSBWorldSync.GetWorldFromUnity<QSBQuantumMoon, QuantumMoon>((QuantumMoon)unityObject);
|
||||
}
|
||||
else if (unityObject.GetType() == typeof(EyeProxyQuantumMoon))
|
||||
{
|
||||
worldObj = QSBWorldSync.GetWorldFromUnity<QSBEyeProxyQuantumMoon, EyeProxyQuantumMoon>((EyeProxyQuantumMoon)unityObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - couldn't work out type of QuantumObject {unityObject.name}.", MessageType.Warning);
|
||||
}
|
||||
|
||||
return worldObj;
|
||||
}
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
|
||||
public override void PostInit()
|
||||
{
|
||||
QuantumStates = AttachedObject._states.ToList().Select(x => QSBWorldSync.GetWorldFromUnity<QSBQuantumState, QuantumState>(x)).ToList();
|
||||
QuantumStates = AttachedObject._states.ToList().Select(x => QSBWorldSync.GetWorldFromUnity<QSBQuantumState>(x)).ToList();
|
||||
|
||||
if (QuantumStates.Any(x => x == null))
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ namespace QSB.RoastingSync.Events
|
||||
return;
|
||||
}
|
||||
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBCampfire, Campfire>(campfire);
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBCampfire>(campfire);
|
||||
SendEvent(CreateMessage(qsbObj.ObjectId, roasting));
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ namespace QSB.SectorSync
|
||||
|
||||
private void AddSector(Sector sector)
|
||||
{
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBSector, Sector>(sector);
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBSector>(sector);
|
||||
if (worldObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Can't find QSBSector for sector {sector.name}!", MessageType.Error);
|
||||
@ -95,7 +95,7 @@ namespace QSB.SectorSync
|
||||
|
||||
private void RemoveSector(Sector sector)
|
||||
{
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBSector, Sector>(sector);
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBSector>(sector);
|
||||
if (worldObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Can't find QSBSector for sector {sector.name}!", MessageType.Error);
|
||||
|
@ -16,7 +16,7 @@ namespace QSB.ShipSync.Events.Component
|
||||
|
||||
private WorldObjectMessage CreateMessage(ShipComponent hull)
|
||||
{
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipComponent, ShipComponent>(hull);
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipComponent>(hull);
|
||||
return new WorldObjectMessage
|
||||
{
|
||||
AboutId = LocalPlayerId,
|
||||
|
@ -15,7 +15,7 @@ namespace QSB.ShipSync.Events.Component
|
||||
|
||||
private RepairTickMessage CreateMessage(ShipComponent hull, float repairFraction)
|
||||
{
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipComponent, ShipComponent>(hull);
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipComponent>(hull);
|
||||
return new RepairTickMessage
|
||||
{
|
||||
AboutId = LocalPlayerId,
|
||||
|
@ -16,7 +16,7 @@ namespace QSB.ShipSync.Events.Component
|
||||
|
||||
private WorldObjectMessage CreateMessage(ShipComponent hull)
|
||||
{
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipComponent, ShipComponent>(hull);
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipComponent>(hull);
|
||||
return new WorldObjectMessage
|
||||
{
|
||||
AboutId = LocalPlayerId,
|
||||
|
@ -15,7 +15,7 @@ namespace QSB.ShipSync.Events.Hull
|
||||
|
||||
private HullChangeIntegrityMessage CreateMessage(ShipHull hull, float integrity)
|
||||
{
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipHull, ShipHull>(hull);
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipHull>(hull);
|
||||
return new HullChangeIntegrityMessage
|
||||
{
|
||||
AboutId = LocalPlayerId,
|
||||
|
@ -16,7 +16,7 @@ namespace QSB.ShipSync.Events.Hull
|
||||
|
||||
private WorldObjectMessage CreateMessage(ShipHull hull)
|
||||
{
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipHull, ShipHull>(hull);
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipHull>(hull);
|
||||
return new WorldObjectMessage
|
||||
{
|
||||
AboutId = LocalPlayerId,
|
||||
|
@ -15,7 +15,7 @@ namespace QSB.ShipSync.Events.Hull
|
||||
|
||||
private HullImpactMessage CreateMessage(ShipHull hull, ImpactData data, float damage)
|
||||
{
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipHull, ShipHull>(hull);
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipHull>(hull);
|
||||
return new HullImpactMessage
|
||||
{
|
||||
AboutId = LocalPlayerId,
|
||||
|
@ -15,7 +15,7 @@ namespace QSB.ShipSync.Events.Hull
|
||||
|
||||
private RepairTickMessage CreateMessage(ShipHull hull, float repairFraction)
|
||||
{
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipHull, ShipHull>(hull);
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipHull>(hull);
|
||||
return new RepairTickMessage
|
||||
{
|
||||
AboutId = LocalPlayerId,
|
||||
|
@ -16,7 +16,7 @@ namespace QSB.ShipSync.Events.Hull
|
||||
|
||||
private WorldObjectMessage CreateMessage(ShipHull hull)
|
||||
{
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipHull, ShipHull>(hull);
|
||||
var worldObject = QSBWorldSync.GetWorldFromUnity<QSBShipHull>(hull);
|
||||
return new WorldObjectMessage
|
||||
{
|
||||
AboutId = LocalPlayerId,
|
||||
|
@ -212,6 +212,30 @@ namespace QSB.Tools
|
||||
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 simpleLantern = new GameObject("REMOTE_SimpleLanternSocket");
|
||||
simpleLantern.transform.parent = cameraBody;
|
||||
simpleLantern.transform.localPosition = new Vector3(0.242997f, -0.18f, 0.2620007f);
|
||||
simpleLantern.transform.localRotation = Quaternion.Euler(0f, 33f, 0f);
|
||||
simpleLantern.transform.localScale = new Vector3(0.33f, 0.33f, 0.33f);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
private static void CreateFlashlight(Transform cameraBody)
|
||||
|
@ -53,7 +53,7 @@ namespace QSB.Tools.ProbeLauncherTool.Patches
|
||||
|
||||
if (__instance != QSBPlayerManager.LocalPlayer.LocalProbeLauncher)
|
||||
{
|
||||
QSBEventManager.FireEvent(EventNames.QSBRetrieveProbe, QSBWorldSync.GetWorldFromUnity<QSBProbeLauncher, ProbeLauncher>(__instance), playEffects);
|
||||
QSBEventManager.FireEvent(EventNames.QSBRetrieveProbe, QSBWorldSync.GetWorldFromUnity<QSBProbeLauncher>(__instance), playEffects);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ namespace QSB.TranslationSync.Patches
|
||||
QSBEventManager.FireEvent(
|
||||
EventNames.QSBTextTranslated,
|
||||
NomaiTextType.WallText,
|
||||
QSBWorldSync.GetIdFromUnity<QSBWallText, NomaiWallText>(__instance),
|
||||
QSBWorldSync.GetIdFromUnity<QSBWallText>(__instance),
|
||||
id);
|
||||
return true;
|
||||
}
|
||||
@ -40,7 +40,7 @@ namespace QSB.TranslationSync.Patches
|
||||
QSBEventManager.FireEvent(
|
||||
EventNames.QSBTextTranslated,
|
||||
NomaiTextType.Computer,
|
||||
QSBWorldSync.GetIdFromUnity<QSBComputer, NomaiComputer>(__instance),
|
||||
QSBWorldSync.GetIdFromUnity<QSBComputer>(__instance),
|
||||
id);
|
||||
return true;
|
||||
}
|
||||
@ -57,7 +57,7 @@ namespace QSB.TranslationSync.Patches
|
||||
QSBEventManager.FireEvent(
|
||||
EventNames.QSBTextTranslated,
|
||||
NomaiTextType.VesselComputer,
|
||||
QSBWorldSync.GetIdFromUnity<QSBVesselComputer, NomaiVesselComputer>(__instance),
|
||||
QSBWorldSync.GetIdFromUnity<QSBVesselComputer>(__instance),
|
||||
id);
|
||||
return true;
|
||||
}
|
||||
|
@ -33,9 +33,7 @@ namespace QSB.WorldSync
|
||||
return GetWorldObjects<TWorldObject>().ToList()[id];
|
||||
}
|
||||
|
||||
public static TWorldObject GetWorldFromUnity<TWorldObject, TUnityObject>(TUnityObject unityObject)
|
||||
where TWorldObject : WorldObject<TUnityObject>
|
||||
where TUnityObject : MonoBehaviour
|
||||
public static IWorldObject GetWorldFromUnity(MonoBehaviour unityObject)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
{
|
||||
@ -44,37 +42,73 @@ namespace QSB.WorldSync
|
||||
|
||||
if (unityObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Trying to run GetWorldFromUnity with a null unity object! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{typeof(TUnityObject).Name}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - Trying to run GetWorldFromUnity with a null unity object! TUnityObject:NULL", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
if (!QSBCore.IsInMultiplayer)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Trying to run GetWorldFromUnity while not in multiplayer! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{typeof(TUnityObject).Name}", MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - Trying to run GetWorldFromUnity while not in multiplayer! TUnityObject:{unityObject.GetType().Name}", MessageType.Warning);
|
||||
return default;
|
||||
}
|
||||
|
||||
if (!WorldObjectsToUnityObjects.ContainsKey(unityObject))
|
||||
{
|
||||
DebugLog.ToConsole($"Error - WorldObjectsToUnityObjects does not contain \"{unityObject.name}\"! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{typeof(TUnityObject).Name}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - WorldObjectsToUnityObjects does not contain \"{unityObject.name}\"! TUnityObject:{unityObject.GetType().Name}", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
var returnObject = WorldObjectsToUnityObjects[unityObject] as TWorldObject;
|
||||
var returnObject = WorldObjectsToUnityObjects[unityObject];
|
||||
|
||||
if (returnObject == default || returnObject == null)
|
||||
if (returnObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - World object for unity object {unityObject.name} is null! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{typeof(TUnityObject).Name}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - World object for unity object {unityObject.name} is null! TUnityObject:{unityObject.GetType().Name}", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
return (IWorldObject)returnObject;
|
||||
}
|
||||
|
||||
public static TWorldObject GetWorldFromUnity<TWorldObject>(MonoBehaviour unityObject)
|
||||
where TWorldObject : IWorldObject
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
if (unityObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Trying to run GetWorldFromUnity with a null unity object! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:NULL", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
if (!QSBCore.IsInMultiplayer)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Trying to run GetWorldFromUnity while not in multiplayer! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}", MessageType.Warning);
|
||||
return default;
|
||||
}
|
||||
|
||||
if (!WorldObjectsToUnityObjects.ContainsKey(unityObject))
|
||||
{
|
||||
DebugLog.ToConsole($"Error - WorldObjectsToUnityObjects does not contain \"{unityObject.name}\"! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
var returnObject = (TWorldObject)WorldObjectsToUnityObjects[unityObject];
|
||||
|
||||
if (returnObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - World object for unity object {unityObject.name} is null! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
return returnObject;
|
||||
}
|
||||
|
||||
public static int GetIdFromUnity<TWorldObject, TUnityObject>(TUnityObject unityObject)
|
||||
where TWorldObject : WorldObject<TUnityObject>
|
||||
where TUnityObject : MonoBehaviour
|
||||
=> GetWorldFromUnity<TWorldObject, TUnityObject>(unityObject).ObjectId;
|
||||
public static int GetIdFromUnity<TWorldObject>(MonoBehaviour unityObject)
|
||||
where TWorldObject : IWorldObject
|
||||
=> GetWorldFromUnity<TWorldObject>(unityObject).ObjectId;
|
||||
|
||||
public static int GetIdFromTypeSubset<TTypeSubset>(TTypeSubset typeSubset)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user