05cc34afd8
commit 1473f77ba0c85b80d48dce3e0fca809a9d5da98c Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Fri Mar 22 12:39:03 2019 +0200 Server automatically ends rounds if there have been no players alive in 60 seconds and respawning is not allowed during the round. Otherwise campaign rounds can get "bricked" if all the clients die/disconnect and there's no-one who's allowed to manually end the round. Closes #1319 commit 7096983fb10e48c2866393d30420bfaa79a0719b Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Fri Mar 22 12:03:10 2019 +0200 Some extra error logging in an attempt to diagnose #1327 (seems that the server is trying to start a campaign round after the campaign has been disposed and another game mode selected). commit 2d7a3be83cd8865869837879b965fa9aeb046042 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Fri Mar 22 10:53:08 2019 +0200 Use null as the rotation and angular velocity of a character's collider in network state buffers if the collider is set to a fixed rotation (i.e. when standing). Previously the _current_ rotation and angular velocity was used if the server didn't send the values, which caused the collider to "wobble" when getting up from the ground, because the clients used the current rotation and angular velocity to determine if their predicted state is correct, even though they should've been using past states (or rather, not attempting to correct at all because both the rotation and ang velocity should be 0 when the rotation is fixed). commit 2e2fd7078798703bc5d6ae398f75fa580ecca566 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Thu Mar 21 22:44:11 2019 +0200 Disabled kicking clients out of the server if their Steam auth becomes invalid after they've already been authenticated. Got some reports from players about this occasionally happening for no apparent reason, and I don't see the need to kick the clients if they've already been successfully authenticated during that session.
121 lines
3.8 KiB
C#
121 lines
3.8 KiB
C#
using Barotrauma.Networking;
|
|
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Barotrauma
|
|
{
|
|
class CharacterStateInfo : PosInfo
|
|
{
|
|
public readonly Direction Direction;
|
|
|
|
public readonly Entity Interact; //the entity being interacted with
|
|
|
|
public readonly AnimController.Animation Animation;
|
|
|
|
public CharacterStateInfo(Vector2 pos, float? rotation, Vector2 velocity, float? angularVelocity, float time, Direction dir, Entity interact, AnimController.Animation animation = AnimController.Animation.None)
|
|
: this(pos, rotation, velocity, angularVelocity, 0, time, dir, interact, animation)
|
|
{
|
|
}
|
|
|
|
public CharacterStateInfo(Vector2 pos, float? rotation, UInt16 ID, Direction dir, Entity interact, AnimController.Animation animation = AnimController.Animation.None)
|
|
: this(pos, rotation, Vector2.Zero, 0.0f, ID, 0.0f, dir, interact, animation)
|
|
{
|
|
}
|
|
|
|
protected CharacterStateInfo(Vector2 pos, float? rotation, Vector2 velocity, float? angularVelocity, UInt16 ID, float time, Direction dir, Entity interact, AnimController.Animation animation = AnimController.Animation.None)
|
|
: base(pos, rotation, velocity, angularVelocity, ID, time)
|
|
{
|
|
Direction = dir;
|
|
Interact = interact;
|
|
|
|
Animation = animation;
|
|
}
|
|
}
|
|
|
|
partial class Character
|
|
{
|
|
[Flags]
|
|
private enum InputNetFlags : ushort
|
|
{
|
|
None = 0x0,
|
|
Left = 0x1,
|
|
Right = 0x2,
|
|
Up = 0x4,
|
|
Down = 0x8,
|
|
FacingLeft = 0x10,
|
|
Run = 0x20,
|
|
Crouch = 0x40,
|
|
Select = 0x80,
|
|
Use = 0x100,
|
|
Aim = 0x200,
|
|
Attack = 0x400,
|
|
Ragdoll = 0x800,
|
|
Health = 0x1000,
|
|
Grab = 0x2000,
|
|
|
|
MaxVal = 0x3FFF
|
|
}
|
|
private InputNetFlags dequeuedInput = 0;
|
|
private InputNetFlags prevDequeuedInput = 0;
|
|
|
|
public UInt16 LastNetworkUpdateID = 0;
|
|
|
|
/// <summary>
|
|
/// ID of the last inputs the server has processed
|
|
/// </summary>
|
|
public UInt16 LastProcessedID;
|
|
|
|
private struct NetInputMem
|
|
{
|
|
public InputNetFlags states; //keys pressed/other boolean states at this step
|
|
public UInt16 intAim; //aim angle, represented as an unsigned short where 0=0º, 65535=just a bit under 360º
|
|
public UInt16 interact; //id of the entity being interacted with
|
|
|
|
public UInt16 networkUpdateID;
|
|
}
|
|
|
|
private List<NetInputMem> memInput = new List<NetInputMem>();
|
|
|
|
private List<CharacterStateInfo> memState = new List<CharacterStateInfo>();
|
|
private List<CharacterStateInfo> memLocalState = new List<CharacterStateInfo>();
|
|
|
|
public float healthUpdateTimer;
|
|
|
|
private float healthUpdateInterval;
|
|
public float HealthUpdateInterval
|
|
{
|
|
get { return healthUpdateInterval; }
|
|
set
|
|
{
|
|
healthUpdateInterval = MathHelper.Clamp(value, 0.0f, IsDead ? NetConfig.MaxHealthUpdateIntervalDead : NetConfig.MaxHealthUpdateInterval);
|
|
healthUpdateTimer = Math.Min(healthUpdateTimer, healthUpdateInterval);
|
|
}
|
|
}
|
|
|
|
public bool isSynced = false;
|
|
|
|
public List<CharacterStateInfo> MemState
|
|
{
|
|
get { return memState; }
|
|
}
|
|
|
|
public List<CharacterStateInfo> MemLocalState
|
|
{
|
|
get { return memLocalState; }
|
|
}
|
|
|
|
public void ResetNetState()
|
|
{
|
|
memInput.Clear();
|
|
memState.Clear();
|
|
memLocalState.Clear();
|
|
|
|
LastNetworkUpdateID = 0;
|
|
LastProcessedID = 0;
|
|
}
|
|
|
|
partial void UpdateNetInput();
|
|
}
|
|
}
|