mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-29 09:32:38 +00:00
Sync DreamLantern sounds + rename QSBDreamLantern to QSBDreamLanternController
This commit is contained in:
parent
30256a18eb
commit
096b295eb1
@ -33,4 +33,20 @@ internal class PlayerAudioControllerPatches : QSBPatch
|
|||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.PlayRefuel))]
|
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.PlayRefuel))]
|
||||||
public static void PlayerAudioController_PlayRefuel() => PlayOneShot(AudioType.ShipCabinUseRefueller);
|
public static void PlayerAudioController_PlayRefuel() => PlayOneShot(AudioType.ShipCabinUseRefueller);
|
||||||
|
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.OnArtifactFocus))]
|
||||||
|
public static void PlayerAudioController_OnArtifactFocus() => PlayOneShot(AudioType.Artifact_Focus);
|
||||||
|
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.OnArtifactUnfocus))]
|
||||||
|
public static void PlayerAudioController_OnArtifactUnfocus() => PlayOneShot(AudioType.Artifact_Unfocus);
|
||||||
|
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.OnArtifactConceal))]
|
||||||
|
public static void PlayerAudioController_OnArtifactConceal() => PlayOneShot(AudioType.Artifact_Conceal);
|
||||||
|
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.OnArtifactUnconceal))]
|
||||||
|
public static void PlayerAudioController_OnArtifactUnconceal() => PlayOneShot(AudioType.Artifact_Unconceal);
|
||||||
}
|
}
|
@ -11,5 +11,5 @@ public class DreamLanternManager : WorldObjectManager
|
|||||||
public override bool DlcOnly => true;
|
public override bool DlcOnly => true;
|
||||||
|
|
||||||
public override async UniTask BuildWorldObjects(OWScene scene, CancellationToken ct) =>
|
public override async UniTask BuildWorldObjects(OWScene scene, CancellationToken ct) =>
|
||||||
QSBWorldSync.Init<QSBDreamLantern, DreamLanternController>();
|
QSBWorldSync.Init<QSBDreamLanternController, DreamLanternController>();
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,10 @@ using QSB.Messaging;
|
|||||||
|
|
||||||
namespace QSB.EchoesOfTheEye.DreamLantern.Messages;
|
namespace QSB.EchoesOfTheEye.DreamLantern.Messages;
|
||||||
|
|
||||||
internal class SetConcealedMessage : QSBWorldObjectMessage<QSBDreamLantern, bool>
|
internal class SetConcealedMessage : QSBWorldObjectMessage<QSBDreamLanternController, bool>
|
||||||
{
|
{
|
||||||
public SetConcealedMessage(bool concealed) : base(concealed) { }
|
public SetConcealedMessage(bool concealed) : base(concealed) { }
|
||||||
|
|
||||||
public override void OnReceiveRemote()
|
public override void OnReceiveRemote() =>
|
||||||
=> WorldObject.AttachedObject.SetConcealed(Data);
|
WorldObject.AttachedObject.SetConcealed(Data);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ using QSB.Messaging;
|
|||||||
|
|
||||||
namespace QSB.EchoesOfTheEye.DreamLantern.Messages;
|
namespace QSB.EchoesOfTheEye.DreamLantern.Messages;
|
||||||
|
|
||||||
internal class SetFocusMessage : QSBWorldObjectMessage<QSBDreamLantern, float>
|
internal class SetFocusMessage : QSBWorldObjectMessage<QSBDreamLanternController, float>
|
||||||
{
|
{
|
||||||
public SetFocusMessage(float focus) : base(focus) { }
|
public SetFocusMessage(float focus) : base(focus) { }
|
||||||
|
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
using QSB.EchoesOfTheEye.DreamLantern.WorldObjects;
|
using QSB.EchoesOfTheEye.DreamLantern.WorldObjects;
|
||||||
using QSB.Messaging;
|
using QSB.Messaging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace QSB.EchoesOfTheEye.DreamLantern.Messages;
|
namespace QSB.EchoesOfTheEye.DreamLantern.Messages;
|
||||||
|
|
||||||
internal class SetLitMessage : QSBWorldObjectMessage<QSBDreamLantern, bool>
|
internal class SetLitMessage : QSBWorldObjectMessage<QSBDreamLanternController, bool>
|
||||||
{
|
{
|
||||||
public SetLitMessage(bool lit) : base(lit) { }
|
public SetLitMessage(bool lit) : base(lit) { }
|
||||||
|
|
||||||
public override void OnReceiveRemote()
|
public override void OnReceiveRemote()
|
||||||
=> WorldObject.AttachedObject.SetLit(Data);
|
{
|
||||||
|
WorldObject.AttachedObject.SetLit(Data);
|
||||||
|
WorldObject.DreamLanternItem._oneShotSource.PlayOneShot(Data ? AudioType.Artifact_Light : AudioType.Artifact_Extinguish, 1f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ using QSB.Messaging;
|
|||||||
|
|
||||||
namespace QSB.EchoesOfTheEye.DreamLantern.Messages;
|
namespace QSB.EchoesOfTheEye.DreamLantern.Messages;
|
||||||
|
|
||||||
internal class SetRangeMessage : QSBWorldObjectMessage<QSBDreamLantern, (float minRange, float maxRange)>
|
internal class SetRangeMessage : QSBWorldObjectMessage<QSBDreamLanternController, (float minRange, float maxRange)>
|
||||||
{
|
{
|
||||||
public SetRangeMessage(float minRange, float maxRange) : base((minRange, maxRange)) { }
|
public SetRangeMessage(float minRange, float maxRange) : base((minRange, maxRange)) { }
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ internal class DreamLanternPatches : QSBPatch
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var qsbDreamLantern = __instance.GetWorldObject<QSBDreamLantern>();
|
var qsbDreamLantern = __instance.GetWorldObject<QSBDreamLanternController>();
|
||||||
// ghost lanterns should only be controlled by the host
|
// ghost lanterns should only be controlled by the host
|
||||||
if (qsbDreamLantern.IsGhostLantern && !QSBCore.IsHost)
|
if (qsbDreamLantern.IsGhostLantern && !QSBCore.IsHost)
|
||||||
{
|
{
|
||||||
@ -59,7 +59,7 @@ internal class DreamLanternPatches : QSBPatch
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var qsbDreamLantern = __instance.GetWorldObject<QSBDreamLantern>();
|
var qsbDreamLantern = __instance.GetWorldObject<QSBDreamLanternController>();
|
||||||
// ghost lanterns should only be controlled by the host
|
// ghost lanterns should only be controlled by the host
|
||||||
if (qsbDreamLantern.IsGhostLantern && !QSBCore.IsHost)
|
if (qsbDreamLantern.IsGhostLantern && !QSBCore.IsHost)
|
||||||
{
|
{
|
||||||
@ -88,7 +88,7 @@ internal class DreamLanternPatches : QSBPatch
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var qsbDreamLantern = __instance.GetWorldObject<QSBDreamLantern>();
|
var qsbDreamLantern = __instance.GetWorldObject<QSBDreamLanternController>();
|
||||||
// ghost lanterns should only be controlled by the host
|
// ghost lanterns should only be controlled by the host
|
||||||
if (qsbDreamLantern.IsGhostLantern && !QSBCore.IsHost)
|
if (qsbDreamLantern.IsGhostLantern && !QSBCore.IsHost)
|
||||||
{
|
{
|
||||||
@ -116,7 +116,7 @@ internal class DreamLanternPatches : QSBPatch
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var qsbDreamLantern = __instance.GetWorldObject<QSBDreamLantern>();
|
var qsbDreamLantern = __instance.GetWorldObject<QSBDreamLanternController>();
|
||||||
// ghost lanterns should only be controlled by the host
|
// ghost lanterns should only be controlled by the host
|
||||||
if (qsbDreamLantern.IsGhostLantern && !QSBCore.IsHost)
|
if (qsbDreamLantern.IsGhostLantern && !QSBCore.IsHost)
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,26 @@
|
|||||||
using QSB.EchoesOfTheEye.DreamLantern.Messages;
|
using Cysharp.Threading.Tasks;
|
||||||
|
using QSB.EchoesOfTheEye.DreamLantern.Messages;
|
||||||
using QSB.Messaging;
|
using QSB.Messaging;
|
||||||
using QSB.WorldSync;
|
using QSB.WorldSync;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace QSB.EchoesOfTheEye.DreamLantern.WorldObjects;
|
namespace QSB.EchoesOfTheEye.DreamLantern.WorldObjects;
|
||||||
|
|
||||||
public class QSBDreamLantern : WorldObject<DreamLanternController>
|
public class QSBDreamLanternController : WorldObject<DreamLanternController>
|
||||||
{
|
{
|
||||||
|
public DreamLanternItem DreamLanternItem { get; private set; }
|
||||||
|
|
||||||
|
public override async UniTask Init(CancellationToken ct)
|
||||||
|
{
|
||||||
|
await base.Init(ct);
|
||||||
|
|
||||||
|
// Ghosts don't have the item and instead the effects are controlled by GhostEffects
|
||||||
|
if (!IsGhostLantern)
|
||||||
|
{
|
||||||
|
DreamLanternItem = AttachedObject.GetComponent<DreamLanternItem>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void SendInitialState(uint to)
|
public override void SendInitialState(uint to)
|
||||||
{
|
{
|
||||||
this.SendMessage(new SetLitMessage(AttachedObject._lit) { To = to });
|
this.SendMessage(new SetLitMessage(AttachedObject._lit) { To = to });
|
@ -10,12 +10,12 @@ namespace QSB.EchoesOfTheEye.LightSensorSync.Messages;
|
|||||||
internal class IlluminatingLanternsMessage : QSBWorldObjectMessage<QSBLightSensor, int[]>
|
internal class IlluminatingLanternsMessage : QSBWorldObjectMessage<QSBLightSensor, int[]>
|
||||||
{
|
{
|
||||||
public IlluminatingLanternsMessage(IEnumerable<DreamLanternController> lanterns) :
|
public IlluminatingLanternsMessage(IEnumerable<DreamLanternController> lanterns) :
|
||||||
base(lanterns.Select(x => x.GetWorldObject<QSBDreamLantern>().ObjectId).ToArray()) { }
|
base(lanterns.Select(x => x.GetWorldObject<QSBDreamLanternController>().ObjectId).ToArray()) { }
|
||||||
|
|
||||||
public override void OnReceiveRemote()
|
public override void OnReceiveRemote()
|
||||||
{
|
{
|
||||||
WorldObject.AttachedObject._illuminatingDreamLanternList.Clear();
|
WorldObject.AttachedObject._illuminatingDreamLanternList.Clear();
|
||||||
WorldObject.AttachedObject._illuminatingDreamLanternList.AddRange(
|
WorldObject.AttachedObject._illuminatingDreamLanternList.AddRange(
|
||||||
Data.Select(x => x.GetWorldObject<QSBDreamLantern>().AttachedObject));
|
Data.Select(x => x.GetWorldObject<QSBDreamLanternController>().AttachedObject));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ internal class PlayerIlluminatingLanternsMessage : QSBMessage<(uint playerId, in
|
|||||||
public PlayerIlluminatingLanternsMessage(uint playerId, IEnumerable<DreamLanternController> lanterns) :
|
public PlayerIlluminatingLanternsMessage(uint playerId, IEnumerable<DreamLanternController> lanterns) :
|
||||||
base((
|
base((
|
||||||
playerId,
|
playerId,
|
||||||
lanterns.Select(x => x.GetWorldObject<QSBDreamLantern>().ObjectId).ToArray()
|
lanterns.Select(x => x.GetWorldObject<QSBDreamLanternController>().ObjectId).ToArray()
|
||||||
)) { }
|
)) { }
|
||||||
|
|
||||||
public override void OnReceiveRemote()
|
public override void OnReceiveRemote()
|
||||||
@ -21,6 +21,6 @@ internal class PlayerIlluminatingLanternsMessage : QSBMessage<(uint playerId, in
|
|||||||
|
|
||||||
lightSensor._illuminatingDreamLanternList.Clear();
|
lightSensor._illuminatingDreamLanternList.Clear();
|
||||||
lightSensor._illuminatingDreamLanternList.AddRange(
|
lightSensor._illuminatingDreamLanternList.AddRange(
|
||||||
Data.lanterns.Select(x => x.GetWorldObject<QSBDreamLantern>().AttachedObject));
|
Data.lanterns.Select(x => x.GetWorldObject<QSBDreamLanternController>().AttachedObject));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user