Unstable 1.1.14.0

This commit is contained in:
Markus Isberg
2023-10-02 16:43:54 +03:00
parent 94f5a93a0c
commit cf8f0de659
606 changed files with 21906 additions and 11456 deletions
@@ -67,6 +67,22 @@ namespace Barotrauma
.ToImmutableHashSet();
}
public static bool IsLegacyContentType(XElement contentFileElement, ContentPackage package, bool logWarning)
{
Identifier elemName = contentFileElement.NameAsIdentifier();
if (elemName == "TraitorMissions")
{
if (logWarning)
{
DebugConsole.AddWarning(
$"The content type \"TraitorMission\" in content package \"{package.Name}\" is no longer supported." +
$" Traitor missions should be implemented using the scripted event system and the content type TraitorEvents.");
}
return true;
}
return false;
}
public static Result<ContentFile, ContentPackage.LoadError> CreateFromXElement(ContentPackage contentPackage, XElement element)
{
static Result<ContentFile, ContentPackage.LoadError> fail(string error, Exception? exception = null)
@@ -28,8 +28,16 @@ namespace Barotrauma
{
foreach (var subElement in parentElement.Elements())
{
var prefab = new EventPrefab(subElement, this);
EventPrefab.Prefabs.Add(prefab, overriding);
if (subElement.NameAsIdentifier() == "traitorevent")
{
var prefab = new TraitorEventPrefab(subElement, this);
EventPrefab.Prefabs.Add(prefab, overriding);
}
else
{
var prefab = new EventPrefab(subElement, this);
EventPrefab.Prefabs.Add(prefab, overriding);
}
}
}
else if (elemName == "eventsprites")
@@ -28,6 +28,10 @@ namespace Barotrauma
{
//Overrides for subs don't exist! Should we change this?
}
// Use byte-perfect hash because this is compressed, trimming whitespace is incorrect and needlessly slow here
public override Md5Hash CalculateHash()
=> Md5Hash.CalculateForFile(Path.FullPath, Md5Hash.StringHashOptions.BytePerfect);
}
[NotSyncedInMultiplayer]
@@ -1,26 +0,0 @@
using System.Xml.Linq;
#warning TODO: This file is just about the only thing that's actually somewhat okay about the current traitor system. Gut the whole thing.
#if CLIENT
using PrefabType = Barotrauma.TraitorMissionPrefab;
#elif SERVER
using PrefabType = Barotrauma.TraitorMissionPrefab.TraitorMissionEntry;
#endif
namespace Barotrauma
{
[RequiredByCorePackage]
sealed class TraitorMissionsFile : GenericPrefabFile<PrefabType>
{
public TraitorMissionsFile(ContentPackage contentPackage, ContentPath path) : base(contentPackage, path) { }
protected override bool MatchesSingular(Identifier identifier) => identifier == "TraitorMission";
protected override bool MatchesPlural(Identifier identifier) => identifier == "TraitorMissions";
protected override PrefabCollection<PrefabType> Prefabs => PrefabType.Prefabs;
protected override PrefabType CreatePrefab(ContentXElement element)
{
return new PrefabType(element, this);
}
}
}