v1.1.18.0 (Treacherous Tides Update)

This commit is contained in:
Regalis11
2023-10-19 17:18:51 +03:00
parent 12e43d95ef
commit 34ffc520cc
20 changed files with 179 additions and 43 deletions
@@ -154,7 +154,8 @@ namespace Barotrauma
}
var order = new Order(orderPrefab, autonomousObjective.Option, item ?? character.CurrentHull as Entity, orderPrefab.GetTargetItemComponent(item), orderGiver: character);
if (order == null) { continue; }
if ((order.IgnoreAtOutpost || autonomousObjective.IgnoreAtOutpost) && Level.IsLoadedFriendlyOutpost && character.TeamID != CharacterTeamType.FriendlyNPC)
if ((order.IgnoreAtOutpost || autonomousObjective.IgnoreAtOutpost) &&
Level.IsLoadedFriendlyOutpost && character.TeamID != CharacterTeamType.FriendlyNPC && !character.IsFriendlyNPCTurnedHostile)
{
if (Submarine.MainSub != null && Submarine.MainSub.DockedTo.None(s => s.TeamID != CharacterTeamType.FriendlyNPC && s.TeamID != character.TeamID))
{
@@ -1188,6 +1188,33 @@ namespace Barotrauma
throw new Exception("crash command issued");
}));
commands.Add(new Command("listeditableproperties", "", (string[] args) =>
{
StringBuilder sb = new StringBuilder();
string filename;
#if CLIENT
filename = "ItemComponent properties (client).txt";
sb.AppendLine("Client-side ItemComponent properties:");
#else
filename = "ItemComponent properties (server).txt";
sb.AppendLine("Server-side ItemComponent properties:");
#endif
var itemComponents = typeof(ItemComponent).Assembly.GetTypes().Where(type => type.IsSubclassOf(typeof(ItemComponent)));
foreach (var ic in itemComponents.OrderBy(ic => ic.Name))
{
sb.AppendLine(ic.Name+":");
foreach (var prop in ic.GetProperties())
{
if (prop.DeclaringType != ic) { continue; }
if (prop.GetCustomAttributes(inherit: false).OfType<Editable>().Any())
{
sb.AppendLine(prop.Name);
}
}
}
File.WriteAllText(filename, sb.ToString());
}));
commands.Add(new Command("fastforward", "fastforward [seconds]: Fast forwards the game by x seconds. Note that large numbers may cause a long freeze.", (string[] args) =>
{
float seconds = 0;
@@ -1300,7 +1327,7 @@ namespace Barotrauma
}
#endif
commands.Add(new Command("showreputation", "showreputation: List the current reputation values.", (string[] args) =>
commands.Add(new Command("showreputation", "showreputation: List the current reputation values.", (string[] args) =>
{
if (GameMain.GameSession?.GameMode is CampaignMode campaign)
{
@@ -132,6 +132,11 @@ namespace Barotrauma
/// </summary>
public readonly List<Identifier> AllowedLocationTypes = new List<Identifier>();
/// <summary>
/// The mission can only happen in locations owned by this faction. In the mission mode, the location is forced to be owned by this faction.
/// </summary>
public readonly Identifier RequiredLocationFaction;
/// <summary>
/// Show entities belonging to these sub categories when the mission starts
/// </summary>
@@ -198,6 +203,7 @@ namespace Barotrauma
RequireWreck = element.GetAttributeBool("requirewreck", false);
RequireRuin = element.GetAttributeBool("requireruin", false);
BlockLocationTypeChanges = element.GetAttributeBool(nameof(BlockLocationTypeChanges), false);
RequiredLocationFaction = element.GetAttributeIdentifier(nameof(RequiredLocationFaction), Identifier.Empty);
Commonness = element.GetAttributeInt("commonness", 1);
AllowOtherMissionsInLevel = element.GetAttributeBool("allowothermissionsinlevel", true);
if (element.GetAttribute("difficulty") != null)
@@ -378,7 +384,11 @@ namespace Barotrauma
{
if (from == to)
{
return
if (!RequiredLocationFaction.IsEmpty && from.Faction?.Prefab.Identifier != RequiredLocationFaction)
{
return false;
}
return
AllowedLocationTypes.Any(lt => lt == "any") ||
AllowedLocationTypes.Any(lt => lt == "anyoutpost" && from.HasOutpost()) ||
AllowedLocationTypes.Any(lt => lt == from.Type.Identifier);
@@ -2,7 +2,6 @@
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
namespace Barotrauma
{
@@ -18,7 +17,7 @@ namespace Barotrauma
public Reputation Reputation { get; }
public FactionPrefab Prefab { get; }
public Faction(CampaignMetadata metadata, FactionPrefab prefab)
public Faction(CampaignMetadata? metadata, FactionPrefab prefab)
{
Prefab = prefab;
Reputation = new Reputation(metadata, this, prefab.MinReputation, prefab.MaxReputation, prefab.InitialReputation);
@@ -42,10 +42,10 @@ namespace Barotrauma
public float Value
{
get => Math.Min(MaxReputation, Metadata.GetFloat(metaDataIdentifier, InitialReputation));
get => Metadata == null ? 0 : Math.Min(MaxReputation, Metadata.GetFloat(metaDataIdentifier, InitialReputation));
private set
{
if (MathUtils.NearlyEqual(Value, value)) { return; }
if (MathUtils.NearlyEqual(Value, value) || Metadata == null) { return; }
float prevValue = Value;
@@ -137,7 +137,6 @@ namespace Barotrauma
private Reputation(CampaignMetadata metadata, Faction faction, Location location, Identifier identifier, int minReputation, int maxReputation, int initialReputation)
{
System.Diagnostics.Debug.Assert(metadata != null);
System.Diagnostics.Debug.Assert(faction != null || location != null);
Metadata = metadata;
Identifier = identifier;
@@ -388,6 +388,11 @@ namespace Barotrauma
.Where(lt => missionPrefab.AllowedLocationTypes.Any(m => m == lt.Identifier))
.GetRandom(rand);
dummyLocations = CreateDummyLocations(levelSeed, locationType);
if (!mission.Prefab.RequiredLocationFaction.IsEmpty &&
FactionPrefab.Prefabs.TryGet(mission.Prefab.RequiredLocationFaction, out var factionPrefab))
{
dummyLocations[0].Faction = dummyLocations[1].Faction = new Faction(metadata: null, factionPrefab);
}
randomLevel = LevelData.CreateRandom(levelSeed, difficulty, levelGenerationParams, requireOutpost: true);
break;
}
@@ -83,6 +83,7 @@ namespace Barotrauma.Items.Components
public Attack Attack { get; private set; }
private Vector2 launchPos;
public Submarine LaunchSub;
private readonly HashSet<Body> hits = new HashSet<Body>();
@@ -362,6 +363,7 @@ namespace Barotrauma.Items.Components
User = user;
if (Item.Removed) { return; }
launchPos = simPosition;
LaunchSub = item.Submarine;
//set the rotation of the projectile again because dropping the projectile resets the rotation
Item.SetTransform(simPosition, rotation + (Item.body.Dir * LaunchRotationRadians), findNewHull: false);
if (DeactivationTime > 0)
@@ -478,6 +480,7 @@ namespace Barotrauma.Items.Components
Item.WaterDragCoefficient = WaterDragCoefficient;
launchPos = item.SimPosition;
LaunchSub = item.Submarine;
item.body.Enabled = true;
if (item.body.BodyType == BodyType.Kinematic)
@@ -369,6 +369,13 @@ namespace Barotrauma.Items.Components
[Serialize("", IsPropertySaveable.Yes, description: "[Auto Operate] Group or SpeciesName that the AI ignores when the turret is operated automatically."), Editable]
public Identifier FriendlyTag { get; private set; }
[Editable, Serialize("0,0,0,0", IsPropertySaveable.Yes, description: "Optional screen tint color when the item is being operated (R,G,B,A).")]
public Color HudTint
{
get;
private set;
}
public Turret(Item item, ContentXElement element)
: base(item, element)
{
@@ -1129,7 +1129,11 @@ namespace Barotrauma
var preferredContainer = new PreferredContainer(subElement);
if (preferredContainer.Primary.Count == 0 && preferredContainer.Secondary.Count == 0)
{
DebugConsole.ThrowError($"Error in item prefab \"{ToString()}\": preferred container has no preferences defined ({subElement}).");
//it's ok for variants to clear the primary and secondary containers to disable the PreferredContainer element
if (variantOf == null)
{
DebugConsole.ThrowError($"Error in item prefab \"{ToString()}\": preferred container has no preferences defined ({subElement}).");
}
}
else
{
@@ -173,6 +173,8 @@ namespace Barotrauma
public readonly HashSet<Submarine> IgnoredSubmarines = new HashSet<Submarine>();
public readonly HashSet<Character> IgnoredCharacters = new HashSet<Character>();
/// <summary>
/// Strength of the EMP effect created by the explosion.
/// </summary>
@@ -437,6 +439,8 @@ namespace Barotrauma
foreach (Character c in Character.CharacterList)
{
if (IgnoredCharacters.Contains(c)) { continue; }
if (!c.Enabled ||
Math.Abs(c.WorldPosition.X - worldPosition.X) > broadRange ||
Math.Abs(c.WorldPosition.Y - worldPosition.Y) > broadRange)
@@ -490,8 +490,8 @@ namespace Barotrauma
foreach (var moduleCount in generationParams.ModuleCounts)
{
if (!moduleCount.RequiredFaction.IsEmpty &&
location.Faction?.Prefab.Identifier != moduleCount.RequiredFaction &&
location.SecondaryFaction?.Prefab.Identifier != moduleCount.RequiredFaction)
location?.Faction?.Prefab.Identifier != moduleCount.RequiredFaction &&
location?.SecondaryFaction?.Prefab.Identifier != moduleCount.RequiredFaction)
{
continue;
}