@@ -5,18 +5,15 @@ namespace GodotModules.Netcode.Server
55{
66 public class ServerSimulation : Node
77 {
8- private static ConcurrentQueue < ThreadCmd < SimulationOpcode > > ServerSimulationQueue = new ConcurrentQueue < ThreadCmd < SimulationOpcode > > ( ) ;
8+ private ConcurrentQueue < ThreadCmd < SimulationOpcode > > ServerSimulationQueue = new ConcurrentQueue < ThreadCmd < SimulationOpcode > > ( ) ;
99
10- public static Dictionary < ushort , Enemy > Enemies = new Dictionary < ushort , Enemy > ( ) ;
10+ private Dictionary < ushort , Enemy > Enemies = new Dictionary < ushort , Enemy > ( ) ;
1111 private Dictionary < byte , Game . OtherPlayer > Players ;
12-
13- private static ServerSimulation Instance { get ; set ; }
14- private static GTimer Timer { get ; set ; }
15- private static Dictionary < byte , PrevCurQueue < Vector2 > > PlayerPositions = new Dictionary < byte , PrevCurQueue < Vector2 > > ( ) ;
12+ private GTimer Timer { get ; set ; }
13+ private Dictionary < byte , PrevCurQueue < Vector2 > > PlayerPositions = new Dictionary < byte , PrevCurQueue < Vector2 > > ( ) ;
1614
1715 public override void _Ready ( )
1816 {
19- Instance = this ;
2017 Players = new Dictionary < byte , Game . OtherPlayer > ( ) ;
2118 Timer = new GTimer ( ServerIntervals . PlayerTransforms , true , false ) ;
2219 Timer . Connect ( this , nameof ( EmitSimulationData ) ) ;
@@ -35,7 +32,7 @@ public override void _PhysicsProcess(float delta)
3532 }
3633 }
3734
38- public static void Enqueue ( ThreadCmd < SimulationOpcode > cmd ) => ServerSimulationQueue . Enqueue ( cmd ) ;
35+ public void Enqueue ( ThreadCmd < SimulationOpcode > cmd ) => ServerSimulationQueue . Enqueue ( cmd ) ;
3936
4037 public void Dequeue ( )
4138 {
@@ -84,7 +81,7 @@ private void CreatePlayer(byte id)
8481 otherPlayer . AddToGroup ( "Player" ) ;
8582 otherPlayer . Position = Vector2 . Zero ;
8683 Players . Add ( id , otherPlayer ) ;
87- Instance . AddChild ( otherPlayer ) ;
84+ AddChild ( otherPlayer ) ;
8885 }
8986
9087 private void CreateEnemy ( SimulationEnemy simEnemy )
@@ -94,7 +91,7 @@ private void CreateEnemy(SimulationEnemy simEnemy)
9491 enemy . SetPlayers ( Players ) ;
9592 enemy . Position = simEnemy . SpawnForce ;
9693 Enemies . Add ( simEnemy . Id , enemy ) ;
97- Instance . AddChild ( enemy ) ;
94+ AddChild ( enemy ) ;
9895 }
9996
10097 private void EmitSimulationData ( )
0 commit comments