Unstable v0.1300.0.0 (February 19th 2021)
This commit is contained in:
+25
-21
@@ -90,6 +90,10 @@ namespace Barotrauma
|
||||
AttachLimbName = null;
|
||||
AttachLimbType = LimbType.None;
|
||||
}
|
||||
|
||||
SendMessages = element.GetAttributeBool("sendmessages", true);
|
||||
CauseSpeechImpediment = element.GetAttributeBool("causespeechimpediment", true);
|
||||
NeedsAir = element.GetAttributeBool("needsair", false);
|
||||
}
|
||||
|
||||
// Use any of these to define which limb the appendage is attached to.
|
||||
@@ -101,9 +105,13 @@ namespace Barotrauma
|
||||
public readonly string HuskedSpeciesName;
|
||||
public readonly string[] TargetSpecies;
|
||||
public const string Tag = "[speciesname]";
|
||||
|
||||
public readonly bool SendMessages;
|
||||
public readonly bool CauseSpeechImpediment;
|
||||
public readonly bool NeedsAir;
|
||||
}
|
||||
|
||||
class AfflictionPrefab : IPrefab, IDisposable
|
||||
class AfflictionPrefab : IPrefab, IDisposable, IHasUintIdentifier
|
||||
{
|
||||
public class Effect
|
||||
{
|
||||
@@ -220,6 +228,7 @@ namespace Barotrauma
|
||||
public static AfflictionPrefab Bloodloss;
|
||||
public static AfflictionPrefab Pressure;
|
||||
public static AfflictionPrefab Stun;
|
||||
public static AfflictionPrefab RadiationSickness;
|
||||
|
||||
public static readonly PrefabCollection<AfflictionPrefab> Prefabs = new PrefabCollection<AfflictionPrefab>();
|
||||
|
||||
@@ -248,7 +257,7 @@ namespace Barotrauma
|
||||
/// Unique identifier that's generated by hashing the prefab's string identifier.
|
||||
/// Used to reduce the amount of bytes needed to write affliction data into network messages in multiplayer.
|
||||
/// </summary>
|
||||
public uint UIntIdentifier;
|
||||
public uint UIntIdentifier { get; set; }
|
||||
|
||||
// Arbitrary string that is used to identify the type of the affliction.
|
||||
public readonly string AfflictionType;
|
||||
@@ -265,6 +274,7 @@ namespace Barotrauma
|
||||
public ContentPackage ContentPackage { get; private set; }
|
||||
|
||||
public readonly string Name, Description;
|
||||
public readonly string TranslationOverride;
|
||||
public readonly bool IsBuff;
|
||||
|
||||
public readonly string CauseOfDeathDescription, SelfCauseOfDeathDescription;
|
||||
@@ -329,6 +339,7 @@ namespace Barotrauma
|
||||
Bloodloss = null;
|
||||
Pressure = null;
|
||||
Stun = null;
|
||||
RadiationSickness = null;
|
||||
#if CLIENT
|
||||
CharacterHealth.DamageOverlay?.Remove();
|
||||
CharacterHealth.DamageOverlay = null;
|
||||
@@ -353,6 +364,7 @@ namespace Barotrauma
|
||||
if (Bloodloss == null) { DebugConsole.ThrowError("Affliction \"Bloodloss\" not defined in the affliction prefabs."); }
|
||||
if (Pressure == null) { DebugConsole.ThrowError("Affliction \"Pressure\" not defined in the affliction prefabs."); }
|
||||
if (Stun == null) { DebugConsole.ThrowError("Affliction \"Stun\" not defined in the affliction prefabs."); }
|
||||
if (RadiationSickness == null) { DebugConsole.ThrowError("Affliction \"RadiationSickness\" not defined in the affliction prefabs."); }
|
||||
}
|
||||
|
||||
public static void LoadFromFile(ContentFile file)
|
||||
@@ -490,26 +502,16 @@ namespace Barotrauma
|
||||
case "stun":
|
||||
Stun = prefab;
|
||||
break;
|
||||
case "radiationsickness":
|
||||
RadiationSickness = prefab;
|
||||
break;
|
||||
}
|
||||
if (ImpactDamage == null) { ImpactDamage = InternalDamage; }
|
||||
|
||||
if (prefab != null)
|
||||
{
|
||||
Prefabs.Add(prefab, isOverride);
|
||||
}
|
||||
}
|
||||
|
||||
using MD5 md5 = MD5.Create();
|
||||
foreach (AfflictionPrefab prefab in Prefabs)
|
||||
{
|
||||
prefab.UIntIdentifier = ToolBox.StringToUInt32Hash(prefab.Identifier, md5);
|
||||
|
||||
//it's theoretically possible for two different values to generate the same hash, but the probability is astronomically small
|
||||
var collision = Prefabs.Find(p => p != prefab && p.UIntIdentifier == prefab.UIntIdentifier);
|
||||
if (collision != null)
|
||||
{
|
||||
DebugConsole.ThrowError("Hashing collision when generating uint identifiers for Afflictions: " + prefab.Identifier + " has the same identifier as " + collision.Identifier + " (" + prefab.UIntIdentifier + ")");
|
||||
collision.UIntIdentifier++;
|
||||
prefab.CalculatePrefabUIntIdentifier(Prefabs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -541,8 +543,10 @@ namespace Barotrauma
|
||||
Identifier = element.GetAttributeString("identifier", "");
|
||||
|
||||
AfflictionType = element.GetAttributeString("type", "");
|
||||
Name = TextManager.Get("AfflictionName." + Identifier, true) ?? element.GetAttributeString("name", "");
|
||||
Description = TextManager.Get("AfflictionDescription." + Identifier, true) ?? element.GetAttributeString("description", "");
|
||||
TranslationOverride = element.GetAttributeString("translationoverride", null);
|
||||
string translationId = TranslationOverride ?? Identifier;
|
||||
Name = TextManager.Get("AfflictionName." + translationId, true) ?? element.GetAttributeString("name", "");
|
||||
Description = TextManager.Get("AfflictionDescription." + translationId, true) ?? element.GetAttributeString("description", "");
|
||||
IsBuff = element.GetAttributeBool("isbuff", false);
|
||||
|
||||
LimbSpecific = element.GetAttributeBool("limbspecific", false);
|
||||
@@ -567,12 +571,12 @@ namespace Barotrauma
|
||||
|
||||
KarmaChangeOnApplied = element.GetAttributeFloat("karmachangeonapplied", 0.0f);
|
||||
|
||||
CauseOfDeathDescription = TextManager.Get("AfflictionCauseOfDeath." + Identifier, true) ?? element.GetAttributeString("causeofdeathdescription", "");
|
||||
SelfCauseOfDeathDescription = TextManager.Get("AfflictionCauseOfDeathSelf." + Identifier, true) ?? element.GetAttributeString("selfcauseofdeathdescription", "");
|
||||
CauseOfDeathDescription = TextManager.Get("AfflictionCauseOfDeath." + translationId, true) ?? element.GetAttributeString("causeofdeathdescription", "");
|
||||
SelfCauseOfDeathDescription = TextManager.Get("AfflictionCauseOfDeathSelf." + translationId, true) ?? element.GetAttributeString("selfcauseofdeathdescription", "");
|
||||
|
||||
IconColors = element.GetAttributeColorArray("iconcolors", null);
|
||||
AchievementOnRemoved = element.GetAttributeString("achievementonremoved", "");
|
||||
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||
|
||||
Reference in New Issue
Block a user