Monster syncing fixes:
- clients freeze and disable AI characters if no updates have been received in a while (due to the monster being far away from player-controlled characters at the servers side for example) - server disables AI characters that are too far for updates to be sent to clients (-> targets of monster missions can't swim away from the spawnpos and cause the clients' sonars to point to an incorrect position)
This commit is contained in:
@@ -20,14 +20,10 @@ namespace Barotrauma
|
||||
|
||||
public static bool DisableControls;
|
||||
|
||||
private UInt32 netStateID;
|
||||
public UInt32 NetStateID
|
||||
{
|
||||
get { return netStateID; }
|
||||
}
|
||||
|
||||
protected List<PosInfo> memPos = new List<PosInfo>();
|
||||
|
||||
protected float lastRecvPositionUpdateTime;
|
||||
|
||||
private bool networkUpdateSent;
|
||||
|
||||
//the Character that the player is currently controlling
|
||||
@@ -58,6 +54,7 @@ namespace Barotrauma
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == enabled) return;
|
||||
enabled = value;
|
||||
|
||||
foreach (Limb limb in AnimController.Limbs)
|
||||
@@ -757,13 +754,6 @@ namespace Barotrauma
|
||||
// AnimController.TargetDir = Direction.Right;
|
||||
// }
|
||||
//}
|
||||
//else if (GameMain.Client != null && Character.controlled != this)
|
||||
//{
|
||||
// if (memPos.Count > 0)
|
||||
// {
|
||||
// AnimController.TargetDir = memPos[0].Direction;
|
||||
// }
|
||||
//}
|
||||
|
||||
if (attackCoolDown >0.0f)
|
||||
{
|
||||
@@ -1957,7 +1947,12 @@ namespace Barotrauma
|
||||
|
||||
break;
|
||||
case NetworkEventType.EntityUpdate:
|
||||
if (GameMain.Client != null) Enabled = true;
|
||||
if (GameMain.Client != null)
|
||||
{
|
||||
lastRecvPositionUpdateTime = (float)NetTime.Now;
|
||||
AnimController.Frozen = false;
|
||||
Enabled = true;
|
||||
}
|
||||
|
||||
Vector2 relativeCursorPos = Vector2.Zero;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user