v1.1.18.0 (Treacherous Tides Update)

This commit is contained in:
Regalis11
2023-10-19 19:28:43 +03:00
parent 34ffc520cc
commit df7e8f1625
21 changed files with 196 additions and 89 deletions
@@ -265,7 +265,7 @@ namespace Barotrauma
{
if (!IgnoreAtOutpost) { return false; }
if (!Level.IsLoadedFriendlyOutpost) { return false; }
if (!character.IsOnPlayerTeam) { return false; }
if (!character.IsOnPlayerTeam || character.IsFriendlyNPCTurnedHostile) { return false; }
if (character.Submarine?.Info == null) { return false; }
return character.Submarine.Info.IsOutpost && character.Submarine.TeamID == CharacterTeamType.FriendlyNPC;
}
@@ -339,6 +339,8 @@ namespace Barotrauma
public bool IsOriginallyOnPlayerTeam => originalTeamID == CharacterTeamType.Team1 || originalTeamID == CharacterTeamType.Team2;
public bool IsFriendlyNPCTurnedHostile => originalTeamID == CharacterTeamType.FriendlyNPC && teamID == CharacterTeamType.Team2;
public bool IsInstigator => CombatAction != null && CombatAction.IsInstigator;
public CombatAction CombatAction;
@@ -79,8 +79,11 @@ namespace Barotrauma
{
DebugConsole.ThrowError($"Error in event \"{ParentEvent.Prefab.Identifier}\". {nameof(CheckItemAction)} does't define either tags or identifiers of the item to check.");
}
checkPercentage = element.GetAttribute(nameof(RequiredConditionalMatchPercentage)) is not null;
if (checkPercentage && conditionals.None())
{
DebugConsole.ThrowError($"Error in event \"{ParentEvent.Prefab.Identifier}\". {nameof(CheckItemAction)} requires conditionals to be met on {requiredConditionalMatchPercentage}% of the targets, but there are no conditionals defined.");
}
if (Amount != 1 && checkPercentage)
{
DebugConsole.ThrowError($"Error in event \"{ParentEvent.Prefab.Identifier}\". Cannot define both '{Amount}' and '{RequiredConditionalMatchPercentage}' in {nameof(CheckItemAction)}.");
@@ -134,7 +137,8 @@ namespace Barotrauma
foreach (var target in targets)
{
if (target is not Item item) { continue; }
if (itemTags.Any(item.HasTag) || itemIdentifierSplit.Contains(item.Prefab.Identifier))
if (itemTags.Any(item.HasTag) || itemIdentifierSplit.Contains(item.Prefab.Identifier) ||
(itemTags.None() && itemIdentifierSplit.None() && conditionals.Any()))
{
if (ConditionalsMatch(item, character: null))
{
@@ -28,6 +28,9 @@ namespace Barotrauma
[Serialize(false, IsPropertySaveable.Yes)]
public bool ChooseRandom { get; set; }
[Serialize(false, IsPropertySaveable.Yes, description: "Should the event continue if the TagAction can't find any valid targets?")]
public bool ContinueIfNoTargetsFound { get; set; }
[Serialize(0.0f, IsPropertySaveable.Yes, description: "If larger than 0, the specified percentage of the matching targets are tagged. Between 0-100.")]
public float ChoosePercentage { get; set; }
@@ -279,7 +282,14 @@ namespace Barotrauma
}
}
isFinished = !targetNotFound;
if (ContinueIfNoTargetsFound)
{
isFinished = true;
}
else
{
isFinished = !targetNotFound;
}
}
public override string ToDebugString()
@@ -230,7 +230,7 @@ namespace Barotrauma
Bank = new Wallet(Option<Character>.None(), subElement);
break;
#if SERVER
case nameof(TraitorManager):
case "traitormanager":
GameMain.Server?.TraitorManager?.Load(subElement);
break;
case "savedexperiencepoints":
@@ -443,11 +443,11 @@ namespace Barotrauma.Items.Components
// Set the contained items active if there's an item inserted inside the container. Enables e.g. the rifle flashlight when it's attached to the rifle (put inside of it).
SetContainedActive(true);
}
if (containedItem.FlippedX)
if (containedItem.FlippedX != item.FlippedX)
{
containedItem.FlipX(relativeToSub: false);
}
if (containedItem.FlippedY)
if (containedItem.FlippedY != item.FlippedY)
{
containedItem.FlipY(relativeToSub: false);
}
@@ -1319,17 +1319,20 @@ namespace Barotrauma
}
}
for (int i = 0; i < components.Count && i < clone.components.Count; i++)
if (clonedContainedItems.Any())
{
ItemComponent component = components[i],
cloneComp = clone.components[i];
if (component is not CircuitBox origBox || cloneComp is not CircuitBox cloneBox)
for (int i = 0; i < components.Count && i < clone.components.Count; i++)
{
continue;
}
ItemComponent component = components[i],
cloneComp = clone.components[i];
cloneBox.CloneFrom(origBox, clonedContainedItems);
if (component is not CircuitBox origBox || cloneComp is not CircuitBox cloneBox)
{
continue;
}
cloneBox.CloneFrom(origBox, clonedContainedItems);
}
}
clone.FullyInitialized = true;
@@ -3230,7 +3233,7 @@ namespace Barotrauma
SetDroppedStackItemStates();
droppedStack = null;
#if SERVER
if (GameMain.NetworkMember is { IsServer: true } server)
if (GameMain.NetworkMember is { IsServer: true } server && !Removed)
{
server.CreateEntityEvent(this, new DroppedStackEventData(Enumerable.Empty<Item>()));
}
@@ -1379,7 +1379,7 @@ namespace Barotrauma
if (sub.Info.IsOutpost)
{
#if CLIENT
if (GameMain.GameSession.GameMode is TutorialMode) { continue; }
if (GameMain.GameSession?.GameMode is TutorialMode) { continue; }
#endif
OutpostGenerator.PowerUpOutpost(sub);
}
@@ -2106,7 +2106,7 @@ namespace Barotrauma
DebugConsole.ThrowError("Failed to generate alien ruins. Could not find any RuinGenerationParameters!");
return;
}
DebugConsole.NewMessage($"Creating alien ruins using {selectedRuinGenerationParams.Identifier} (preferred difficulty: {selectedRuinGenerationParams.PreferredDifficulty}, current difficulty {Difficulty})", color: Color.Yellow);
DebugConsole.NewMessage($"Creating alien ruins using {selectedRuinGenerationParams.Identifier} (preferred difficulty: {selectedRuinGenerationParams.PreferredDifficulty}, current difficulty {Difficulty})", color: Color.Yellow, debugOnly: true);
LocationType locationType = StartLocation?.Type;
if (locationType == null)
@@ -4559,7 +4559,7 @@ namespace Barotrauma
{
if (sub?.Info?.OutpostGenerationParams != null)
{
OutpostGenerator.SpawnNPCs((GameMain.GameSession?.GameMode as CampaignMode)?.Map?.CurrentLocation, sub);
OutpostGenerator.SpawnNPCs(StartLocation, sub);
}
}
}
@@ -1281,6 +1281,8 @@ namespace Barotrauma
explosionOnBroken.Attack.Range = explosionRange * gap.Open;
explosionOnBroken.Attack.DamageMultiplier = explosionStrength;
explosionOnBroken.Attack.Stun = MathHelper.Clamp(explosionStrength, 0.5f, 1.0f);
explosionOnBroken.IgnoredCharacters.Clear();
if (attacker?.AIController is EnemyAIController) { explosionOnBroken.IgnoredCharacters.Add(attacker); }
explosionOnBroken?.Explode(gap.WorldPosition, damageSource: null, attacker: attacker);
#if CLIENT
if (linkedHull != null)
@@ -2155,11 +2155,11 @@ namespace Barotrauma
rotation += spread;
if (projectile != null)
{
var sourceEntity = (sourceBody as ISpatialEntity) ?? entity;
var sourceEntity = (sourceBody?.UserData as ISpatialEntity) ?? entity;
Vector2 spawnPos = sourceEntity.SimPosition;
projectile.Shoot(user, spawnPos, spawnPos, rotation,
ignoredBodies: user?.AnimController.Limbs.Where(l => !l.IsSevered).Select(l => l.body.FarseerBody).ToList(), createNetworkEvent: true);
projectile.Item.Submarine = sourceEntity?.Submarine;
projectile.Item.Submarine = projectile.LaunchSub = sourceEntity?.Submarine;
}
else if (newItem.body != null)
{
@@ -218,6 +218,18 @@ namespace Barotrauma
public readonly int DangerLevel;
/// <summary>
/// An event of this danger level (or higher) must have been selected previously for this event to trigger.
/// It does not matter whether the event was completed successfully or not. Defaults to one less than the DangerLevel of this event.
/// </summary>
public readonly int RequiredPreviousDangerLevel;
/// <summary>
/// An event of a lower danger level must have been completed on the previous round for this event to trigger.
/// Defaults to false (no requirements)
/// </summary>
public readonly bool RequirePreviousDangerLevelCompleted;
/// <summary>
/// Minimum number of non-spectating human players on the server for the event to get selected.
/// </summary>
@@ -254,7 +266,10 @@ namespace Barotrauma
public TraitorEventPrefab(ContentXElement element, RandomEventsFile file, Identifier fallbackIdentifier = default)
: base(element, file, fallbackIdentifier)
{
DangerLevel = MathHelper.Clamp(element.GetAttributeInt(nameof(DangerLevel), MinDangerLevel), MinDangerLevel, MaxDangerLevel);
DangerLevel = MathHelper.Clamp(element.GetAttributeInt(nameof(DangerLevel), MinDangerLevel), min: MinDangerLevel, max: MaxDangerLevel);
RequiredPreviousDangerLevel = MathHelper.Clamp(element.GetAttributeInt(nameof(RequiredPreviousDangerLevel), def: DangerLevel - 1), min: 0, max: MaxDangerLevel - 1);
RequirePreviousDangerLevelCompleted = element.GetAttributeBool(nameof(RequirePreviousDangerLevelCompleted), false);
MinPlayerCount = element.GetAttributeInt(nameof(MinPlayerCount), 0);