Skip to content

Commit d685722

Browse files
committed
normal distribution of position refresh for turrets
1 parent a735cd0 commit d685722

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

FixTurrets/FixTurretsPatch.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Linq;
33
using System.Reflection;
44
using NLog;
5+
using Sandbox;
56
using Sandbox.Game.Entities;
67
using Sandbox.Game.Weapons;
78
using Torch.Managers.PatchManager;
@@ -14,22 +15,15 @@ namespace FixTurrets
1415
[PatchShim]
1516
public static class FixTurretsPatch
1617
{
17-
18-
private static int _counter = 0;
19-
private static readonly int skipConst = 100;
2018

2119
[ReflectedMethod(Name = "RotateModels")]
2220
private static Action<MyLargeTurretBase> RotateModels;
2321

2422
private static void OnPositionChanged(MyPositionComponentBase myPositionComponentBase, MyLargeTurretBase __instance)
2523
{
26-
_counter++;
27-
if (_counter % skipConst == 0)
28-
{
24+
if ((ulong)__instance.EntityId % 100 == MySandboxGame.Static.SimulationFrameCounter % 100) {
2925
RotateModels.Invoke(__instance);
30-
_counter = 0;
3126
}
32-
3327
}
3428

3529
public static readonly Logger Log = LogManager.GetCurrentClassLogger();

0 commit comments

Comments
 (0)