v1.5.7.0 (Summer Update)

This commit is contained in:
Regalis11
2024-06-18 16:49:51 +03:00
parent 4a63dacbce
commit 230d1b6e78
263 changed files with 7792 additions and 2845 deletions
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using Barotrauma.Items.Components;
namespace Barotrauma;
@@ -28,7 +29,8 @@ sealed class ConditionallyEditable : Editable
OnlyByStatusEffectsAndNetwork,
HasIntegratedButtons,
IsToggleableController,
HasConnectionPanel
HasConnectionPanel,
DeteriorateUnderStress
}
public bool IsEditable(ISerializableEntity entity)
@@ -55,10 +57,12 @@ sealed class ConditionallyEditable : Editable
ConditionType.HasIntegratedButtons
=> GetComponent<Door>(entity) is { HasIntegratedButtons: true },
ConditionType.IsToggleableController
=> GetComponent<Controller>(entity) is Controller { IsToggle: true } controller &&
=> GetComponent<Controller>(entity) is Controller { IsToggle: true } controller &&
controller.Item.GetComponent<ConnectionPanel>() != null,
ConditionType.HasConnectionPanel
=> GetComponent<ConnectionPanel>(entity) != null,
ConditionType.DeteriorateUnderStress
=> entity is Item repairableItem && repairableItem.Components.Any(c => c is IDeteriorateUnderStress),
_
=> false
};
@@ -1,5 +1,4 @@
using System;
using Barotrauma.Items.Components;
namespace Barotrauma;
@@ -11,8 +10,14 @@ class Editable : Attribute
public int MinValueInt = int.MinValue, MaxValueInt = int.MaxValue;
public float MinValueFloat = float.MinValue, MaxValueFloat = float.MaxValue;
public bool ForceShowPlusMinusButtons = false;
public bool ForceShowPlusMinusButtons;
public float ValueStep;
/// <summary>
/// Should the value customized in the editor be applied to the new item swapped in place of this item.
/// Used e.g. for transferring the auto operate properties from one turret to another installed on place of it.
/// </summary>
public bool TransferToSwappedItem;
/// <summary>
/// Labels of the components of a vector property (defaults to x,y,z,w)
@@ -9,9 +9,6 @@ using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Xml.Linq;
using Barotrauma.Networking;
//TODO: come back to this later, clever use of reflection would make this nicer >:)
namespace Barotrauma
{
@@ -45,14 +42,25 @@ namespace Barotrauma
/// Setting the value to a non-empty string will let the user select the text from one whose tag starts with the given string (e.g. RoomName. would show all texts with a RoomName.* tag)</param>
public Serialize(object defaultValue, IsPropertySaveable isSaveable, string description = "", string translationTextTag = "", bool alwaysUseInstanceValues = false)
{
this.DefaultValue = defaultValue;
this.IsSaveable = isSaveable;
this.TranslationTextTag = translationTextTag.ToIdentifier();
DefaultValue = defaultValue;
IsSaveable = isSaveable;
TranslationTextTag = translationTextTag.ToIdentifier();
Description = description;
AlwaysUseInstanceValues = alwaysUseInstanceValues;
}
}
[AttributeUsage(AttributeTargets.Property)]
public sealed class Header : Attribute
{
public readonly LocalizedString Text;
public Header(string text = "", string localizedTextTag = null)
{
Text = localizedTextTag != null ? TextManager.Get(localizedTextTag) : text;
}
}
public sealed class SerializableProperty
{
private static readonly ImmutableDictionary<Type, string> supportedTypes = new Dictionary<Type, string>
@@ -754,6 +762,9 @@ namespace Barotrauma
case nameof(Character.PropulsionSpeedMultiplier):
{ if (parentObject is Character character) { character.PropulsionSpeedMultiplier = value; return true; } }
break;
case nameof(Character.ObstructVisionAmount):
{ if (parentObject is Character character) { character.ObstructVisionAmount = value; return true; } }
break;
case nameof(Item.Scale):
{ if (parentObject is Item item) { item.Scale = value; return true; } }
break;