Seems to be fully working

This commit is contained in:
2026-01-15 00:02:26 +01:00
parent 3f7122d30a
commit 0bbf7c2a30
4 changed files with 189 additions and 48 deletions

View File

@@ -1,13 +1,18 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Assets.Scripts;
using Assets.Scripts.Objects.Electrical;
using HarmonyLib;
using JetBrains.Annotations;
using RemoteControl.Message;
using Swan;
using GameDevice = Assets.Scripts.Objects.Pipes.Device;
namespace RemoteControl.Patches
{
[HarmonyPatch(typeof(LogicStack), nameof(LogicStack.LogicStackTick))]
[HarmonyPatch(typeof(RoomController), nameof(RoomController.ThreadedWork))]
[SuppressMessage("ReSharper", "InconsistentNaming")]
// ReSharper disable once InconsistentNaming
public class LogicStack_LogicStackTick
@@ -17,7 +22,8 @@ namespace RemoteControl.Patches
internal object LockObj;
internal bool Taken;
}
[UsedImplicitly]
private static void Prefix(out State __state)
{
@@ -26,12 +32,11 @@ namespace RemoteControl.Patches
LockObj = SubscriptionManager.Lock,
Taken = false
};
if (!GameManager.RunSimulation) return;
// System.Threading.Monitor.Enter(__state.LockObj, ref __state.Taken);
try
{
RemoteControl.Log("logic stack tick: start prefix");
SubscriptionManager.ApplyUpdates();
RemoteControl.Subscribers.SendUpdate();
RemoteControl.Log("logic stack tick: end prefix");
}
catch (Exception e)
@@ -46,7 +51,10 @@ namespace RemoteControl.Patches
try
{
if (!GameManager.RunSimulation) return;
RemoteControl.Log("logic stack tick: start prefix");
SubscriptionManager.RescanNetworks();
RemoteControl.Log("logic stack tick: start postfix");
}
catch (Exception e)
{