mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-30 03:32:47 +00:00
rafts: the beginning of initial state
This commit is contained in:
parent
21050a3f09
commit
cd42606d3b
14
QSB/EchoesOfTheEye/RaftSync/Messages/RaftSetDockMessage.cs
Normal file
14
QSB/EchoesOfTheEye/RaftSync/Messages/RaftSetDockMessage.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using QSB.EchoesOfTheEye.RaftSync.WorldObjects;
|
||||||
|
using QSB.Messaging;
|
||||||
|
using QSB.WorldSync;
|
||||||
|
|
||||||
|
namespace QSB.EchoesOfTheEye.RaftSync.Messages;
|
||||||
|
|
||||||
|
public class RaftSetDockMessage : QSBWorldObjectMessage<QSBRaft, int>
|
||||||
|
{
|
||||||
|
public RaftSetDockMessage(RaftCarrier raftCarrier) :
|
||||||
|
base(raftCarrier != null ? raftCarrier.GetWorldObject<IQSBRaftCarrier>().ObjectId : -1) { }
|
||||||
|
|
||||||
|
public override void OnReceiveRemote() =>
|
||||||
|
WorldObject.SetDock(Data != -1 ? Data.GetWorldObject<IQSBRaftCarrier>() : null);
|
||||||
|
}
|
@ -16,7 +16,7 @@ public class RaftPatches : QSBPatch
|
|||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(RaftController), nameof(RaftController.OnPressInteract))]
|
[HarmonyPatch(typeof(RaftController), nameof(RaftController.OnPressInteract))]
|
||||||
private static bool OnPressInteract(RaftController __instance)
|
private static bool RaftController_OnPressInteract(RaftController __instance)
|
||||||
{
|
{
|
||||||
__instance._interactReceiver.SetInteractionEnabled(false);
|
__instance._interactReceiver.SetInteractionEnabled(false);
|
||||||
|
|
||||||
@ -35,6 +35,6 @@ public class RaftPatches : QSBPatch
|
|||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(RaftDock), nameof(RaftDock.OnPressInteract))]
|
[HarmonyPatch(typeof(RaftDock), nameof(RaftDock.OnPressInteract))]
|
||||||
private static void OnPressInteract(RaftDock __instance) =>
|
private static void RaftDock_OnPressInteract(RaftDock __instance) =>
|
||||||
__instance.GetWorldObject<QSBRaftDock>().SendMessage(new RaftDockOnPressInteractMessage());
|
__instance.GetWorldObject<QSBRaftDock>().SendMessage(new RaftDockOnPressInteractMessage());
|
||||||
}
|
}
|
||||||
|
@ -22,4 +22,4 @@ public class RaftManager : WorldObjectManager
|
|||||||
QSBWorldSync.Init<QSBRaftDock, RaftDock>();
|
QSBWorldSync.Init<QSBRaftDock, RaftDock>();
|
||||||
QSBWorldSync.Init<QSBDamRaftLift, DamRaftLift>();
|
QSBWorldSync.Init<QSBDamRaftLift, DamRaftLift>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
using QSB.WorldSync;
|
|
||||||
|
|
||||||
namespace QSB.EchoesOfTheEye.RaftSync.WorldObjects;
|
|
||||||
|
|
||||||
public interface IQSBRaftCarrier : IWorldObject { }
|
|
@ -1,11 +1,3 @@
|
|||||||
using QSB.WorldSync;
|
namespace QSB.EchoesOfTheEye.RaftSync.WorldObjects;
|
||||||
|
|
||||||
namespace QSB.EchoesOfTheEye.RaftSync.WorldObjects;
|
public class QSBDamRaftLift : QSBRaftCarrier<DamRaftLift> { }
|
||||||
|
|
||||||
public class QSBDamRaftLift : WorldObject<DamRaftLift>, IQSBRaftCarrier
|
|
||||||
{
|
|
||||||
public override void SendInitialState(uint to)
|
|
||||||
{
|
|
||||||
// todo SendInitialState
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
using Mirror;
|
using Mirror;
|
||||||
using QSB.AuthoritySync;
|
using QSB.AuthoritySync;
|
||||||
using QSB.EchoesOfTheEye.LightSensorSync.WorldObjects;
|
using QSB.EchoesOfTheEye.LightSensorSync.WorldObjects;
|
||||||
|
using QSB.EchoesOfTheEye.RaftSync.Messages;
|
||||||
using QSB.EchoesOfTheEye.RaftSync.TransformSync;
|
using QSB.EchoesOfTheEye.RaftSync.TransformSync;
|
||||||
|
using QSB.Messaging;
|
||||||
|
using QSB.Utility;
|
||||||
using QSB.WorldSync;
|
using QSB.WorldSync;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -57,13 +60,11 @@ public class QSBRaft : WorldObject<RaftController>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SendInitialState(uint to)
|
public override void SendInitialState(uint to) =>
|
||||||
{
|
this.SendMessage(new RaftSetDockMessage(AttachedObject._dock));
|
||||||
// todo?? SendInitialState
|
|
||||||
|
|
||||||
if (AttachedObject._dock != null)
|
public void SetDock(IQSBRaftCarrier qsbRaftCarrier)
|
||||||
{
|
{
|
||||||
var qsbRaftCarrier = AttachedObject._dock.GetWorldObject<IQSBRaftCarrier>();
|
DebugLog.DebugWrite($"TODO: {this} dock = {qsbRaftCarrier}");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
QSB/EchoesOfTheEye/RaftSync/WorldObjects/QSBRaftCarrier.cs
Normal file
13
QSB/EchoesOfTheEye/RaftSync/WorldObjects/QSBRaftCarrier.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using QSB.WorldSync;
|
||||||
|
|
||||||
|
namespace QSB.EchoesOfTheEye.RaftSync.WorldObjects;
|
||||||
|
|
||||||
|
public abstract class QSBRaftCarrier<T> : WorldObject<T>, IQSBRaftCarrier where T : RaftCarrier
|
||||||
|
{
|
||||||
|
public override void SendInitialState(uint to)
|
||||||
|
{
|
||||||
|
// todo SendInitialState
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IQSBRaftCarrier : IWorldObject { }
|
@ -1,14 +1,7 @@
|
|||||||
using QSB.WorldSync;
|
namespace QSB.EchoesOfTheEye.RaftSync.WorldObjects;
|
||||||
|
|
||||||
namespace QSB.EchoesOfTheEye.RaftSync.WorldObjects;
|
public class QSBRaftDock : QSBRaftCarrier<RaftDock>
|
||||||
|
|
||||||
public class QSBRaftDock : WorldObject<RaftDock>, IQSBRaftCarrier
|
|
||||||
{
|
{
|
||||||
public override void SendInitialState(uint to)
|
|
||||||
{
|
|
||||||
// todo SendInitialState
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnPressInteract()
|
public void OnPressInteract()
|
||||||
{
|
{
|
||||||
if (AttachedObject._raft != null && AttachedObject._state == RaftCarrier.DockState.Docked)
|
if (AttachedObject._raft != null && AttachedObject._state == RaftCarrier.DockState.Docked)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user