Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop

This commit is contained in:
EvilFactory
2025-04-10 10:37:09 -03:00
296 changed files with 8420 additions and 2945 deletions
@@ -1060,7 +1060,7 @@ namespace Barotrauma
get { return allPropertyObjects; }
}
public bool IgnoreByAI(Character character) => HasTag(Barotrauma.Tags.ItemIgnoredByAI) || OrderedToBeIgnored && character.IsOnPlayerTeam;
public bool IgnoreByAI(Character character) => HasTag(Barotrauma.Tags.IgnoredByAI) || OrderedToBeIgnored && character.IsOnPlayerTeam;
public bool OrderedToBeIgnored { get; set; }
public bool HasBallastFloraInHull
@@ -1902,7 +1902,6 @@ namespace Barotrauma
public void AddTag(Identifier tag)
{
if (tags.Contains(tag)) { return; }
tags.Add(tag);
}
@@ -1914,19 +1913,13 @@ namespace Barotrauma
public bool HasTag(Identifier tag)
{
if (tag == null) { return true; }
return tags.Contains(tag) || base.Prefab.Tags.Contains(tag);
}
public bool HasIdentifierOrTags(IEnumerable<Identifier> identifiersOrTags)
{
if (identifiersOrTags == null) { return false; }
if (identifiersOrTags.Contains(Prefab.Identifier)) { return true; }
foreach (Identifier tag in identifiersOrTags)
{
if (HasTag(tag)) { return true; }
}
return false;
return HasTag(identifiersOrTags);
}
public void ReplaceTag(string tag, string newTag)
@@ -1948,10 +1941,9 @@ namespace Barotrauma
public bool HasTag(IEnumerable<Identifier> allowedTags)
{
if (allowedTags == null) return true;
foreach (Identifier tag in allowedTags)
{
if (tags.Contains(tag)) return true;
if (HasTag(tag)) { return true; }
}
return false;
}
@@ -2063,7 +2055,7 @@ namespace Barotrauma
}
hasTargets = true;
targets.Add(containedItem);
targets.AddRange(containedItem.AllPropertyObjects);
}
}
@@ -2148,7 +2140,7 @@ namespace Barotrauma
}
public AttackResult AddDamage(Character attacker, Vector2 worldPosition, Attack attack, Vector2 impulseDirection, float deltaTime,bool playSound = true)
public AttackResult AddDamage(Character attacker, Vector2 worldPosition, Attack attack, Vector2 impulseDirection, float deltaTime, bool playSound = true)
{
if (Indestructible || InvulnerableToDamage) { return new AttackResult(); }
@@ -3107,8 +3099,11 @@ namespace Barotrauma
foreach (ItemComponent ic in components)
{
bool pickHit = false, selectHit = false;
if (user.IsKeyDown(InputType.Aim))
if (ic is not Ladder && user.IsKeyDown(InputType.Aim))
{
// Don't allow selecting items while aiming.
// This was added in cdc68f30. I can't remember what was the reason for it, but it might be related to accidental shots?
// However, we shouldn't disallow picking the ladders, because doing that would make the bot get stuck while trying to get on to ladders.
pickHit = false;
selectHit = false;
}
@@ -3662,6 +3657,9 @@ namespace Barotrauma
var allProperties = inGameEditableOnly ? GetInGameEditableProperties(ignoreConditions: true) : GetProperties<Editable>();
SerializableProperty property = extraData.SerializableProperty;
ISerializableEntity entity = extraData.Entity;
msg.WriteVariableUInt32((uint)allProperties.Count);
if (property != null)
{
if (allProperties.Count > 1)
@@ -3776,6 +3774,12 @@ namespace Barotrauma
var allProperties = inGameEditableOnly ? GetInGameEditableProperties(ignoreConditions: true) : GetProperties<Editable>();
if (allProperties.Count == 0) { return; }
int propertyCount = (int)msg.ReadVariableUInt32();
if (propertyCount != allProperties.Count)
{
throw new Exception($"Error in {nameof(ReadPropertyChange)}. The number of properties on the item \"{Prefab.Identifier}\" does not match between the server and the client. Server: {propertyCount}, client: {allProperties.Count}.");
}
int propertyIndex = 0;
if (allProperties.Count > 1)
{
@@ -3784,7 +3788,7 @@ namespace Barotrauma
if (propertyIndex >= allProperties.Count || propertyIndex < 0)
{
throw new Exception($"Error in ReadPropertyChange. Property index out of bounds (item: {Prefab.Identifier}, index: {propertyIndex}, property count: {allProperties.Count}, in-game editable only: {inGameEditableOnly})");
throw new Exception($"Error in {nameof(ReadPropertyChange)}. Property index out of bounds (item: {Prefab.Identifier}, index: {propertyIndex}, property count: {allProperties.Count}, in-game editable only: {inGameEditableOnly})");
}
bool allowEditing = true;
@@ -3953,7 +3957,7 @@ namespace Barotrauma
}
logPropertyChangeCoroutine = CoroutineManager.Invoke(() =>
{
GameServer.Log($"{sender.Character?.Name ?? sender.Name} set the value \"{property.Name}\" of the item \"{Name}\" to \"{logValue}\".", ServerLog.MessageType.ItemInteraction);
GameServer.Log($"{GameServer.CharacterLogName(sender.Character)} set the value \"{property.Name}\" of the item \"{Name}\" to \"{logValue}\".", ServerLog.MessageType.ItemInteraction);
}, delay: 1.0f);
}
#endif