Input syncing between clients, inventory sync bugfix, structure sync bugfix, settings button highlight bugfix, spectating bugfixes, in-game chatbox not visible when joining a server when the round is running
This commit is contained in:
@@ -163,12 +163,18 @@ namespace Barotrauma
|
|||||||
Vector2 moveCam = Vector2.Zero;
|
Vector2 moveCam = Vector2.Zero;
|
||||||
if (targetPos == Vector2.Zero)
|
if (targetPos == Vector2.Zero)
|
||||||
{
|
{
|
||||||
if (PlayerInput.KeyDown(Keys.A)) moveCam.X -= moveSpeed;
|
if (GUITextBox.KeyboardDispatcher.Subscriber == null)
|
||||||
if (PlayerInput.KeyDown(Keys.D)) moveCam.X += moveSpeed;
|
{
|
||||||
if (PlayerInput.KeyDown(Keys.S)) moveCam.Y -= moveSpeed;
|
if (PlayerInput.KeyDown(Keys.LeftShift)) moveSpeed *= 2.0f;
|
||||||
if (PlayerInput.KeyDown(Keys.W)) moveCam.Y += moveSpeed;
|
if (PlayerInput.KeyDown(Keys.LeftControl)) moveSpeed *= 0.5f;
|
||||||
|
|
||||||
moveCam = moveCam * deltaTime * 60.0f;
|
if (PlayerInput.KeyDown(Keys.A)) moveCam.X -= moveSpeed;
|
||||||
|
if (PlayerInput.KeyDown(Keys.D)) moveCam.X += moveSpeed;
|
||||||
|
if (PlayerInput.KeyDown(Keys.S)) moveCam.Y -= moveSpeed;
|
||||||
|
if (PlayerInput.KeyDown(Keys.W)) moveCam.Y += moveSpeed;
|
||||||
|
|
||||||
|
moveCam = moveCam * deltaTime * 60.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Zoom = MathHelper.Clamp(zoom + (PlayerInput.ScrollWheelSpeed / 1000.0f) * zoom, 0.1f, 2.0f);
|
Zoom = MathHelper.Clamp(zoom + (PlayerInput.ScrollWheelSpeed / 1000.0f) * zoom, 0.1f, 2.0f);
|
||||||
|
|||||||
@@ -1037,7 +1037,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void StartStun(float stunTimer)
|
public void StartStun(float stunTimer)
|
||||||
{
|
{
|
||||||
if (stunTimer <= 0.0f) return;
|
if (stunTimer <= 0.0f || !MathUtils.IsValid(stunTimer)) return;
|
||||||
|
|
||||||
AnimController.ResetPullJoints();
|
AnimController.ResetPullJoints();
|
||||||
AnimController.StunTimer = Math.Max(AnimController.StunTimer, stunTimer);
|
AnimController.StunTimer = Math.Max(AnimController.StunTimer, stunTimer);
|
||||||
@@ -1247,25 +1247,31 @@ namespace Barotrauma
|
|||||||
// i++;
|
// i++;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
message.WriteRangedSingle(MathHelper.Clamp(AnimController.StunTimer,0.0f,60.0f), 0.0f, 60.0f, 8);
|
message.Write((byte)((health / maxHealth) * 255.0f));
|
||||||
message.Write((byte)((health/maxHealth)*255.0f));
|
|
||||||
message.Write((byte)(MathHelper.Clamp(oxygen * 2.55f, 0.0f, 255.0f)));
|
if (AnimController.StunTimer<=0.0f && bleeding<=0.0f && oxygen>99.0f)
|
||||||
|
{
|
||||||
|
message.Write(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
message.Write(false);
|
||||||
|
|
||||||
|
message.WriteRangedSingle(MathHelper.Clamp(AnimController.StunTimer, 0.0f, 60.0f), 0.0f, 60.0f, 8);
|
||||||
|
|
||||||
|
message.Write((byte)(MathHelper.Clamp(oxygen * 2.55f, 0.0f, 255.0f)));
|
||||||
|
|
||||||
|
bleeding = MathHelper.Clamp(bleeding, 0.0f, 5.0f);
|
||||||
|
message.WriteRangedSingle(bleeding, 0.0f, 5.0f, 8);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
case NetworkEventType.EntityUpdate:
|
case NetworkEventType.EntityUpdate:
|
||||||
var hasInputs =
|
|
||||||
IsKeyDown(InputType.Left) ||
|
|
||||||
IsKeyDown(InputType.Right) ||
|
|
||||||
IsKeyDown(InputType.Up) ||
|
|
||||||
IsKeyDown(InputType.Down) ||
|
|
||||||
IsKeyDown(InputType.Use) ||
|
|
||||||
IsKeyDown(InputType.Aim);
|
|
||||||
|
|
||||||
message.Write(hasInputs);
|
|
||||||
message.Write((float)NetTime.Now);
|
message.Write((float)NetTime.Now);
|
||||||
|
|
||||||
if (!hasInputs) return true;
|
|
||||||
|
|
||||||
message.Write(keys[(int)InputType.Use].DequeueHeld);
|
message.Write(keys[(int)InputType.Use].DequeueHeld);
|
||||||
|
|
||||||
bool secondaryHeld = keys[(int)InputType.Aim].DequeueHeld;
|
bool secondaryHeld = keys[(int)InputType.Aim].DequeueHeld;
|
||||||
@@ -1278,7 +1284,7 @@ namespace Barotrauma
|
|||||||
message.Write(keys[(int)InputType.Down].Held);
|
message.Write(keys[(int)InputType.Down].Held);
|
||||||
|
|
||||||
message.Write(keys[(int)InputType.Run].Held);
|
message.Write(keys[(int)InputType.Run].Held);
|
||||||
|
|
||||||
if (secondaryHeld)
|
if (secondaryHeld)
|
||||||
{
|
{
|
||||||
Vector2 relativeCursorPosition = cursorPosition - Position;
|
Vector2 relativeCursorPosition = cursorPosition - Position;
|
||||||
@@ -1382,46 +1388,17 @@ namespace Barotrauma
|
|||||||
inventory.ReadNetworkData(NetworkEventType.InventoryUpdate, message);
|
inventory.ReadNetworkData(NetworkEventType.InventoryUpdate, message);
|
||||||
return;
|
return;
|
||||||
case NetworkEventType.ImportantEntityUpdate:
|
case NetworkEventType.ImportantEntityUpdate:
|
||||||
//foreach (Limb limb in AnimController.Limbs)
|
|
||||||
//{
|
Health = (message.ReadByte() / 255.0f) * maxHealth;
|
||||||
// Vector2 limbPos = limb.SimPosition, vel = Vector2.Zero;
|
|
||||||
// float rotation = limb.Rotation;
|
|
||||||
|
|
||||||
// try
|
bool allOk = message.ReadBoolean();
|
||||||
// {
|
if (allOk) return;
|
||||||
// limbPos.X = message.ReadRangedSingle(-NetConfig.CharacterIgnoreDistance, NetConfig.CharacterIgnoreDistance, 16);
|
|
||||||
// limbPos.Y = message.ReadRangedSingle(-NetConfig.CharacterIgnoreDistance, NetConfig.CharacterIgnoreDistance, 16);
|
|
||||||
|
|
||||||
// rotation = message.ReadFloat();
|
|
||||||
// }
|
|
||||||
// catch
|
|
||||||
// {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (limb.body != null)
|
|
||||||
// {
|
|
||||||
// limb.body.TargetVelocity = limb.body.LinearVelocity;
|
|
||||||
// limb.body.TargetPosition = limbPos;// +vel * (float)(deltaTime / 60.0);
|
|
||||||
// limb.body.TargetRotation = rotation;// +angularVel * (float)(deltaTime / 60.0);
|
|
||||||
// limb.body.TargetAngularVelocity = limb.body.AngularVelocity;
|
|
||||||
// }
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
float newStunTimer = 0.0f, newHealth = 0.0f, newOxygen = 0.0f;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
newStunTimer = message.ReadRangedSingle(0.0f, 60.0f, 8);
|
|
||||||
newHealth = (message.ReadByte() / 255.0f) * maxHealth;
|
|
||||||
newOxygen = (message.ReadByte() / 2.55f);
|
|
||||||
}
|
|
||||||
catch { return; }
|
|
||||||
|
|
||||||
|
float newStunTimer = message.ReadRangedSingle(0.0f, 60.0f, 8);
|
||||||
StartStun(newStunTimer);
|
StartStun(newStunTimer);
|
||||||
Health = newHealth;
|
|
||||||
oxygen = newOxygen;
|
Oxygen = (message.ReadByte() / 2.55f);
|
||||||
|
Bleeding = message.ReadRangedSingle(0.0f, 5.0f, 8);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case NetworkEventType.EntityUpdate:
|
case NetworkEventType.EntityUpdate:
|
||||||
@@ -1434,14 +1411,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool hasInputs = message.ReadBoolean();
|
sendingTime = message.ReadFloat();
|
||||||
sendingTime = message.ReadFloat();
|
|
||||||
|
if (sendingTime > LastNetworkUpdate) ClearInputs();
|
||||||
if (!hasInputs)
|
|
||||||
{
|
|
||||||
if (sendingTime > LastNetworkUpdate) ClearInputs();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
actionKeyState = message.ReadBoolean();
|
actionKeyState = message.ReadBoolean();
|
||||||
secondaryKeyState = message.ReadBoolean();
|
secondaryKeyState = message.ReadBoolean();
|
||||||
@@ -1456,13 +1428,19 @@ namespace Barotrauma
|
|||||||
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
#if DEBUG
|
||||||
|
DebugConsole.ThrowError("Error in Character.ReadNetworkData: " + e.Message);
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimController.IsStanding = true;
|
AnimController.IsStanding = true;
|
||||||
|
|
||||||
keys[(int)InputType.Use].Held = actionKeyState;
|
keys[(int)InputType.Use].Held = actionKeyState;
|
||||||
keys[(int)InputType.Aim].Held = secondaryKeyState;
|
keys[(int)InputType.Use].SetState(false, actionKeyState);
|
||||||
|
|
||||||
|
keys[(int)InputType.Aim].Held = secondaryKeyState;
|
||||||
|
keys[(int)InputType.Aim].SetState(false, secondaryKeyState);
|
||||||
|
|
||||||
if (sendingTime <= LastNetworkUpdate) return;
|
if (sendingTime <= LastNetworkUpdate) return;
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Microsoft.Xna.Framework;
|
|||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using Barotrauma.Networking;
|
using Barotrauma.Networking;
|
||||||
|
using Barotrauma.Items.Components;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -259,6 +260,15 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "power":
|
||||||
|
Item reactorItem = Item.ItemList.Find(i => i.GetComponent<Reactor>() != null);
|
||||||
|
if (reactorItem == null) return;
|
||||||
|
|
||||||
|
var reactor = reactorItem.GetComponent<Reactor>();
|
||||||
|
reactor.ShutDownTemp = 7000.0f;
|
||||||
|
reactor.AutoTemp = true;
|
||||||
|
reactor.Temperature = 5000.0f;
|
||||||
|
break;
|
||||||
case "shake":
|
case "shake":
|
||||||
GameMain.GameScreen.Cam.Shake = 10.0f;
|
GameMain.GameScreen.Cam.Shake = 10.0f;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public List<GUIComponent> FindChildren(object userData)
|
public List<GUIComponent> FindChildren(object userData)
|
||||||
{
|
{
|
||||||
return children .FindAll(c => c.userData == userData);
|
return children.FindAll(c => c.userData == userData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ClearChildren()
|
public virtual void ClearChildren()
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ namespace Barotrauma
|
|||||||
Item item = Entity.FindEntityByID(itemId) as Item;
|
Item item = Entity.FindEntityByID(itemId) as Item;
|
||||||
if (item == null) continue;
|
if (item == null) continue;
|
||||||
|
|
||||||
if (items[i] != item) items[i].Drop(character, false);
|
if (items[i] != item && items[i] != null) items[i].Drop(character, false);
|
||||||
TryPutItem(item, i, false);
|
TryPutItem(item, i, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (item.inventory != null && removeItem)
|
if (item.inventory != null && removeItem)
|
||||||
{
|
{
|
||||||
item.Drop();
|
item.Drop(null, false);
|
||||||
item.inventory.RemoveItem(item);
|
item.inventory.RemoveItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -390,8 +390,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (sectionIndex < 0 || sectionIndex > sections.Length - 1) return;
|
if (sectionIndex < 0 || sectionIndex > sections.Length - 1) return;
|
||||||
|
|
||||||
if (GameMain.Client == null)
|
if (GameMain.Client == null) SetDamage(sectionIndex, sections[sectionIndex].damage + damage);
|
||||||
SetDamage(sectionIndex, sections[sectionIndex].damage + damage);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,7 +452,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (damage != sections[sectionIndex].damage && Math.Abs(sections[sectionIndex].lastSentDamage - damage)>5.0f)
|
if (damage != sections[sectionIndex].damage && Math.Abs(sections[sectionIndex].lastSentDamage - damage)>5.0f)
|
||||||
{
|
{
|
||||||
new NetworkEvent(NetworkEventType.WallDamage, ID, false);
|
new NetworkEvent(NetworkEventType.ImportantEntityUpdate, ID, false);
|
||||||
//sections[sectionIndex].lastSentDamage = damage;
|
//sections[sectionIndex].lastSentDamage = damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -642,17 +641,19 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
message.Write((float)NetTime.Now);
|
message.Write((float)NetTime.Now);
|
||||||
|
|
||||||
var updateSections = Array.FindAll(sections, s => s != null && Math.Abs(s.damage - s.lastSentDamage)/Health > 0.01f);
|
//var updateSections = Array.FindAll(sections, s => s != null && Math.Abs(s.damage - s.lastSentDamage) > 0.01f);
|
||||||
|
|
||||||
if (updateSections.Length == 0) return false;
|
//if (updateSections.Length == 0) return false;
|
||||||
|
|
||||||
Debug.Assert(updateSections.Length<255);
|
//Debug.Assert(updateSections.Length<255);
|
||||||
|
|
||||||
message.Write((byte)updateSections.Length);
|
// message.Write((byte)updateSections.Length);
|
||||||
|
|
||||||
for (int i = 0; i < updateSections.Length; i++)
|
for (int i = 0; i < sections.Length; i++)
|
||||||
{
|
{
|
||||||
message.Write((byte)i);
|
//if (Math.Abs(sections[i].damage - sections[i].lastSentDamage) < 0.01f) continue;
|
||||||
|
|
||||||
|
//message.Write((byte)i);
|
||||||
message.WriteRangedSingle(sections[i].damage / Health, 0.0f, 1.0f, 8);
|
message.WriteRangedSingle(sections[i].damage / Health, 0.0f, 1.0f, 8);
|
||||||
|
|
||||||
sections[i].lastSentDamage = sections[i].damage;
|
sections[i].lastSentDamage = sections[i].damage;
|
||||||
@@ -668,17 +669,19 @@ namespace Barotrauma
|
|||||||
float updateTime = message.ReadFloat();
|
float updateTime = message.ReadFloat();
|
||||||
if (updateTime < lastUpdate) return;
|
if (updateTime < lastUpdate) return;
|
||||||
|
|
||||||
int sectionCount = message.ReadByte();
|
// int sectionCount = message.ReadByte();
|
||||||
|
|
||||||
for (int i = 0; i<sectionCount; i++)
|
for (int i = 0; i<sections.Count(); i++)
|
||||||
{
|
{
|
||||||
byte sectionIndex = message.ReadByte();
|
//byte sectionIndex = message.ReadByte();
|
||||||
float damage = message.ReadRangedSingle(0.0f, 1.0f, 8) * Health;
|
float damage = message.ReadRangedSingle(0.0f, 1.0f, 8) * Health;
|
||||||
|
|
||||||
if (sectionIndex < 0 || sectionIndex >= sections.Length) continue;
|
//if (sectionIndex < 0 || sectionIndex >= sections.Length) continue;
|
||||||
|
|
||||||
SetDamage(sectionIndex, damage);
|
SetDamage(i, damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastUpdate = updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
if (gameStarted && disconnectedClients[i].Character!=null)
|
if (gameStarted && disconnectedClients[i].Character!=null)
|
||||||
{
|
{
|
||||||
disconnectedClients[i].Character.Remove();
|
disconnectedClients[i].Character.Kill(CauseOfDeath.Damage, true);
|
||||||
disconnectedClients[i].Character = null;
|
disconnectedClients[i].Character = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -609,7 +609,7 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
if (NetworkEvent.Events.Count == 0) return;
|
if (NetworkEvent.Events.Count == 0) return;
|
||||||
|
|
||||||
List<Client> recipients = ConnectedClients.FindAll(c => c.Character != null);
|
List<Client> recipients = ConnectedClients.FindAll(c => c.Character != null || c.Spectating);
|
||||||
|
|
||||||
if (recipients.Count == 0) return;
|
if (recipients.Count == 0) return;
|
||||||
|
|
||||||
@@ -784,6 +784,7 @@ namespace Barotrauma.Networking
|
|||||||
var messageBox = new GUIMessageBox("The round has ended", endMessage, 400, 300);
|
var messageBox = new GUIMessageBox("The round has ended", endMessage, 400, 300);
|
||||||
|
|
||||||
Character.Controlled = null;
|
Character.Controlled = null;
|
||||||
|
myCharacter = null;
|
||||||
GameMain.GameScreen.Cam.TargetPos = Vector2.Zero;
|
GameMain.GameScreen.Cam.TargetPos = Vector2.Zero;
|
||||||
GameMain.LightManager.LosEnabled = false;
|
GameMain.LightManager.LosEnabled = false;
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace Barotrauma.Networking
|
|||||||
public const float IdSendInterval = 0.2f;
|
public const float IdSendInterval = 0.2f;
|
||||||
public const float RerequestInterval = 0.2f;
|
public const float RerequestInterval = 0.2f;
|
||||||
|
|
||||||
public const int ResendAttempts = 8;
|
public const int ReliableMessageBufferSize = 100;
|
||||||
|
public const int ResendAttempts = 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ namespace Barotrauma.Networking
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
System.Diagnostics.Debug.WriteLine(e.ToString());
|
//System.Diagnostics.Debug.WriteLine(e.ToString());
|
||||||
|
|
||||||
object data;
|
object data;
|
||||||
|
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
public virtual void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
|
public virtual void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
if (!gameStarted && Screen.Selected != GameMain.GameScreen) return;
|
if (!gameStarted || Screen.Selected != GameMain.GameScreen) return;
|
||||||
|
|
||||||
inGameHUD.Draw(spriteBatch);
|
inGameHUD.Draw(spriteBatch);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,14 +97,13 @@ namespace Barotrauma.Networking.ReliableMessages
|
|||||||
message.Write((byte)PacketTypes.ReliableMessage);
|
message.Write((byte)PacketTypes.ReliableMessage);
|
||||||
message.Write(messageID);
|
message.Write(messageID);
|
||||||
|
|
||||||
int bufferSize=100;
|
if (messageBuffer.Count > NetConfig.ReliableMessageBufferSize)
|
||||||
if (messageBuffer.Count>bufferSize)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
int end = messageCount-bufferSize;
|
|
||||||
int start = end - (messageBuffer.Count - bufferSize);
|
|
||||||
|
|
||||||
if (start<=0)
|
int end = messageCount - NetConfig.ReliableMessageBufferSize;
|
||||||
|
int start = end - (messageBuffer.Count - NetConfig.ReliableMessageBufferSize);
|
||||||
|
|
||||||
|
if (start<0)
|
||||||
{
|
{
|
||||||
int wrappedStart = start + ushort.MaxValue;
|
int wrappedStart = start + ushort.MaxValue;
|
||||||
if (wrappedStart==0) wrappedStart = ushort.MaxValue;
|
if (wrappedStart==0) wrappedStart = ushort.MaxValue;
|
||||||
@@ -119,7 +118,7 @@ namespace Barotrauma.Networking.ReliableMessages
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ushort i = (ushort)Math.Max(start,1); i <= (ushort)Math.Max(end,1); i++)
|
for (ushort i = (ushort)Math.Max(start,0); i <= (ushort)Math.Max(end,0); i++)
|
||||||
{
|
{
|
||||||
messageBuffer.Remove(i);
|
messageBuffer.Remove(i);
|
||||||
if (i == ushort.MaxValue) break;
|
if (i == ushort.MaxValue) break;
|
||||||
@@ -219,12 +218,11 @@ namespace Barotrauma.Networking.ReliableMessages
|
|||||||
{
|
{
|
||||||
foreach (var message in missingMessages.Where(m => m.Value.ResendRequestsSent > NetConfig.ResendAttempts).ToList())
|
foreach (var message in missingMessages.Where(m => m.Value.ResendRequestsSent > NetConfig.ResendAttempts).ToList())
|
||||||
{
|
{
|
||||||
|
Debug.WriteLine("Max rerequest attempts reached on message "+message.Value.ID);
|
||||||
missingMessages.Remove(message.Key);
|
missingMessages.Remove(message.Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bufferSize = 20;
|
while (missingMessageIds.Count>NetConfig.ReliableMessageBufferSize)
|
||||||
|
|
||||||
while (missingMessageIds.Count>bufferSize)
|
|
||||||
{
|
{
|
||||||
ushort id = missingMessageIds.Dequeue();
|
ushort id = missingMessageIds.Dequeue();
|
||||||
|
|
||||||
@@ -245,7 +243,8 @@ namespace Barotrauma.Networking.ReliableMessages
|
|||||||
resendRequest.Write((byte)PacketTypes.ResendRequest);
|
resendRequest.Write((byte)PacketTypes.ResendRequest);
|
||||||
resendRequest.Write(missingMessage.ID);
|
resendRequest.Write(missingMessage.ID);
|
||||||
|
|
||||||
receiver.SendMessage(resendRequest, recipient, NetDeliveryMethod.Unreliable);
|
receiver.SendMessage(resendRequest, recipient,
|
||||||
|
missingMessage.ResendRequestsSent==0 ? NetDeliveryMethod.ReliableUnordered : NetDeliveryMethod.Unreliable);
|
||||||
|
|
||||||
|
|
||||||
missingMessage.ResendTimer = Math.Max(recipient.AverageRoundtripTime, NetConfig.RerequestInterval);
|
missingMessage.ResendTimer = Math.Max(recipient.AverageRoundtripTime, NetConfig.RerequestInterval);
|
||||||
|
|||||||
@@ -148,6 +148,12 @@ namespace Barotrauma
|
|||||||
if (held) heldQueue = true;
|
if (held) heldQueue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetState(bool hit, bool held)
|
||||||
|
{
|
||||||
|
if (hit) hitQueue = true;
|
||||||
|
if (held) heldQueue = true;
|
||||||
|
}
|
||||||
|
|
||||||
public bool Dequeue
|
public bool Dequeue
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
@@ -296,6 +296,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
|
|
||||||
infoFrame.RemoveChild(infoFrame.children.Find(c => c.UserData as string == "startButton"));
|
infoFrame.RemoveChild(infoFrame.children.Find(c => c.UserData as string == "startButton"));
|
||||||
|
infoFrame.RemoveChild(infoFrame.children.Find(c => c.UserData as string == "settingsButton"));
|
||||||
infoFrame.RemoveChild(infoFrame.children.Find(c => c.UserData as string == "spectateButton"));
|
infoFrame.RemoveChild(infoFrame.children.Find(c => c.UserData as string == "spectateButton"));
|
||||||
|
|
||||||
playerList.Parent.RemoveChild(playerList.Parent.children.Find(c => c.UserData as string == "banListButton"));
|
playerList.Parent.RemoveChild(playerList.Parent.children.Find(c => c.UserData as string == "banListButton"));
|
||||||
@@ -313,7 +314,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
GUIButton settingsButton = new GUIButton(new Rectangle(-100, 0, 80, 30), "Settings", Alignment.BottomRight, GUI.Style, infoFrame);
|
GUIButton settingsButton = new GUIButton(new Rectangle(-100, 0, 80, 30), "Settings", Alignment.BottomRight, GUI.Style, infoFrame);
|
||||||
settingsButton.OnClicked = GameMain.Server.ToggleSettingsFrame;
|
settingsButton.OnClicked = GameMain.Server.ToggleSettingsFrame;
|
||||||
settingsButton.CanBeSelected = false;
|
|
||||||
settingsButton.UserData = "settingsButton";
|
settingsButton.UserData = "settingsButton";
|
||||||
|
|
||||||
var banListButton = new GUIButton(new Rectangle(0, 30, 100, 20), "Banned IPs", Alignment.BottomRight, GUI.Style, playerList.Parent);
|
var banListButton = new GUIButton(new Rectangle(0, 30, 100, 20), "Banned IPs", Alignment.BottomRight, GUI.Style, playerList.Parent);
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user