Unstable 1.1.14.0
This commit is contained in:
@@ -143,7 +143,14 @@ namespace Barotrauma
|
||||
|
||||
protected override string GetName() => "Character Config File";
|
||||
|
||||
public override ContentXElement MainElement => base.MainElement.IsOverride() ? base.MainElement.FirstElement() : base.MainElement;
|
||||
public override ContentXElement MainElement
|
||||
{
|
||||
get
|
||||
{
|
||||
if (base.MainElement == null) { return null; }
|
||||
return base.MainElement.IsOverride() ? base.MainElement.FirstElement() : base.MainElement;
|
||||
}
|
||||
}
|
||||
|
||||
public static XElement CreateVariantXml(XElement variantXML, XElement baseXML)
|
||||
{
|
||||
@@ -182,6 +189,11 @@ namespace Barotrauma
|
||||
{
|
||||
UpdatePath(File.Path);
|
||||
doc = XMLExtensions.TryLoadXml(Path);
|
||||
if (MainElement == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Main element null! Failed to load character params.");
|
||||
return false;
|
||||
}
|
||||
Identifier variantOf = MainElement.VariantOf();
|
||||
if (!variantOf.IsEmpty)
|
||||
{
|
||||
@@ -230,6 +242,11 @@ namespace Barotrauma
|
||||
|
||||
protected void CreateSubParams()
|
||||
{
|
||||
if (MainElement == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Main element null, cannot create sub params!");
|
||||
return;
|
||||
}
|
||||
SubParams.Clear();
|
||||
var healthElement = MainElement.GetChildElement("health");
|
||||
if (healthElement != null)
|
||||
@@ -745,7 +762,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (!TryGetTarget(targetCharacter.SpeciesName, out target))
|
||||
{
|
||||
target = targets.FirstOrDefault(t => string.Equals(t.Tag, targetCharacter.Params.Group.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
target = targets.FirstOrDefault(t => t.Tag == targetCharacter.Params.Group);
|
||||
}
|
||||
return target != null;
|
||||
}
|
||||
@@ -791,7 +808,7 @@ namespace Barotrauma
|
||||
public override string Name => "Target";
|
||||
|
||||
[Serialize("", IsPropertySaveable.Yes, description: "Can be an item tag, species name or something else. Examples: decoy, provocative, light, dead, human, crawler, wall, nasonov, sonar, door, stronger, weaker, light, human, room..."), Editable()]
|
||||
public string Tag { get; private set; }
|
||||
public Identifier Tag { get; private set; }
|
||||
|
||||
[Serialize(AIState.Idle, IsPropertySaveable.Yes), Editable]
|
||||
public AIState State { get; set; }
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Barotrauma
|
||||
element ??= MainElement;
|
||||
if (element == null)
|
||||
{
|
||||
DebugConsole.ThrowError("[EditableParams] The XML element is null!");
|
||||
DebugConsole.ThrowError("[EditableParams] The XML element is null! Failed to save the parameters.");
|
||||
return false;
|
||||
}
|
||||
SerializableProperty.SerializeProperties(this, element, true);
|
||||
@@ -82,7 +82,16 @@ namespace Barotrauma
|
||||
{
|
||||
UpdatePath(file);
|
||||
doc = XMLExtensions.TryLoadXml(Path);
|
||||
if (doc == null) { return false; }
|
||||
if (doc == null)
|
||||
{
|
||||
DebugConsole.ThrowError("[EditableParams] The document is null! Failed to load the parameters.");
|
||||
return false;
|
||||
}
|
||||
if (MainElement == null)
|
||||
{
|
||||
DebugConsole.ThrowError("[EditableParams] The main element is null! Failed to load the parameters.");
|
||||
return false;
|
||||
}
|
||||
IsLoaded = Deserialize(MainElement);
|
||||
OriginalElement = new XElement(MainElement).FromPackage(MainElement.ContentPackage);
|
||||
return IsLoaded;
|
||||
|
||||
+14
-8
@@ -315,20 +315,26 @@ namespace Barotrauma
|
||||
protected void CreateColliders()
|
||||
{
|
||||
Colliders.Clear();
|
||||
for (int i = 0; i < MainElement.GetChildElements("collider").Count(); i++)
|
||||
if (MainElement?.GetChildElements("collider") is { } colliderElements)
|
||||
{
|
||||
var element = MainElement.GetChildElements("collider").ElementAt(i);
|
||||
string name = i > 0 ? "Secondary Collider" : "Main Collider";
|
||||
Colliders.Add(new ColliderParams(element, this, name));
|
||||
for (int i = 0; i < colliderElements.Count(); i++)
|
||||
{
|
||||
var element = colliderElements.ElementAt(i);
|
||||
string name = i > 0 ? "Secondary Collider" : "Main Collider";
|
||||
Colliders.Add(new ColliderParams(element, this, name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void CreateLimbs()
|
||||
{
|
||||
Limbs.Clear();
|
||||
foreach (var element in MainElement.GetChildElements("limb"))
|
||||
if (MainElement?.GetChildElements("limb") is { } childElements)
|
||||
{
|
||||
Limbs.Add(new LimbParams(element, this));
|
||||
foreach (var element in childElements)
|
||||
{
|
||||
Limbs.Add(new LimbParams(element, this));
|
||||
}
|
||||
}
|
||||
Limbs = Limbs.OrderBy(l => l.ID).ToList();
|
||||
}
|
||||
@@ -430,8 +436,8 @@ namespace Barotrauma
|
||||
copy.Serialize();
|
||||
Memento.Store(copy);
|
||||
}
|
||||
public void Undo() => RevertTo(Memento.Undo() as RagdollParams);
|
||||
public void Redo() => RevertTo(Memento.Redo() as RagdollParams);
|
||||
public void Undo() => RevertTo(Memento.Undo());
|
||||
public void Redo() => RevertTo(Memento.Redo());
|
||||
public void ClearHistory() => Memento.Clear();
|
||||
|
||||
private void RevertTo(RagdollParams source)
|
||||
|
||||
Reference in New Issue
Block a user