grapple totem: only work for local illumination

This commit is contained in:
JohnCorby 2022-04-05 23:08:30 -07:00
parent 1af1f5c8c7
commit 1338251ae1
3 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,15 @@
using Cysharp.Threading.Tasks;
using QSB.EchoesOfTheEye.GrappleTotemSync.WorldObjects;
using QSB.WorldSync;
using System.Threading;
namespace QSB.EchoesOfTheEye.GrappleTotemSync;
public class GrappleTotemManager : WorldObjectManager
{
public override WorldObjectScene WorldObjectScene => WorldObjectScene.SolarSystem;
public override bool DlcOnly => true;
public override async UniTask BuildWorldObjects(OWScene scene, CancellationToken ct) =>
QSBWorldSync.Init<QSBGrappleTotem, LanternZoomPoint>();
}

View File

@ -0,0 +1,17 @@
using HarmonyLib;
using QSB.EchoesOfTheEye.LightSensorSync.WorldObjects;
using QSB.Patches;
using QSB.WorldSync;
namespace QSB.EchoesOfTheEye.GrappleTotemSync.Patches;
public class GrappleTotemPatches : QSBPatch
{
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
[HarmonyPrefix]
[HarmonyPatch(typeof(LanternZoomPoint), nameof(LanternZoomPoint.OnDetectLight))]
private static bool OnDetectLight(LanternZoomPoint __instance) =>
!QSBWorldSync.AllObjectsReady ||
__instance._lightSensor.GetWorldObject<QSBLightSensor>().IlluminatedByLocal;
}

View File

@ -0,0 +1,13 @@
using QSB.WorldSync;
namespace QSB.EchoesOfTheEye.GrappleTotemSync.WorldObjects;
public class QSBGrappleTotem : WorldObject<LanternZoomPoint>
{
public override void SendInitialState(uint to) { }
/// <summary>
/// todo grapple visuals
/// </summary>
public void DoGrappleAnimation() { }
}