Unstable 1.1.14.0
This commit is contained in:
@@ -376,10 +376,9 @@ namespace Barotrauma
|
||||
tempBuffer.WriteBoolean(aiming);
|
||||
tempBuffer.WriteBoolean(shoot);
|
||||
tempBuffer.WriteBoolean(use);
|
||||
if (AnimController is HumanoidAnimController)
|
||||
{
|
||||
tempBuffer.WriteBoolean(((HumanoidAnimController)AnimController).Crouching);
|
||||
}
|
||||
|
||||
tempBuffer.WriteBoolean(AnimController is HumanoidAnimController { Crouching: true });
|
||||
|
||||
tempBuffer.WriteBoolean(attack);
|
||||
|
||||
Vector2 relativeCursorPos = cursorPosition - AimRefPosition;
|
||||
@@ -430,21 +429,31 @@ namespace Barotrauma
|
||||
if (writeStatus)
|
||||
{
|
||||
WriteStatus(tempBuffer);
|
||||
AIController?.ServerWrite(tempBuffer);
|
||||
tempBuffer.WriteBoolean(AIController is EnemyAIController);
|
||||
if (AIController is EnemyAIController enemyAi)
|
||||
{
|
||||
tempBuffer.WriteByte((byte)enemyAi.State);
|
||||
tempBuffer.WriteBoolean(enemyAi.PetBehavior is PetBehavior);
|
||||
if (enemyAi.PetBehavior is PetBehavior petBehavior)
|
||||
{
|
||||
tempBuffer.WriteByte((byte)((petBehavior.Happiness / petBehavior.MaxHappiness) * byte.MaxValue));
|
||||
tempBuffer.WriteByte((byte)((petBehavior.Hunger / petBehavior.MaxHunger) * byte.MaxValue));
|
||||
}
|
||||
}
|
||||
HealthUpdatePending = false;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ServerEventWrite(IWriteMessage msg, Client c, NetEntityEvent.IData extraData = null)
|
||||
{
|
||||
if (!(extraData is IEventData eventData)) { throw new Exception($"Malformed character event: expected {nameof(Character)}.{nameof(IEventData)}, got {extraData?.GetType().Name ?? "[NULL]"}"); }
|
||||
if (extraData is not IEventData eventData) { throw new Exception($"Malformed character event: expected {nameof(Character)}.{nameof(IEventData)}, got {extraData?.GetType().Name ?? "[NULL]"}"); }
|
||||
|
||||
msg.WriteRangedInteger((int)eventData.EventType, (int)EventType.MinValue, (int)EventType.MaxValue);
|
||||
switch (eventData)
|
||||
{
|
||||
case InventoryStateEventData _:
|
||||
case InventoryStateEventData inventoryData:
|
||||
msg.WriteUInt16(GameMain.Server.EntityEventManager.Events.Last()?.ID ?? (ushort)0);
|
||||
Inventory.ServerEventWrite(msg, c);
|
||||
Inventory.ServerEventWrite(msg, c, inventoryData);
|
||||
break;
|
||||
case ControlEventData controlEventData:
|
||||
Client owner = controlEventData.Owner;
|
||||
@@ -473,12 +482,12 @@ namespace Barotrauma
|
||||
case IAttackEventData attackEventData:
|
||||
{
|
||||
int attackLimbIndex = Removed ? -1 : Array.IndexOf(AnimController.Limbs, attackEventData.AttackLimb);
|
||||
ushort targetEntityId = 0;
|
||||
ushort targetEntityId = NullEntityID;
|
||||
int targetLimbIndex = -1;
|
||||
if (attackEventData.TargetEntity is Entity { Removed: false } targetEntity)
|
||||
{
|
||||
targetEntityId = targetEntity.ID;
|
||||
if (targetEntity is Character { AnimController: { Limbs: var targetLimbsArray } })
|
||||
if (targetEntity is Character { AnimController.Limbs: var targetLimbsArray })
|
||||
{
|
||||
targetLimbIndex = targetLimbsArray.IndexOf(attackEventData.TargetLimb);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user