Skip to content

Commit

Permalink
Merge pull request #626 from misternebula/dev
Browse files Browse the repository at this point in the history
0.28.1
  • Loading branch information
misternebula authored Jun 22, 2023
2 parents 992851a + 1fdefbb commit 03bcc60
Show file tree
Hide file tree
Showing 71 changed files with 450 additions and 297 deletions.
9 changes: 6 additions & 3 deletions MirrorWeaver/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@ public static void Main(string[] args)

var log = new ConsoleLogger();
var weaver = new Weaver(log);
if (!weaver.Weave(assembly, resolver, out _))
if (!weaver.Weave(assembly, resolver, out var modified))
{
Environment.Exit(1);
}

assembly.Write(new WriterParameters { WriteSymbols = assembly.MainModule.HasSymbols });
if (modified)
{
assembly.Write(new WriterParameters { WriteSymbols = assembly.MainModule.HasSymbols });
}
}
}
}
3 changes: 2 additions & 1 deletion MirrorWeaver/QSBReaderWriterProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static class QSBReaderWriterProcessor
/// traverses from non generic classes up thru base types
/// in order to replace generic parameters with their corresponding generic arguments.
/// </summary>
public static void Process(ModuleDefinition module, Writers writers, Readers readers, ref bool weavingFailed)
public static bool Process(ModuleDefinition module, Writers writers, Readers readers, ref bool weavingFailed)
{
var sw = Stopwatch.StartNew();

Expand Down Expand Up @@ -85,5 +85,6 @@ argType is GenericParameter genericParameter &&
}

