Syncinc AICharacter inventories (a husk controlled by the host), clients don't try to read physicsbodyposition messages if the item doesn't have a body, control command works even if the character has spaces in the name
This commit is contained in:
@@ -128,6 +128,8 @@ namespace Barotrauma
|
|||||||
message.Write(AnimController.RefLimb.SimPosition.Y);
|
message.Write(AnimController.RefLimb.SimPosition.Y);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
case NetworkEventType.InventoryUpdate:
|
||||||
|
return base.FillNetworkData(type, message, data);
|
||||||
default:
|
default:
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
DebugConsole.ThrowError("AICharacter network event had a wrong type ("+type+")");
|
DebugConsole.ThrowError("AICharacter network event had a wrong type ("+type+")");
|
||||||
@@ -146,6 +148,9 @@ namespace Barotrauma
|
|||||||
case NetworkEventType.KillCharacter:
|
case NetworkEventType.KillCharacter:
|
||||||
Kill(CauseOfDeath.Damage, true);
|
Kill(CauseOfDeath.Damage, true);
|
||||||
return;
|
return;
|
||||||
|
case NetworkEventType.InventoryUpdate:
|
||||||
|
base.ReadNetworkData(type, message, sendingTime, out data);
|
||||||
|
return;
|
||||||
case NetworkEventType.ImportantEntityUpdate:
|
case NetworkEventType.ImportantEntityUpdate:
|
||||||
|
|
||||||
Vector2 limbPos = AnimController.RefLimb.SimPosition;
|
Vector2 limbPos = AnimController.RefLimb.SimPosition;
|
||||||
|
|||||||
@@ -313,8 +313,8 @@ namespace Barotrauma
|
|||||||
case "controlcharacter":
|
case "controlcharacter":
|
||||||
case "control":
|
case "control":
|
||||||
if (commands.Length < 2) break;
|
if (commands.Length < 2) break;
|
||||||
commands[1] = commands[1].ToLowerInvariant();
|
string name = string.Join(" ", commands.Skip(1)).ToLowerInvariant();
|
||||||
Character.Controlled = Character.CharacterList.Find(c => !c.IsNetworkPlayer && c.Name.ToLowerInvariant() == commands[1]);
|
Character.Controlled = Character.CharacterList.Find(c => !c.IsNetworkPlayer && c.Name.ToLowerInvariant() == name);
|
||||||
break;
|
break;
|
||||||
case "godmode":
|
case "godmode":
|
||||||
if (Submarine.MainSub == null) return;
|
if (Submarine.MainSub == null) return;
|
||||||
|
|||||||
@@ -1632,7 +1632,12 @@ namespace Barotrauma
|
|||||||
if (body != null) body.FillNetworkData(message);
|
if (body != null) body.FillNetworkData(message);
|
||||||
break;
|
break;
|
||||||
case NetworkEventType.PhysicsBodyPosition:
|
case NetworkEventType.PhysicsBodyPosition:
|
||||||
System.Diagnostics.Debug.Assert(body != null, "Tried to send a PhysicsBodyPosition message for an item that has no physics body");
|
#if DEBUG
|
||||||
|
System.Diagnostics.Debug.Assert(body != null, "Tried to send a PhysicsBodyPosition message for an item that has no physics body ("+Name+")");
|
||||||
|
#else
|
||||||
|
if (body == null) return;
|
||||||
|
#endif
|
||||||
|
|
||||||
body.FillNetworkData(message);
|
body.FillNetworkData(message);
|
||||||
break;
|
break;
|
||||||
case NetworkEventType.ItemFixed:
|
case NetworkEventType.ItemFixed:
|
||||||
|
|||||||
Reference in New Issue
Block a user