mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-30 03:32:47 +00:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
1e1d565be4
Binary file not shown.
@ -0,0 +1,13 @@
|
|||||||
|
using QSB.ItemSync.WorldObjects.Items;
|
||||||
|
using QSB.Messaging;
|
||||||
|
using QSB.Patches;
|
||||||
|
|
||||||
|
namespace QSB.EchoesOfTheEye.DreamLantern.Messages;
|
||||||
|
|
||||||
|
internal class DreamLanternLitMessage : QSBWorldObjectMessage<QSBDreamLanternItem, bool>
|
||||||
|
{
|
||||||
|
public DreamLanternLitMessage(bool lit) : base(lit) { }
|
||||||
|
|
||||||
|
public override void OnReceiveRemote()
|
||||||
|
=> QSBPatch.RemoteCall(() => WorldObject.AttachedObject.SetLit(Data));
|
||||||
|
}
|
@ -12,8 +12,6 @@ internal class DreamLanternStateMessage : QSBMessage<(DreamLanternActionType Typ
|
|||||||
|
|
||||||
public override void OnReceiveRemote()
|
public override void OnReceiveRemote()
|
||||||
{
|
{
|
||||||
DebugLog.DebugWrite($"{From} Action:{Data.Type} BoolValue:{Data.BoolValue} FloatValue:{Data.FloatValue}");
|
|
||||||
|
|
||||||
var heldItem = QSBPlayerManager.GetPlayer(From).HeldItem;
|
var heldItem = QSBPlayerManager.GetPlayer(From).HeldItem;
|
||||||
|
|
||||||
if (heldItem is not QSBDreamLanternItem lantern)
|
if (heldItem is not QSBDreamLanternItem lantern)
|
||||||
|
@ -4,6 +4,7 @@ using QSB.ItemSync.WorldObjects.Items;
|
|||||||
using QSB.Messaging;
|
using QSB.Messaging;
|
||||||
using QSB.Patches;
|
using QSB.Patches;
|
||||||
using QSB.Player;
|
using QSB.Player;
|
||||||
|
using QSB.WorldSync;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -91,4 +92,16 @@ internal class DreamLanternPatches : QSBPatch
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(DreamLanternItem), nameof(DreamLanternItem.SetLit))]
|
||||||
|
public static void SetLit(DreamLanternItem __instance, bool lit)
|
||||||
|
{
|
||||||
|
if (Remote)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
__instance.GetWorldObject<QSBDreamLanternItem>().SendMessage(new DreamLanternLitMessage(lit));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
using QSB.ItemSync.WorldObjects.Items;
|
||||||
|
using QSB.Messaging;
|
||||||
|
using QSB.Player;
|
||||||
|
using QSB.WorldSync;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace QSB.EchoesOfTheEye.DreamWorld.Messages;
|
||||||
|
|
||||||
|
internal class EnterDreamWorldMessage : QSBMessage<int>
|
||||||
|
{
|
||||||
|
public EnterDreamWorldMessage(int lanternId) : base(lanternId) { }
|
||||||
|
|
||||||
|
public override void OnReceiveRemote()
|
||||||
|
{
|
||||||
|
var player = QSBPlayerManager.GetPlayer(From);
|
||||||
|
player.InDreamWorld = true;
|
||||||
|
player.AssignedSimulationLantern = QSBWorldSync.GetWorldObject<QSBDreamLanternItem>(Data);
|
||||||
|
}
|
||||||
|
}
|
27
QSB/EchoesOfTheEye/DreamWorld/Patches/DreamWorldPatches.cs
Normal file
27
QSB/EchoesOfTheEye/DreamWorld/Patches/DreamWorldPatches.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using QSB.EchoesOfTheEye.DreamWorld.Messages;
|
||||||
|
using QSB.ItemSync.WorldObjects.Items;
|
||||||
|
using QSB.Messaging;
|
||||||
|
using QSB.Patches;
|
||||||
|
using QSB.WorldSync;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace QSB.EchoesOfTheEye.DreamWorld.Patches;
|
||||||
|
|
||||||
|
internal class DreamWorldPatches : QSBPatch
|
||||||
|
{
|
||||||
|
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||||
|
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(DreamWorldController), nameof(DreamWorldController.SpawnInDreamWorld))]
|
||||||
|
public static void EnterDreamWorld()
|
||||||
|
{
|
||||||
|
var currentLantern = (DreamLanternItem)Locator.GetToolModeSwapper().GetItemCarryTool().GetHeldItem();
|
||||||
|
var currentQSBLantern = currentLantern.GetWorldObject<QSBDreamLanternItem>();
|
||||||
|
new EnterDreamWorldMessage(currentQSBLantern.ObjectId).Send();
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
using QSB.ItemSync.WorldObjects.Items;
|
using QSB.ItemSync.WorldObjects.Items;
|
||||||
using QSB.Messaging;
|
using QSB.Messaging;
|
||||||
using QSB.Player;
|
using QSB.Player;
|
||||||
|
using QSB.Utility;
|
||||||
|
|
||||||
namespace QSB.ItemSync.Messages;
|
namespace QSB.ItemSync.Messages;
|
||||||
|
|
||||||
@ -27,6 +28,7 @@ internal class MoveToCarryMessage : QSBWorldObjectMessage<IQSBItem>
|
|||||||
ItemType.VisionTorch => player.VisionTorchSocket,
|
ItemType.VisionTorch => player.VisionTorchSocket,
|
||||||
_ => player.ItemSocket
|
_ => player.ItemSocket
|
||||||
};
|
};
|
||||||
|
|
||||||
WorldObject.PickUpItem(itemSocket);
|
WorldObject.PickUpItem(itemSocket);
|
||||||
|
|
||||||
switch (itemType)
|
switch (itemType)
|
||||||
@ -55,10 +57,9 @@ internal class MoveToCarryMessage : QSBWorldObjectMessage<IQSBItem>
|
|||||||
player.AnimationSync.VisibleAnimator.SetTrigger("HoldLantern");
|
player.AnimationSync.VisibleAnimator.SetTrigger("HoldLantern");
|
||||||
break;
|
break;
|
||||||
case ItemType.SlideReel:
|
case ItemType.SlideReel:
|
||||||
break;
|
|
||||||
case ItemType.DreamLantern:
|
case ItemType.DreamLantern:
|
||||||
break;
|
|
||||||
case ItemType.VisionTorch:
|
case ItemType.VisionTorch:
|
||||||
|
DebugLog.ToConsole($"Warning - {itemType} has no implemented holding pose.", OWML.Common.MessageType.Warning);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
namespace QSB.ItemSync.WorldObjects.Items;
|
namespace QSB.ItemSync.WorldObjects.Items;
|
||||||
|
|
||||||
internal class QSBDreamLanternItem : QSBItem<DreamLanternItem> { }
|
public class QSBDreamLanternItem : QSBItem<DreamLanternItem> { }
|
@ -9,7 +9,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace QSB.ItemSync.WorldObjects.Items;
|
namespace QSB.ItemSync.WorldObjects.Items;
|
||||||
|
|
||||||
internal class QSBItem<T> : WorldObject<T>, IQSBItem
|
public class QSBItem<T> : WorldObject<T>, IQSBItem
|
||||||
where T : OWItem
|
where T : OWItem
|
||||||
{
|
{
|
||||||
private Transform _lastParent;
|
private Transform _lastParent;
|
||||||
|
14
QSB/Player/PlayerInfoParts/DreamWorld.cs
Normal file
14
QSB/Player/PlayerInfoParts/DreamWorld.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using QSB.ItemSync.WorldObjects.Items;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace QSB.Player;
|
||||||
|
|
||||||
|
public partial class PlayerInfo
|
||||||
|
{
|
||||||
|
public bool InDreamWorld { get; set; }
|
||||||
|
public QSBDreamLanternItem AssignedSimulationLantern { get; set; }
|
||||||
|
}
|
@ -1,10 +1,12 @@
|
|||||||
using QSB.CampfireSync.WorldObjects;
|
using OWML.Common;
|
||||||
|
using QSB.CampfireSync.WorldObjects;
|
||||||
using QSB.ItemSync.WorldObjects.Items;
|
using QSB.ItemSync.WorldObjects.Items;
|
||||||
using QSB.RoastingSync;
|
using QSB.RoastingSync;
|
||||||
using QSB.Tools;
|
using QSB.Tools;
|
||||||
using QSB.Tools.FlashlightTool;
|
using QSB.Tools.FlashlightTool;
|
||||||
using QSB.Tools.ProbeLauncherTool;
|
using QSB.Tools.ProbeLauncherTool;
|
||||||
using QSB.Tools.ProbeTool;
|
using QSB.Tools.ProbeTool;
|
||||||
|
using QSB.Utility;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace QSB.Player;
|
namespace QSB.Player;
|
||||||
@ -44,15 +46,35 @@ public partial class PlayerInfo
|
|||||||
return _handPivot;
|
return _handPivot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Transform ItemSocket => HandPivot.Find("REMOTE_ItemSocket");
|
public Transform ItemSocket => GetSocket("REMOTE_ItemSocket");
|
||||||
public Transform ScrollSocket => HandPivot.Find("REMOTE_ScrollSocket");
|
public Transform ScrollSocket => GetSocket("REMOTE_ScrollSocket");
|
||||||
public Transform SharedStoneSocket => HandPivot.Find("REMOTE_SharedStoneSocket");
|
public Transform SharedStoneSocket => GetSocket("REMOTE_SharedStoneSocket");
|
||||||
public Transform WarpCoreSocket => HandPivot.Find("REMOTE_WarpCoreSocket");
|
public Transform WarpCoreSocket => GetSocket("REMOTE_WarpCoreSocket");
|
||||||
public Transform VesselCoreSocket => HandPivot.Find("REMOTE_VesselCoreSocket");
|
public Transform VesselCoreSocket => GetSocket("REMOTE_VesselCoreSocket");
|
||||||
public Transform SimpleLanternSocket => HandPivot.Find("REMOTE_SimpleLanternSocket");
|
public Transform SimpleLanternSocket => GetSocket("REMOTE_SimpleLanternSocket");
|
||||||
public Transform DreamLanternSocket => HandPivot.Find("REMOTE_DreamLanternSocket");
|
public Transform DreamLanternSocket => GetSocket("REMOTE_DreamLanternSocket");
|
||||||
public Transform SlideReelSocket => HandPivot.Find("REMOTE_SlideReelSocket");
|
public Transform SlideReelSocket => GetSocket("REMOTE_SlideReelSocket");
|
||||||
public Transform VisionTorchSocket => HandPivot.Find("REMOTE_VisionTorchSocket");
|
public Transform VisionTorchSocket => GetSocket("REMOTE_VisionTorchSocket");
|
||||||
|
|
||||||
|
private Transform GetSocket(string name)
|
||||||
|
{
|
||||||
|
var handSocket = HandPivot.Find(name);
|
||||||
|
if (handSocket != null)
|
||||||
|
{
|
||||||
|
return handSocket;
|
||||||
|
}
|
||||||
|
|
||||||
|
var cameraSocket = CameraBody.transform.Find("REMOTE_ItemCarryTool").Find(name);
|
||||||
|
if (cameraSocket != null)
|
||||||
|
{
|
||||||
|
DebugLog.ToConsole($"Warning - Could not find hand socket for socket name {name}, defaulting to camera socket.", MessageType.Warning);
|
||||||
|
return cameraSocket;
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugLog.ToConsole($"Error - Could not find hand socket or camera socket for socket name {name}.", MessageType.Error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public QSBMarshmallow Marshmallow { get; set; }
|
public QSBMarshmallow Marshmallow { get; set; }
|
||||||
public QSBCampfire Campfire { get; set; }
|
public QSBCampfire Campfire { get; set; }
|
||||||
public IQSBItem HeldItem { get; set; }
|
public IQSBItem HeldItem { get; set; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user