Unstable 1.1.14.0

This commit is contained in:
Markus Isberg
2023-10-02 16:43:54 +03:00
parent 94f5a93a0c
commit cf8f0de659
606 changed files with 21906 additions and 11456 deletions
@@ -201,9 +201,9 @@ namespace Barotrauma
keys[(int)InputType.Use].Held = useInput;
keys[(int)InputType.Use].SetState(false, useInput);
bool crouching = msg.ReadBoolean();
if (AnimController is HumanoidAnimController)
{
bool crouching = msg.ReadBoolean();
keys[(int)InputType.Crouch].Held = crouching;
keys[(int)InputType.Crouch].SetState(false, crouching);
}
@@ -269,7 +269,34 @@ namespace Barotrauma
if (readStatus)
{
ReadStatus(msg);
AIController?.ClientRead(msg);
bool isEnemyAi = msg.ReadBoolean();
if (isEnemyAi)
{
byte aiState = msg.ReadByte();
if (AIController is EnemyAIController enemyAi)
{
enemyAi.State = (AIState)aiState;
}
else
{
DebugConsole.AddWarning($"Received enemy AI data for a character with no {nameof(EnemyAIController)}. Ignoring...");
}
bool isPet = msg.ReadBoolean();
if (isPet)
{
byte happiness = msg.ReadByte();
byte hunger = msg.ReadByte();
if ((AIController as EnemyAIController)?.PetBehavior is PetBehavior petBehavior)
{
petBehavior.Happiness = (float)happiness / byte.MaxValue * petBehavior.MaxHappiness;
petBehavior.Hunger = (float)hunger / byte.MaxValue * petBehavior.MaxHunger;
}
else
{
DebugConsole.AddWarning($"Received pet AI data for a character with no {nameof(PetBehavior)}. Ignoring...");
}
}
}
}
msg.ReadPadBits();
@@ -323,7 +350,7 @@ namespace Barotrauma
}
else
{
Inventory.ClientEventRead(msg, sendingTime);
Inventory.ClientEventRead(msg);
}
break;
case EventType.Control:
@@ -379,7 +406,7 @@ namespace Barotrauma
float targetY = msg.ReadSingle();
Vector2 targetSimPos = new Vector2(targetX, targetY);
//255 = entity already removed, no need to do anything
if (attackLimbIndex == 255 || Removed) { break; }
if (attackLimbIndex == 255 || targetEntityID == NullEntityID || Removed) { break; }
if (attackLimbIndex >= AnimController.Limbs.Length)
{
//it's possible to get these errors when mid-round syncing, as the client may not
@@ -639,7 +666,7 @@ namespace Barotrauma
}
else
{
DebugConsole.ThrowError("Could not set order \"" + orderPrefab.Identifier + "\" for character \"" + character.Name + "\" because required target entity was not found.");
DebugConsole.AddSafeError("Could not set order \"" + orderPrefab.Identifier + "\" for character \"" + character.Name + "\" because required target entity was not found.");
}
}
else