Unstable 1.8.4.0
This commit is contained in:
+5
-6
@@ -1,11 +1,9 @@
|
||||
using Barotrauma.Extensions;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Xml.Linq;
|
||||
using Barotrauma.Extensions;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -55,18 +53,19 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
if (AfflictionPrefab.Prefabs.ContainsKey(identifier))
|
||||
if (AfflictionPrefab.Prefabs.TryGet(identifier, out var existingAffliction))
|
||||
{
|
||||
if (overriding)
|
||||
{
|
||||
DebugConsole.NewMessage(
|
||||
$"Overriding an affliction or a buff with the identifier '{identifier}' using the file '{Path}'",
|
||||
$"Overriding an affliction or a buff with the identifier '{identifier}' using the version in '{element.ContentPackage.Name}'",
|
||||
Color.MediumPurple);
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugConsole.ThrowError(
|
||||
$"Duplicate affliction: '{identifier}' defined in {elementName} of '{Path}'",
|
||||
$"Duplicate affliction: '{identifier}' defined in {element.ContentPackage.Name} is already defined in the previously loaded content package {existingAffliction.ContentPackage.Name}."+
|
||||
$" You may need to adjust the mod load order to make sure {element.ContentPackage.Name} is loaded first.",
|
||||
contentPackage: element?.ContentPackage);
|
||||
return;
|
||||
}
|
||||
|
||||
+22
-3
@@ -1,9 +1,28 @@
|
||||
namespace Barotrauma
|
||||
namespace Barotrauma
|
||||
{
|
||||
sealed class BackgroundCreaturePrefabsFile : OtherFile
|
||||
#if CLIENT
|
||||
[NotSyncedInMultiplayer]
|
||||
sealed class BackgroundCreaturePrefabsFile : GenericPrefabFile<BackgroundCreaturePrefab>
|
||||
{
|
||||
public BackgroundCreaturePrefabsFile(ContentPackage contentPackage, ContentPath path) : base(contentPackage, path) { }
|
||||
|
||||
//this content type only comes into play when a level is generated, so LoadFile and UnloadFile don't have anything to do
|
||||
protected override bool MatchesSingular(Identifier identifier) => !MatchesPlural(identifier);
|
||||
protected override bool MatchesPlural(Identifier identifier) => identifier == "backgroundcreatures";
|
||||
protected override PrefabCollection<BackgroundCreaturePrefab> Prefabs => BackgroundCreaturePrefab.Prefabs;
|
||||
protected override BackgroundCreaturePrefab CreatePrefab(ContentXElement element)
|
||||
{
|
||||
return new BackgroundCreaturePrefab(element, this);
|
||||
}
|
||||
|
||||
public sealed override Md5Hash CalculateHash() => Md5Hash.Blank;
|
||||
}
|
||||
#else
|
||||
[NotSyncedInMultiplayer]
|
||||
sealed class BackgroundCreaturePrefabsFile : OtherFile
|
||||
{
|
||||
public BackgroundCreaturePrefabsFile(ContentPackage contentPackage, ContentPath path) : base(contentPackage, path)
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
+15
-11
@@ -1,4 +1,4 @@
|
||||
using Barotrauma.Extensions;
|
||||
using Barotrauma.Extensions;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -86,23 +86,27 @@ namespace Barotrauma
|
||||
|
||||
if (ragdollParams != null)
|
||||
{
|
||||
HashSet<string> texturePaths = new HashSet<string>
|
||||
{
|
||||
ContentPath.FromRaw(CharacterPrefab.Prefabs[speciesName].ContentPackage, ragdollParams.Texture).Value
|
||||
};
|
||||
HashSet<ContentPath> texturePaths = new HashSet<ContentPath>();
|
||||
AddTexturePath(ragdollParams.Texture);
|
||||
foreach (RagdollParams.LimbParams limb in ragdollParams.Limbs)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(limb.normalSpriteParams?.Texture)) { texturePaths.Add(limb.normalSpriteParams.Texture); }
|
||||
if (!string.IsNullOrEmpty(limb.deformSpriteParams?.Texture)) { texturePaths.Add(limb.deformSpriteParams.Texture); }
|
||||
if (!string.IsNullOrEmpty(limb.damagedSpriteParams?.Texture)) { texturePaths.Add(limb.damagedSpriteParams.Texture); }
|
||||
AddTexturePath(limb.normalSpriteParams?.Texture);
|
||||
AddTexturePath(limb.deformSpriteParams?.Texture);
|
||||
AddTexturePath(limb.damagedSpriteParams?.Texture);
|
||||
foreach (var decorativeSprite in limb.decorativeSpriteParams)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(decorativeSprite.Texture)) { texturePaths.Add(decorativeSprite.Texture); }
|
||||
AddTexturePath(decorativeSprite.Texture);
|
||||
}
|
||||
}
|
||||
foreach (string texturePath in texturePaths)
|
||||
foreach (ContentPath texturePath in texturePaths)
|
||||
{
|
||||
addPreloadedSprite(new Sprite(texturePath, Vector2.Zero));
|
||||
addPreloadedSprite(new Sprite(texturePath.Value, Vector2.Zero));
|
||||
}
|
||||
|
||||
void AddTexturePath(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path)) { return; }
|
||||
texturePaths.Add(ContentPath.FromRaw(characterPrefab.ContentPackage, ragdollParams.Texture));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
internal sealed class DisembarkPerkFile : GenericPrefabFile<DisembarkPerkPrefab>
|
||||
{
|
||||
public DisembarkPerkFile(ContentPackage contentPackage, ContentPath path) : base(contentPackage, path) { }
|
||||
|
||||
protected override bool MatchesSingular(Identifier identifier) => identifier == "disembarkperk";
|
||||
protected override bool MatchesPlural(Identifier identifier) => identifier == "disembarkperks";
|
||||
protected override PrefabCollection<DisembarkPerkPrefab> Prefabs => DisembarkPerkPrefab.Prefabs;
|
||||
protected override DisembarkPerkPrefab CreatePrefab(ContentXElement element)
|
||||
{
|
||||
return new DisembarkPerkPrefab(element, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -1,4 +1,4 @@
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -77,12 +77,15 @@ namespace Barotrauma
|
||||
|
||||
var rootElement = doc.Root.FromPackage(ContentPackage);
|
||||
LoadFromXElement(rootElement, false);
|
||||
|
||||
EventSet.RefreshAllEventPrefabs();
|
||||
}
|
||||
|
||||
public override void UnloadFile()
|
||||
{
|
||||
EventPrefab.Prefabs.RemoveByFile(this);
|
||||
EventSet.Prefabs.RemoveByFile(this);
|
||||
EventSet.RefreshAllEventPrefabs();
|
||||
#if CLIENT
|
||||
EventSprite.Prefabs.RemoveByFile(this);
|
||||
#endif
|
||||
@@ -92,6 +95,9 @@ namespace Barotrauma
|
||||
{
|
||||
EventPrefab.Prefabs.SortAll();
|
||||
EventSet.Prefabs.SortAll();
|
||||
//need to referesh, because the order of the prefabs may affect which content package overrides some event
|
||||
EventSet.RefreshAllEventPrefabs();
|
||||
|
||||
#if CLIENT
|
||||
EventSprite.Prefabs.SortAll();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user