v1.2.6.0 (Winter Update)

This commit is contained in:
Regalis11
2023-12-14 16:11:27 +02:00
parent af8cc89fce
commit b91e85559d
375 changed files with 7771 additions and 2874 deletions
@@ -60,12 +60,19 @@ namespace Barotrauma.Items.Components
set
{
if (parent == value) { return; }
if (parent != null) { parent.OnActiveStateChanged -= SetActiveState; }
if (value != null) { value.OnActiveStateChanged += SetActiveState; }
if (InheritParentIsActive)
{
if (parent != null) { parent.OnActiveStateChanged -= SetActiveState; }
if (value != null) { value.OnActiveStateChanged += SetActiveState; }
}
parent = value;
}
}
[Serialize(true, IsPropertySaveable.No, description: "If this is a child component of another component, should this component inherit the IsActive state of the parent?")]
public bool InheritParentIsActive { get; set; }
public readonly ContentXElement originalElement;
protected const float CorrectionDelay = 1.0f;
@@ -77,6 +84,12 @@ namespace Barotrauma.Items.Components
/// </summary>
public virtual bool DontTransferInventoryBetweenSubs => false;
/// <summary>
/// If enabled, the items inside any of the item containers on this item cannot be sold at an outpost.
/// Use in similar cases as <see cref="DontTransferInventoryBetweenSubs"/>.
/// </summary>
public virtual bool DisallowSellingItemsFromContainer => false;
[Editable, Serialize(0.0f, IsPropertySaveable.No, description: "How long it takes to pick up the item (in seconds).")]
public float PickingTime
{
@@ -291,7 +304,8 @@ namespace Barotrauma.Items.Components
}
catch (Exception e)
{
DebugConsole.ThrowError("Invalid select key in " + element + "!", e);
DebugConsole.ThrowError("Invalid select key in " + element + "!", e,
contentPackage: element.ContentPackage);
}
PickKey = InputType.Select;
@@ -304,7 +318,8 @@ namespace Barotrauma.Items.Components
}
catch (Exception e)
{
DebugConsole.ThrowError("Invalid pick key in " + element + "!", e);
DebugConsole.ThrowError("Invalid pick key in " + element + "!", e,
contentPackage: element.ContentPackage);
}
SerializableProperties = SerializableProperty.DeserializeProperties(this, element);
@@ -316,7 +331,8 @@ namespace Barotrauma.Items.Components
var component = item.Components.Find(ic => ic.Name.Equals(inheritRequiredSkillsFrom, StringComparison.OrdinalIgnoreCase));
if (component == null)
{
DebugConsole.ThrowError($"Error in item \"{item.Name}\" - component \"{name}\" is set to inherit its required skills from \"{inheritRequiredSkillsFrom}\", but a component of that type couldn't be found.");
DebugConsole.ThrowError($"Error in item \"{item.Name}\" - component \"{name}\" is set to inherit its required skills from \"{inheritRequiredSkillsFrom}\", but a component of that type couldn't be found.",
contentPackage: element.ContentPackage);
}
else
{
@@ -331,7 +347,8 @@ namespace Barotrauma.Items.Components
var component = item.Components.Find(ic => ic.Name.Equals(inheritStatusEffectsFrom, StringComparison.OrdinalIgnoreCase));
if (component == null)
{
DebugConsole.ThrowError($"Error in item \"{item.Name}\" - component \"{name}\" is set to inherit its StatusEffects from \"{inheritStatusEffectsFrom}\", but a component of that type couldn't be found.");
DebugConsole.ThrowError($"Error in item \"{item.Name}\" - component \"{name}\" is set to inherit its StatusEffects from \"{inheritStatusEffectsFrom}\", but a component of that type couldn't be found.",
contentPackage: element.ContentPackage);
}
else if (component.statusEffectLists != null)
{
@@ -366,7 +383,8 @@ namespace Barotrauma.Items.Components
case "requiredskills":
if (subElement.GetAttribute("name") != null)
{
DebugConsole.ThrowError("Error in item config \"" + item.ConfigFilePath + "\" - skill requirement in component " + GetType().ToString() + " should use a skill identifier instead of the name of the skill.");
DebugConsole.ThrowError("Error in item config \"" + item.ConfigFilePath + "\" - skill requirement in component " + GetType().ToString() + " should use a skill identifier instead of the name of the skill.",
contentPackage: element.ContentPackage);
continue;
}
@@ -383,8 +401,11 @@ namespace Barotrauma.Items.Components
if (ic == null) { break; }
ic.Parent = this;
ic.IsActive = isActive;
OnActiveStateChanged += ic.SetActiveState;
if (ic.InheritParentIsActive)
{
ic.IsActive = isActive;
OnActiveStateChanged += ic.SetActiveState;
}
item.AddComponent(ic);
break;
@@ -432,7 +453,8 @@ namespace Barotrauma.Items.Components
}
else if (!allowEmpty)
{
DebugConsole.ThrowError("Error in item config \"" + item.ConfigFilePath + "\" - component " + GetType().ToString() + " requires an item with no identifiers.");
DebugConsole.ThrowError("Error in item config \"" + item.ConfigFilePath + "\" - component " + GetType().ToString() + " requires an item with no identifiers.",
contentPackage: element.ContentPackage);
}
}
@@ -974,7 +996,8 @@ namespace Barotrauma.Items.Components
{
if (errorMessages)
{
DebugConsole.ThrowError($"Could not find the component \"{typeName}\" ({item.Prefab.ContentFile.Path})");
DebugConsole.ThrowError($"Could not find the component \"{typeName}\" ({item.Prefab.ContentFile.Path})",
contentPackage: element.ContentPackage);
}
return null;
}
@@ -983,7 +1006,8 @@ namespace Barotrauma.Items.Components
{
if (errorMessages)
{
DebugConsole.ThrowError($"Could not find the component \"{typeName}\" ({item.Prefab.ContentFile.Path})", e);
DebugConsole.ThrowError($"Could not find the component \"{typeName}\" ({item.Prefab.ContentFile.Path})", e,
contentPackage: element.ContentPackage);
}
return null;
}
@@ -996,14 +1020,16 @@ namespace Barotrauma.Items.Components
if (constructor == null)
{
DebugConsole.ThrowError(
$"Could not find the constructor of the component \"{typeName}\" ({item.Prefab.ContentFile.Path})");
$"Could not find the constructor of the component \"{typeName}\" ({item.Prefab.ContentFile.Path})",
contentPackage: element.ContentPackage);
return null;
}
}
catch (Exception e)
{
DebugConsole.ThrowError(
$"Could not find the constructor of the component \"{typeName}\" ({item.Prefab.ContentFile.Path})", e);
$"Could not find the constructor of the component \"{typeName}\" ({item.Prefab.ContentFile.Path})", e,
contentPackage: element.ContentPackage);
return null;
}
ItemComponent ic = null;
@@ -1016,7 +1042,7 @@ namespace Barotrauma.Items.Components
}
catch (TargetInvocationException e)
{
DebugConsole.ThrowError($"Error while loading component of the type {type}.", e.InnerException);
DebugConsole.ThrowError($"Error while loading component of the type {type}.", e.InnerException, contentPackage: element.ContentPackage);
GameAnalyticsManager.AddErrorEventOnce(
$"ItemComponent.Load:TargetInvocationException{item.Name}{element.Name}",
GameAnalyticsManager.ErrorSeverity.Error,