Build 0.21.6.0

This commit is contained in:
Markus Isberg
2023-01-31 18:01:29 +02:00
parent 697ec52120
commit 25fa5a9552
145 changed files with 2317 additions and 1145 deletions
@@ -109,15 +109,22 @@ namespace Barotrauma
return AccountId == other.AccountId && other.ClientAddress == ClientAddress;
}
public void Reset()
{
itemData = null;
healthData = null;
WalletData = null;
}
public void SpawnInventoryItems(Character character, Inventory inventory)
{
if (character == null)
{
throw new System.InvalidOperationException($"Failed to spawn inventory items. Character was null.");
throw new InvalidOperationException($"Failed to spawn inventory items. Character was null.");
}
if (itemData == null)
{
throw new System.InvalidOperationException($"Failed to spawn inventory items for the character \"{character.Name}\". No saved inventory data.");
throw new InvalidOperationException($"Failed to spawn inventory items for the character \"{character.Name}\". No saved inventory data.");
}
character.SpawnInventoryItems(inventory, itemData.FromPackage(null));
}
@@ -240,9 +240,7 @@ namespace Barotrauma
//reduce skills if the character has died
if (characterInfo.CauseOfDeath != null && characterInfo.CauseOfDeath.Type != CauseOfDeathType.Disconnected)
{
RespawnManager.ReduceCharacterSkills(characterInfo);
characterInfo.RemoveSavedStatValuesOnDeath();
characterInfo.CauseOfDeath = null;
characterInfo.ApplyDeathEffects();
}
c.CharacterInfo = characterInfo;
SetClientCharacterData(c);
@@ -254,13 +252,21 @@ namespace Barotrauma
{
if (data.HasSpawned && !GameMain.Server.ConnectedClients.Any(c => data.MatchesClient(c)))
{
var character = Character.CharacterList.Find(c => c.Info == data.CharacterInfo && !c.IsHusk);
if (character != null && (!character.IsDead || character.CauseOfDeath?.Type == CauseOfDeathType.Disconnected))
var character = Character.CharacterList.Find(c => c.Info == data.CharacterInfo && !c.IsHusk);
if (character != null &&
(!character.IsDead || character.CauseOfDeath?.Type == CauseOfDeathType.Disconnected))
{
//character still alive (or killed by Disconnect) -> save it as-is
characterData.RemoveAll(cd => cd.IsDuplicate(data));
data.Refresh(character);
characterData.Add(data);
}
else
{
//character dead or removed -> reduce skills, remove items, health data, etc
data.CharacterInfo.ApplyDeathEffects();
data.Reset();
}
}
}