Skip to content

Commit

Permalink
Only send player updates to players in a subspace.
Browse files Browse the repository at this point in the history
  • Loading branch information
godarklight committed Feb 3, 2014
1 parent 7d95942 commit 78ddecb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions KMPServer/Client.cs
Expand Up @@ -42,6 +42,7 @@ public Server parent
public double syncOffset = 0.01d;
public int lagWarning = 0;
public bool warping = false;
public bool syncing = true;
public bool hasReceivedScenarioModules = false;
public float averageWarpRate = 1f;

Expand Down
4 changes: 3 additions & 1 deletion KMPServer/Server.cs
Expand Up @@ -2110,6 +2110,7 @@ private void HandleWarping(Client cl, byte[] data)
{
if (rate > 1.1f)
{
cl.syncing = true;
cl.warping = true;
cl.currentSubspaceID = -1;
Log.Activity("{0} is warping", cl.username);
Expand Down Expand Up @@ -3339,7 +3340,7 @@ private void sendPluginUpdateToAll(byte[] data, bool secondaryUpdate, Client cl
byte[] owned_message_bytes = buildMessageArray(KMPCommon.ServerMessageID.PLUGIN_UPDATE, owned_data);
byte[] past_message_bytes = buildMessageArray(KMPCommon.ServerMessageID.PLUGIN_UPDATE, past_data);

foreach (var client in clients.ToList().Where(c => c != cl && c.isReady && c.activityLevel != Client.ActivityLevel.INACTIVE))
foreach (var client in clients.ToList().Where(c => c != cl && !c.syncing && c.isReady && c.activityLevel != Client.ActivityLevel.INACTIVE))
{
if ((client.currentSubspaceID == cl.currentSubspaceID)
&& !client.warping && !cl.warping
Expand Down Expand Up @@ -3643,6 +3644,7 @@ private void sendSyncCompleteMessage(Client cl)
{
byte[] message_bytes = buildMessageArray(KMPCommon.ServerMessageID.SYNC_COMPLETE, null);
cl.queueOutgoingMessage(message_bytes);
cl.syncing = false;
}

private void sendVesselMessage(Client cl, byte[] data)
Expand Down

0 comments on commit 78ddecb

Please sign in to comment.