Skip to content

Commit 26f6a62

Browse files
committed
update compensate logic
1 parent e629b00 commit 26f6a62

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

SentisOptimisations/Freezer/FreezeLogic.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ private static void CompensateFrozenFrames(MyCubeGrid grid)
145145
}
146146
}
147147
}
148+
else
149+
{
150+
LastUpdateFrames.Remove(myCubeBlock.EntityId);
151+
}
148152
}
149153
}
150154

@@ -356,9 +360,13 @@ private static void DoUnfreezePhysics(MyCubeGrid grid)
356360

357361
public static bool NeedToCompensate(MyFunctionalBlock myCubeBlock)
358362
{
363+
if (myCubeBlock == null || !myCubeBlock.IsWorking)
364+
{
365+
return false;
366+
}
367+
359368
var needToCompensate = myCubeBlock is MyProductionBlock
360-
|| myCubeBlock is MyGasGenerator
361-
|| myCubeBlock is MyFueledPowerProducer;
369+
|| myCubeBlock is MyGasTank;
362370
return needToCompensate;
363371
}
364372

SentisOptimisations/Freezer/FreezerPatches.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
using System;
22
using System.Reflection;
3+
using NLog.Fluent;
34
using Sandbox.Engine.Physics;
45
using Sandbox.Game;
56
using Sandbox.Game.Entities;
7+
using Sandbox.Game.Entities.Blocks;
68
using Sandbox.Game.Entities.Cube;
79
using Sandbox.Game.Entities.Inventory;
10+
using Sandbox.Game.EntityComponents;
811
using Torch.Managers.PatchManager;
912
using VRage;
1013
using VRage.Game;
@@ -28,7 +31,7 @@ public static void Patch(PatchContext ctx)
2831
ctx.GetPattern(MethodAddItems).Prefixes.Add(
2932
typeof(FreezerPatches).GetMethod(nameof(AddItemsPatched),
3033
BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic));
31-
34+
3235
var MethodOnMotionDynamic = typeof(MyPhysicsBody).GetMethod
3336
("OnMotionDynamic", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
3437

@@ -45,7 +48,7 @@ public static void Patch(PatchContext ctx)
4548
typeof(FreezerPatches).GetMethod(nameof(RefreshCustomInfoPatched),
4649
BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic));
4750
}
48-
51+
4952
private static bool RefreshCustomInfoPatched(MyTerminalBlock __instance)
5053
{
5154
if (!SentisOptimisationsPlugin.Config.FreezerEnabled)

0 commit comments

Comments
 (0)