AICharacter position syncing
This commit is contained in:
@@ -1309,9 +1309,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (this != Character.Controlled)
|
if (this != Character.Controlled)
|
||||||
{
|
{
|
||||||
if (GameMain.Server != null)
|
if (GameMain.Server != null && !(this is AICharacter))
|
||||||
{
|
|
||||||
if (!IsDead)
|
|
||||||
{
|
{
|
||||||
if (memInput.Count > 0)
|
if (memInput.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -1351,7 +1349,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GameMain.Client != null)
|
if (GameMain.Client != null)
|
||||||
|
|||||||
@@ -664,9 +664,7 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
foreach (GUIComponent gc in GameMain.NetLobbyScreen.ChatBox.children)
|
foreach (GUIComponent gc in GameMain.NetLobbyScreen.ChatBox.children)
|
||||||
{
|
{
|
||||||
if (gc is GUITextBlock)
|
if (gc is GUITextBlock && gc.UserData is ChatMessage)
|
||||||
{
|
|
||||||
if (gc.UserData is ChatMessage)
|
|
||||||
{
|
{
|
||||||
ChatMessage cMsg = (ChatMessage)gc.UserData;
|
ChatMessage cMsg = (ChatMessage)gc.UserData;
|
||||||
if (cMsg.NetStateID > c.lastRecvChatMsgID)
|
if (cMsg.NetStateID > c.lastRecvChatMsgID)
|
||||||
@@ -675,7 +673,6 @@ namespace Barotrauma.Networking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (Item.Spawner.NetStateID > c.lastRecvEntitySpawnID)
|
if (Item.Spawner.NetStateID > c.lastRecvEntitySpawnID)
|
||||||
{
|
{
|
||||||
@@ -686,12 +683,21 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
foreach (Character character in Character.CharacterList)
|
foreach (Character character in Character.CharacterList)
|
||||||
{
|
{
|
||||||
if (character is AICharacter) continue;
|
if (character is AICharacter)
|
||||||
|
{
|
||||||
|
//TODO: don't send if the ai character is far from the client
|
||||||
|
//(some sort of distance-based culling might be a good idea for player-controlled characters as well)
|
||||||
outmsg.Write((byte)ServerNetObject.ENTITY_POSITION);
|
outmsg.Write((byte)ServerNetObject.ENTITY_POSITION);
|
||||||
character.ServerWrite(outmsg, c);
|
character.ServerWrite(outmsg, c);
|
||||||
outmsg.WritePadBits();
|
outmsg.WritePadBits();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
outmsg.Write((byte)ServerNetObject.ENTITY_POSITION);
|
||||||
|
character.ServerWrite(outmsg, c);
|
||||||
|
outmsg.WritePadBits();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach (Submarine sub in Submarine.Loaded)
|
foreach (Submarine sub in Submarine.Loaded)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
if (Data[i] != other.Data[i]) return false;
|
if (Data[i] != other.Data[i]) return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user