Unstable 1.8.4.0
This commit is contained in:
@@ -47,6 +47,7 @@ namespace Barotrauma
|
||||
SelectedCharacter,
|
||||
SelectedItem,
|
||||
SelectedSecondaryItem,
|
||||
AnimController.TargetMovement,
|
||||
AnimController.Anim);
|
||||
|
||||
memLocalState.Add(posInfo);
|
||||
@@ -56,7 +57,7 @@ namespace Barotrauma
|
||||
if (IsKeyDown(InputType.Right)) newInput |= InputNetFlags.Right;
|
||||
if (IsKeyDown(InputType.Up)) newInput |= InputNetFlags.Up;
|
||||
if (IsKeyDown(InputType.Down)) newInput |= InputNetFlags.Down;
|
||||
if (IsKeyDown(InputType.Run)) newInput |= InputNetFlags.Run;
|
||||
if (IsKeyDown(InputType.Run) || ToggleRun) newInput |= InputNetFlags.Run;
|
||||
if (IsKeyDown(InputType.Crouch)) newInput |= InputNetFlags.Crouch;
|
||||
if (IsKeyHit(InputType.Select)) newInput |= InputNetFlags.Select; //TODO: clean up the way this input is registered
|
||||
if (IsKeyHit(InputType.Deselect)) newInput |= InputNetFlags.Deselect;
|
||||
@@ -68,7 +69,7 @@ namespace Barotrauma
|
||||
if (IsKeyDown(InputType.Attack)) newInput |= InputNetFlags.Attack;
|
||||
if (IsKeyDown(InputType.Ragdoll)) newInput |= InputNetFlags.Ragdoll;
|
||||
|
||||
if (AnimController.TargetDir == Direction.Left) newInput |= InputNetFlags.FacingLeft;
|
||||
if (AnimController.Dir < 0) newInput |= InputNetFlags.FacingLeft;
|
||||
|
||||
Vector2 relativeCursorPos = cursorPosition - AimRefPosition;
|
||||
relativeCursorPos.Normalize();
|
||||
@@ -154,6 +155,9 @@ namespace Barotrauma
|
||||
case TreatmentEventData _:
|
||||
msg.WriteBoolean(AnimController.Anim == AnimController.Animation.CPR);
|
||||
break;
|
||||
case ConfirmRefundEventData _:
|
||||
//do nothing
|
||||
break;
|
||||
case CharacterStatusEventData _:
|
||||
//do nothing
|
||||
break;
|
||||
@@ -202,12 +206,16 @@ 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);
|
||||
}
|
||||
else if (AnimController is FishAnimController fishAnim)
|
||||
{
|
||||
fishAnim.Reverse = msg.ReadBoolean();
|
||||
}
|
||||
|
||||
bool attackInput = msg.ReadBoolean();
|
||||
keys[(int)InputType.Attack].Held = attackInput;
|
||||
@@ -255,17 +263,22 @@ namespace Barotrauma
|
||||
msg.ReadRangedSingle(-MaxVel, MaxVel, 12));
|
||||
linearVelocity = NetConfig.Quantize(linearVelocity, -MaxVel, MaxVel, 12);
|
||||
|
||||
Vector2 targetMovement = new Vector2(
|
||||
msg.ReadRangedSingle(-Ragdoll.MAX_SPEED, Ragdoll.MAX_SPEED, 12),
|
||||
msg.ReadRangedSingle(-Ragdoll.MAX_SPEED, Ragdoll.MAX_SPEED, 12));
|
||||
targetMovement = NetConfig.Quantize(targetMovement, -Ragdoll.MAX_SPEED, Ragdoll.MAX_SPEED, 12);
|
||||
|
||||
bool fixedRotation = msg.ReadBoolean();
|
||||
float? rotation = null;
|
||||
float? angularVelocity = null;
|
||||
if (!fixedRotation)
|
||||
{
|
||||
rotation = msg.ReadSingle();
|
||||
float MaxAngularVel = NetConfig.MaxPhysicsBodyAngularVelocity;
|
||||
angularVelocity = msg.ReadRangedSingle(-MaxAngularVel, MaxAngularVel, 8);
|
||||
angularVelocity = NetConfig.Quantize(angularVelocity.Value, -MaxAngularVel, MaxAngularVel, 8);
|
||||
angularVelocity = msg.ReadSingle();
|
||||
}
|
||||
|
||||
bool ignorePlatforms = msg.ReadBoolean();
|
||||
|
||||
bool readStatus = msg.ReadBoolean();
|
||||
if (readStatus)
|
||||
{
|
||||
@@ -287,7 +300,7 @@ namespace Barotrauma
|
||||
{
|
||||
byte happiness = msg.ReadByte();
|
||||
byte hunger = msg.ReadByte();
|
||||
if ((AIController as EnemyAIController)?.PetBehavior is PetBehavior petBehavior)
|
||||
if (AIController is EnemyAIController { PetBehavior: PetBehavior petBehavior })
|
||||
{
|
||||
petBehavior.Happiness = (float)happiness / byte.MaxValue * petBehavior.MaxHappiness;
|
||||
petBehavior.Hunger = (float)hunger / byte.MaxValue * petBehavior.MaxHunger;
|
||||
@@ -303,13 +316,13 @@ namespace Barotrauma
|
||||
msg.ReadPadBits();
|
||||
|
||||
int index = 0;
|
||||
if (GameMain.Client.Character == this && CanMove)
|
||||
if (GameMain.Client.Character == this)
|
||||
{
|
||||
var posInfo = new CharacterStateInfo(
|
||||
pos, rotation,
|
||||
networkUpdateID,
|
||||
facingRight ? Direction.Right : Direction.Left,
|
||||
selectedCharacter, selectedItem, selectedSecondaryItem, animation);
|
||||
selectedCharacter, selectedItem, selectedSecondaryItem, targetMovement, animation, ignorePlatforms);
|
||||
|
||||
while (index < memState.Count && NetIdUtils.IdMoreRecent(posInfo.ID, memState[index].ID))
|
||||
index++;
|
||||
@@ -321,7 +334,7 @@ namespace Barotrauma
|
||||
pos, rotation,
|
||||
linearVelocity, angularVelocity,
|
||||
sendingTime, facingRight ? Direction.Right : Direction.Left,
|
||||
selectedCharacter, selectedItem, selectedSecondaryItem, animation);
|
||||
selectedCharacter, selectedItem, selectedSecondaryItem, targetMovement, animation, ignorePlatforms);
|
||||
|
||||
while (index < memState.Count && posInfo.Timestamp > memState[index].Timestamp)
|
||||
index++;
|
||||
@@ -371,6 +384,9 @@ namespace Barotrauma
|
||||
GameMain.Client.HasSpawned = true;
|
||||
GameMain.Client.Character = this;
|
||||
GameMain.LightManager.LosEnabled = true;
|
||||
#if DEBUG
|
||||
GameMain.LightManager.LosEnabled = !GameMain.DevMode;
|
||||
#endif
|
||||
GameMain.LightManager.LosAlpha = 1f;
|
||||
GameMain.Client.WaitForNextRoundRespawn = null;
|
||||
}
|
||||
@@ -393,15 +409,16 @@ namespace Barotrauma
|
||||
break;
|
||||
case EventType.Status:
|
||||
ReadStatus(msg);
|
||||
GodMode = msg.ReadBoolean();
|
||||
break;
|
||||
case EventType.UpdateSkills:
|
||||
int skillCount = msg.ReadByte();
|
||||
for (int i = 0; i < skillCount; i++)
|
||||
Identifier skillIdentifier = msg.ReadIdentifier();
|
||||
if (!skillIdentifier.IsEmpty)
|
||||
{
|
||||
Identifier skillIdentifier = msg.ReadIdentifier();
|
||||
bool forceNotification = msg.ReadBoolean();
|
||||
float skillLevel = msg.ReadSingle();
|
||||
info?.SetSkillLevel(skillIdentifier, skillLevel);
|
||||
}
|
||||
info?.SetSkillLevel(skillIdentifier, skillLevel, forceNotification: forceNotification);
|
||||
}
|
||||
break;
|
||||
case EventType.SetAttackTarget:
|
||||
case EventType.ExecuteAttack:
|
||||
@@ -512,7 +529,12 @@ namespace Barotrauma
|
||||
break;
|
||||
case EventType.UpdateExperience:
|
||||
int experienceAmount = msg.ReadInt32();
|
||||
info?.SetExperience(experienceAmount);
|
||||
int additionalTalentPoints = msg.ReadInt32();
|
||||
if (info != null)
|
||||
{
|
||||
info.SetExperience(experienceAmount);
|
||||
info.AdditionalTalentPoints = additionalTalentPoints;
|
||||
}
|
||||
break;
|
||||
case EventType.UpdateTalents:
|
||||
ushort talentCount = msg.ReadUInt16();
|
||||
@@ -527,6 +549,20 @@ namespace Barotrauma
|
||||
int moneyAmount = msg.ReadInt32();
|
||||
SetMoney(moneyAmount);
|
||||
break;
|
||||
case EventType.UpdateTalentRefundPoints:
|
||||
int refundPoints = msg.ReadInt32();
|
||||
if (info != null)
|
||||
{
|
||||
if (refundPoints > info.TalentRefundPoints)
|
||||
{
|
||||
info.ShowTalentResetPopupOnOpen = true;
|
||||
}
|
||||
info.TalentRefundPoints = refundPoints;
|
||||
}
|
||||
break;
|
||||
case EventType.ConfirmTalentRefund:
|
||||
Info?.RefundTalents();
|
||||
break;
|
||||
case EventType.UpdatePermanentStats:
|
||||
byte savedStatValueCount = msg.ReadByte();
|
||||
StatTypes statType = (StatTypes)msg.ReadByte();
|
||||
@@ -730,7 +766,7 @@ namespace Barotrauma
|
||||
|
||||
if (character.IsHuman && character.TeamID != CharacterTeamType.FriendlyNPC && character.TeamID != CharacterTeamType.None)
|
||||
{
|
||||
CharacterInfo duplicateCharacterInfo = GameMain.GameSession.CrewManager.GetCharacterInfos().FirstOrDefault(c => c.ID == info.ID);
|
||||
CharacterInfo duplicateCharacterInfo = GameMain.GameSession.CrewManager.GetCharacterInfos(includeReserveBench: true).FirstOrDefault(c => c.ID == info.ID);
|
||||
GameMain.GameSession.CrewManager.RemoveCharacterInfo(duplicateCharacterInfo);
|
||||
if (character.isDead)
|
||||
{
|
||||
@@ -750,6 +786,9 @@ namespace Barotrauma
|
||||
if (!character.IsDead) { Controlled = character; }
|
||||
|
||||
GameMain.LightManager.LosEnabled = true;
|
||||
#if DEBUG
|
||||
GameMain.LightManager.LosEnabled = !GameMain.DevMode;
|
||||
#endif
|
||||
GameMain.LightManager.LosAlpha = 1f;
|
||||
|
||||
GameMain.NetLobbyScreen.CampaignCharacterDiscarded = false;
|
||||
@@ -817,6 +856,7 @@ namespace Barotrauma
|
||||
if (IsDead) { Revive(); }
|
||||
CharacterHealth.ClientRead(msg);
|
||||
}
|
||||
|
||||
byte severedLimbCount = msg.ReadByte();
|
||||
for (int i = 0; i < severedLimbCount; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user