Console.WriteLine($"got/generated {count} read/write funcs in {sw.ElapsedMilliseconds} ms");
return count > 0;
}
}
2 changes: 1 addition & 1 deletion MirrorWeaver/Weaver/Weaver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public bool Weave(AssemblyDefinition assembly, IAssemblyResolver resolver, out b
Console.WriteLine($"Script Module: {moduleDefinition.Name}");

// CHANGED
QSBReaderWriterProcessor.Process(moduleDefinition, writers, readers, ref WeavingFailed);
modified |= QSBReaderWriterProcessor.Process(moduleDefinition, writers, readers, ref WeavingFailed);

modified |= WeaveModule(moduleDefinition);

Expand Down
12 changes: 6 additions & 6 deletions QSB/Anglerfish/TransformSync/AnglerTransformSync.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using QSB.Anglerfish.WorldObjects;
using QSB.AuthoritySync;
using QSB.OwnershipSync;
using QSB.Syncs.Unsectored.Rigidbodies;
using QSB.Utility.LinkedWorldObject;
using QSB.WorldSync;
Expand All @@ -22,7 +22,7 @@ public override void OnStartClient()
{
if (QSBCore.IsHost)
{
netIdentity.RegisterAuthQueue();
netIdentity.RegisterOwnerQueue();
}

base.OnStartClient();
Expand All @@ -32,7 +32,7 @@ public override void OnStopClient()
{
if (QSBCore.IsHost)
{
netIdentity.UnregisterAuthQueue();
netIdentity.UnregisterOwnerQueue();
}

base.OnStopClient();
Expand All @@ -48,7 +48,7 @@ protected override void Init()

AttachedRigidbody.OnUnsuspendOWRigidbody += OnUnsuspend;
AttachedRigidbody.OnSuspendOWRigidbody += OnSuspend;
netIdentity.UpdateAuthQueue(AttachedRigidbody.IsSuspended() ? AuthQueueAction.Remove : AuthQueueAction.Add);
netIdentity.UpdateOwnerQueue(AttachedRigidbody.IsSuspended() ? OwnerQueueAction.Remove : OwnerQueueAction.Add);
}

protected override void Uninit()
Expand All @@ -59,8 +59,8 @@ protected override void Uninit()
AttachedRigidbody.OnSuspendOWRigidbody -= OnSuspend;
}

private void OnUnsuspend(OWRigidbody suspendedBody) => netIdentity.UpdateAuthQueue(AuthQueueAction.Add);
private void OnSuspend(OWRigidbody suspendedBody) => netIdentity.UpdateAuthQueue(AuthQueueAction.Remove);
private void OnUnsuspend(OWRigidbody suspendedBody) => netIdentity.UpdateOwnerQueue(OwnerQueueAction.Add);
private void OnSuspend(OWRigidbody suspendedBody) => netIdentity.UpdateOwnerQueue(OwnerQueueAction.Remove);

protected override void OnRenderObject()
{
Expand Down
2 changes: 1 addition & 1 deletion QSB/Anglerfish/WorldObjects/QSBAngler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class QSBAngler : LinkedWorldObject<AnglerfishController, AnglerTransform
private Vector3 _lastTargetPosition;

protected override GameObject NetworkObjectPrefab => QSBNetworkManager.singleton.AnglerPrefab;
protected override bool SpawnWithServerAuthority => false;
protected override bool SpawnWithServerOwnership => false;

public override void SendInitialState(uint to) =>
this.SendMessage(new AnglerDataMessage(this) { To = to });
Expand Down
2 changes: 1 addition & 1 deletion QSB/Animation/Player/AnimationSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void InitRemote(Transform body)
private void InitAccelerationSync()
{
Player.JetpackAcceleration = GetComponent<JetpackAccelerationSync>();
var thrusterModel = hasAuthority ? Locator.GetPlayerBody().GetComponent<ThrusterModel>() : null;
var thrusterModel = isOwned ? Locator.GetPlayerBody().GetComponent<ThrusterModel>() : null;
Player.JetpackAcceleration.Init(thrusterModel);
}

Expand Down
Binary file modified QSB/AssetBundles/qsb_hud
Binary file not shown.
93 changes: 0 additions & 93 deletions QSB/AuthoritySync/AuthorityManager.cs

This file was deleted.

32 changes: 0 additions & 32 deletions QSB/AuthoritySync/IAuthWorldObject_Extensions.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using HarmonyLib;
using QSB.AuthoritySync;
using QSB.EchoesOfTheEye.AlarmTotemSync.Messages;
using QSB.EchoesOfTheEye.AlarmTotemSync.WorldObjects;
using QSB.Messaging;
using QSB.OwnershipSync;
using QSB.Patches;
using QSB.Player;
using QSB.Utility;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using QSB.AuthoritySync;
using QSB.EchoesOfTheEye.AlarmTotemSync.Messages;
using QSB.EchoesOfTheEye.AlarmTotemSync.Messages;
using QSB.Messaging;
using QSB.OwnershipSync;

namespace QSB.EchoesOfTheEye.AlarmTotemSync.WorldObjects;

public class QSBAlarmTotem : AuthWorldObject<AlarmTotem>
public class QSBAlarmTotem : OwnedWorldObject<AlarmTotem>
{
public override bool CanOwn => AttachedObject.enabled;

Expand Down
6 changes: 3 additions & 3 deletions QSB/EchoesOfTheEye/DreamRafts/Patches/DreamRaftPatches.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using HarmonyLib;
using QSB.AuthoritySync;
using QSB.EchoesOfTheEye.DreamCandles.Patches;
using QSB.EchoesOfTheEye.DreamObjectProjectors.WorldObject;
using QSB.EchoesOfTheEye.DreamRafts.Messages;
using QSB.EchoesOfTheEye.DreamRafts.WorldObjects;
using QSB.Messaging;
using QSB.OwnershipSync;
using QSB.Patches;
using QSB.WorldSync;

Expand Down Expand Up @@ -75,10 +75,10 @@ private static bool ExtinguishDreamRaft(DreamWorldController __instance)

if (__instance._lastUsedRaftProjector)
{
// still release authority over the raft tho
// still release ownership over the raft tho
__instance._lastUsedRaftProjector
._dreamRaftProjection.GetComponent<DreamRaftController>().GetWorldObject<QSBDreamRaft>()
.NetworkBehaviour.netIdentity.UpdateAuthQueue(AuthQueueAction.Remove);
.NetworkBehaviour.netIdentity.UpdateOwnerQueue(OwnerQueueAction.Remove);
}

return false;
Expand Down
2 changes: 1 addition & 1 deletion QSB/EchoesOfTheEye/DreamRafts/WorldObjects/QSBDreamRaft.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ namespace QSB.EchoesOfTheEye.DreamRafts.WorldObjects;
public class QSBDreamRaft : LinkedWorldObject<DreamRaftController, RaftTransformSync>
{
protected override GameObject NetworkObjectPrefab => QSBNetworkManager.singleton.RaftPrefab;
protected override bool SpawnWithServerAuthority => false;
protected override bool SpawnWithServerOwnership => false;
}
2 changes: 1 addition & 1 deletion QSB/EchoesOfTheEye/DreamRafts/WorldObjects/QSBSealRaft.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ namespace QSB.EchoesOfTheEye.DreamRafts.WorldObjects;
public class QSBSealRaft : LinkedWorldObject<SealRaftController, RaftTransformSync>
{
protected override GameObject NetworkObjectPrefab => QSBNetworkManager.singleton.RaftPrefab;
protected override bool SpawnWithServerAuthority => false;
protected override bool SpawnWithServerOwnership => false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal class QSBEclipseDoorController : QSBRotatingElements<EclipseDoorControl
protected override IEnumerable<SingleLightSensor> LightSensors => AttachedObject._lightSensors;

public override string ReturnLabel()
=> $"{base.ReturnLabel()}\r\n- SyncerValue:{NetworkBehaviour.Value?.Join()}\r\n- HasAuth:{NetworkBehaviour.hasAuthority}";
=> $"{base.ReturnLabel()}\r\n- SyncerValue:{NetworkBehaviour.Value?.Join()}\r\n- IsOwned:{NetworkBehaviour.isOwned}";

protected override GameObject NetworkObjectPrefab => QSBNetworkManager.singleton.DoorPrefab;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal class QSBEclipseElevatorController : QSBRotatingElements<EclipseElevato
protected override IEnumerable<SingleLightSensor> LightSensors => AttachedObject._lightSensors;

public override string ReturnLabel()
=> $"{base.ReturnLabel()}\r\n- SyncerValue:{NetworkBehaviour.Value?.Join()}\r\n- HasAuth:{NetworkBehaviour.hasAuthority}";
=> $"{base.ReturnLabel()}\r\n- SyncerValue:{NetworkBehaviour.Value?.Join()}\r\n- IsOwned:{NetworkBehaviour.isOwned}";

protected override GameObject NetworkObjectPrefab => QSBNetworkManager.singleton.ElevatorPrefab;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using HarmonyLib;
using QSB.AuthoritySync;
using QSB.EchoesOfTheEye.LightSensorSync.Messages;
using QSB.EchoesOfTheEye.LightSensorSync.WorldObjects;
using QSB.Messaging;
using QSB.OwnershipSync;
using QSB.Patches;
using QSB.Player;
using QSB.Tools.FlashlightTool;
Expand Down
2 changes: 1 addition & 1 deletion QSB/EchoesOfTheEye/LightSensorSync/QSBPlayerLightSensor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace QSB.EchoesOfTheEye.LightSensorSync;
/// only purpose is to handle initial state sync.
///
/// we don't have to worry about start illuminated or sectors.
/// authority is always given to local player light sensor.
/// ownership is always given to local player light sensor.
///
/// 2 uses:
/// - AlarmTotem.CheckPlayerVisible
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Cysharp.Threading.Tasks;
using QSB.AuthoritySync;
using QSB.EchoesOfTheEye.LightSensorSync.Messages;
using QSB.Messaging;
using QSB.OwnershipSync;
using QSB.Utility;
using QSB.WorldSync;
using System;
Expand All @@ -14,7 +14,7 @@

namespace QSB.EchoesOfTheEye.LightSensorSync.WorldObjects;

internal class QSBLightSensor : AuthWorldObject<SingleLightSensor>
internal class QSBLightSensor : OwnedWorldObject<SingleLightSensor>
{
internal bool _locallyIlluminated;

Expand Down
8 changes: 4 additions & 4 deletions QSB/EchoesOfTheEye/QSBRotatingElements.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Cysharp.Threading.Tasks;
using Mirror;
using QSB.AuthoritySync;
using QSB.EchoesOfTheEye.LightSensorSync.WorldObjects;
using QSB.OwnershipSync;
using QSB.Utility.LinkedWorldObject;
using QSB.WorldSync;
using System.Collections.Generic;
Expand Down Expand Up @@ -52,7 +52,7 @@ private void OnDetectLocalLight()
_litSensors++;
if (_litSensors == 1)
{
NetworkBehaviour.netIdentity.UpdateAuthQueue(AuthQueueAction.Add);
NetworkBehaviour.netIdentity.UpdateOwnerQueue(OwnerQueueAction.Add);
}
}

Expand All @@ -61,9 +61,9 @@ private void OnDetectLocalDarkness()
_litSensors--;
if (_litSensors == 0)
{
NetworkBehaviour.netIdentity.UpdateAuthQueue(AuthQueueAction.Remove);
NetworkBehaviour.netIdentity.UpdateOwnerQueue(OwnerQueueAction.Remove);
}
}

protected override bool SpawnWithServerAuthority => false;
protected override bool SpawnWithServerOwnership => false;
}
Loading

0 comments on commit 03bcc60

Please sign in to comment.