dont trigger mind stuff if a remote player is projecting

This commit is contained in:
JohnCorby 2022-10-11 01:01:25 -07:00
parent eeadd3ff4f
commit ffeb5e7a37
3 changed files with 21 additions and 0 deletions

View File

@ -9,6 +9,7 @@ public class VisionTorchProjectMessage : QSBWorldObjectMessage<QSBVisionTorchIte
public override void OnReceiveRemote()
{
WorldObject.AttachedObject._isProjecting = Data;
WorldObject.IsProjectingRemotely = Data;
WorldObject.AttachedObject._mindProjectorTrigger.SetProjectorActive(Data);
}
}

View File

@ -42,4 +42,22 @@ public class VisionTorchPatches : QSBPatch
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(MindProjectorTrigger), nameof(MindProjectorTrigger.OnTriggerVolumeEntry))]
private static bool OnTriggerVolumeEntry(MindProjectorTrigger __instance)
{
if (!QSBWorldSync.AllObjectsReady)
{
return true;
}
var visionTorchItem = __instance.GetComponentInParent<VisionTorchItem>();
if (visionTorchItem && visionTorchItem.GetWorldObject<QSBVisionTorchItem>().IsProjectingRemotely)
{
return false;
}
return true;
}
}

View File

@ -6,6 +6,8 @@ namespace QSB.EchoesOfTheEye.VisionTorch.WorldObjects;
public class QSBVisionTorchItem : QSBItem<VisionTorchItem>
{
public bool IsProjectingRemotely;
public override void SendInitialState(uint to)
{
this.SendMessage(new VisionTorchProjectMessage(AttachedObject._isProjecting) { To = to });