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
@@ -85,7 +85,11 @@ namespace Barotrauma
AllowRotating,
Attachable,
HasBody,
Pickable
Pickable,
OnlyByStatusEffectsAndNetwork,
HasIntegratedButtons,
IsToggleableController,
HasConnectionPanel
}
public bool IsEditable(ISerializableEntity entity)
@@ -115,6 +119,26 @@ namespace Barotrauma
{
return entity is Item item && item.GetComponent<Pickable>() != null;
}
case ConditionType.HasIntegratedButtons:
{
return entity is Door door && door.HasIntegratedButtons;
}
case ConditionType.OnlyByStatusEffectsAndNetwork:
#if SERVER
return true;
#else
return false;
#endif
case ConditionType.IsToggleableController:
{
return entity is Controller controller && controller.IsToggle && controller.Item.GetComponent<ConnectionPanel>() != null;
}
case ConditionType.HasConnectionPanel:
{
return
(entity is Item item && item.GetComponent<ConnectionPanel>() != null) ||
(entity is ItemComponent ic && ic.Item.GetComponent<ConnectionPanel>() != null);
}
}
return false;
}
@@ -228,7 +252,7 @@ namespace Barotrauma
}
catch (Exception e)
{
DebugConsole.ThrowError("Failed to set the value of the property \"" + Name + "\" of \"" + parentObject + "\" to " + value + " (not a valid " + PropertyInfo.PropertyType + ")", e);
DebugConsole.ThrowError($"Failed to set the value of the property \"{Name}\" of \"{parentObject}\" to {value} (not a valid {PropertyInfo.PropertyType})", e);
return false;
}
try
@@ -237,7 +261,7 @@ namespace Barotrauma
}
catch (Exception e)
{
DebugConsole.ThrowError("Failed to set the value of the property \"" + Name + "\" of \"" + parentObject.ToString() + "\" to " + value.ToString(), e);
DebugConsole.ThrowError($"Failed to set the value of the property \"{Name}\" of \"{parentObject}\" to {value}", e);
return false;
}
}
@@ -320,7 +344,7 @@ namespace Barotrauma
}
catch (Exception e)
{
DebugConsole.ThrowError("Failed to set the value of the property \"" + Name + "\" of \"" + parentObject.ToString() + "\" to " + value.ToString(), e);
DebugConsole.ThrowError($"Failed to set the value of the property \"{Name}\" of \"{parentObject}\" to {value}", e);
return false;
}
@@ -403,14 +427,14 @@ namespace Barotrauma
PropertyInfo.SetValue(parentObject, XMLExtensions.ParseStringArray((string)value).ToIdentifiers().ToArray());
return true;
default:
DebugConsole.ThrowError("Failed to set the value of the property \"" + Name + "\" of \"" + parentObject.ToString() + "\" to " + value.ToString());
DebugConsole.ThrowError("(Cannot convert a string to a " + PropertyType.ToString() + ")");
DebugConsole.ThrowError($"Failed to set the value of the property \"{Name}\" of \"{parentObject}\" to {value}");
DebugConsole.ThrowError($"(Cannot convert a string to a {PropertyType})");
return false;
}
}
else if (PropertyType != value.GetType())
{
DebugConsole.ThrowError("Failed to set the value of the property \"" + Name + "\" of \"" + parentObject.ToString() + "\" to " + value.ToString());
DebugConsole.ThrowError($"Failed to set the value of the property \"{Name}\" of \"{parentObject}\" to {value}");
DebugConsole.ThrowError("(Non-matching type, should be " + PropertyType + " instead of " + value.GetType() + ")");
return false;
}
@@ -420,7 +444,7 @@ namespace Barotrauma
catch (Exception e)
{
DebugConsole.ThrowError("Failed to set the value of the property \"" + Name + "\" of \"" + parentObject.ToString() + "\" to " + value.ToString(), e);
DebugConsole.ThrowError($"Failed to set the value of the property \"{Name}\" of \"{parentObject}\" to {value}", e);
return false;
}
@@ -428,7 +452,7 @@ namespace Barotrauma
}
catch (Exception e)
{
DebugConsole.ThrowError("Error in SerializableProperty.TrySetValue", e);
DebugConsole.ThrowError($"Error in SerializableProperty.TrySetValue (Property: {PropertyInfo.Name})", e);
return false;
}
}
@@ -447,7 +471,7 @@ namespace Barotrauma
}
catch (Exception e)
{
DebugConsole.ThrowError("Error in SerializableProperty.TrySetValue", e);
DebugConsole.ThrowError($"Error in SerializableProperty.TrySetValue (Property: {PropertyInfo.Name})", e);
return false;
}
@@ -468,7 +492,7 @@ namespace Barotrauma
}
catch (Exception e)
{
DebugConsole.ThrowError("Error in SerializableProperty.TrySetValue", e);
DebugConsole.ThrowError($"Error in SerializableProperty.TrySetValue (Property: {PropertyInfo.Name})", e);
return false;
}
return true;
@@ -488,7 +512,7 @@ namespace Barotrauma
}
catch (Exception e)
{
DebugConsole.ThrowError("Error in SerializableProperty.TrySetValue", e);
DebugConsole.ThrowError($"Error in SerializableProperty.TrySetValue (Property: {PropertyInfo.Name})", e);
return false;
}
return true;
@@ -1051,12 +1075,18 @@ namespace Barotrauma
{
if (!subElement.Name.ToString().Equals("upgrade", StringComparison.OrdinalIgnoreCase)) { continue; }
var upgradeVersion = new Version(subElement.GetAttributeString("gameversion", "0.0.0.0"));
if (savedVersion >= upgradeVersion) { continue; }
if (subElement.GetAttributeBool("campaignsaveonly", false))
{
if ((GameMain.GameSession?.LastSaveVersion ?? GameMain.Version) >= upgradeVersion) { continue; }
}
else
{
if (savedVersion >= upgradeVersion) { continue; }
}
foreach (XAttribute attribute in subElement.Attributes())
{
var attributeName = attribute.NameAsIdentifier();
if (attributeName == "gameversion") { continue; }
if (attributeName == "gameversion" || attributeName == "campaignsaveonly") { continue; }
if (attributeName == "refreshrect")
{