Unstable 1.2.4.0

This commit is contained in:
Markus Isberg
2023-11-30 13:53:00 +02:00
parent 8a2e2ea0ae
commit fb5ea537bf
210 changed files with 4201 additions and 1283 deletions
@@ -136,6 +136,7 @@ namespace Barotrauma
set
{
if (!MathUtils.IsValid(value)) { return; }
if (this != Controlled) { return; }
if (Screen.Selected?.Cam != null)
{
Screen.Selected.Cam.Shake = value;
@@ -521,22 +522,25 @@ namespace Barotrauma
if (controlled == this)
{
controlled = null;
if (!(Screen.Selected?.Cam is null))
if (Screen.Selected?.Cam is not null)
{
Screen.Selected.Cam.TargetPos = Vector2.Zero;
Lights.LightManager.ViewTarget = null;
}
}
sounds.ForEach(s => s.Sound?.Dispose());
sounds.Clear();
if (GameMain.GameSession?.CrewManager != null &&
GameMain.GameSession.CrewManager.GetCharacters().Contains(this))
{
GameMain.GameSession.CrewManager.RemoveCharacter(this);
}
if (GameMain.Client?.Character == this) GameMain.Client.Character = null;
if (Lights.LightManager.ViewTarget == this) Lights.LightManager.ViewTarget = null;
if (GameMain.Client?.Character == this) { GameMain.Client.Character = null; }
if (Lights.LightManager.ViewTarget == this) { Lights.LightManager.ViewTarget = null; }
}
@@ -894,7 +894,7 @@ namespace Barotrauma
if (!orderIndicatorCount.ContainsKey(target)) { orderIndicatorCount.Add(target, 0); }
Vector2 drawPos = target is Entity ? (target as Entity).DrawPosition :
Vector2 drawPos = target is Entity entity ? entity.DrawPosition :
target.Submarine == null ? target.Position : target.Position + target.Submarine.DrawPosition;
drawPos += Vector2.UnitX * order.SymbolSprite.size.X * 1.5f * orderIndicatorCount[target];
GUI.DrawIndicator(spriteBatch, drawPos, cam, 100.0f, order.SymbolSprite, order.Color * iconAlpha,
@@ -217,6 +217,7 @@ namespace Barotrauma
if ((int)newLevel > (int)prevLevel)
{
Character.Controlled?.SelectedItem?.OnPlayerSkillsChanged();
int increase = Math.Max((int)newLevel - (int)prevLevel, 1);
Character?.AddMessage(
@@ -518,7 +519,7 @@ namespace Barotrauma
attachment.Sprite.Draw(spriteBatch, drawPos, color ?? Color.White, origin, rotate: 0, scale: scale, depth: depth, spriteEffect: spriteEffects);
}
public static CharacterInfo ClientRead(Identifier speciesName, IReadMessage inc)
public static CharacterInfo ClientRead(Identifier speciesName, IReadMessage inc, bool requireJobPrefabFound = true)
{
ushort infoID = inc.ReadUInt16();
string newName = inc.ReadString();
@@ -554,14 +555,19 @@ namespace Barotrauma
if (jobIdentifier > 0)
{
jobPrefab = JobPrefab.Prefabs.Find(jp => jp.UintIdentifier == jobIdentifier);
if (jobPrefab == null)
if (jobPrefab == null && requireJobPrefabFound)
{
throw new Exception($"Error while reading {nameof(CharacterInfo)} received from the server: could not find a job prefab with the identifier \"{jobIdentifier}\".");
}
foreach (SkillPrefab skillPrefab in jobPrefab.Skills.OrderBy(s => s.Identifier))
byte skillCount = inc.ReadByte();
List<SkillPrefab> jobSkills = jobPrefab?.Skills.OrderBy(s => s.Identifier).ToList();
for (int i = 0; i < skillCount; i++)
{
float skillLevel = inc.ReadSingle();
skillLevels.Add(skillPrefab.Identifier, skillLevel);
if (jobSkills != null && i < jobSkills.Count)
{
skillLevels.Add(jobSkills[i].Identifier, skillLevel);
}
}
}
@@ -2170,6 +2170,8 @@ namespace Barotrauma
medUIExtra?.Remove();
medUIExtra = null;
Character.OnAttacked -= OnAttacked;
limbIndicatorOverlay?.Remove();
limbIndicatorOverlay = null;
@@ -1216,7 +1216,7 @@ namespace Barotrauma
pos: new Vector2(body.DrawPosition.X, -body.DrawPosition.Y),
srcRect: w.Sprite.SourceRect,
color: Color.White,
rotation: rotation,
rotationRad: rotation,
origin: origin,
scale: new Vector2(scale, scale),
effects: spriteEffect,