Unstable 0.1300.0.9

This commit is contained in:
Markus Isberg
2021-04-13 16:58:13 +03:00
parent 86597456ca
commit f48dfb5862
30 changed files with 245 additions and 57 deletions
@@ -12,7 +12,7 @@ namespace Barotrauma
{ {
class CharacterHUD class CharacterHUD
{ {
const float BossHealthBarDuration = 1200.0f; const float BossHealthBarDuration = 120.0f;
class BossHealthBar class BossHealthBar
{ {
@@ -615,10 +615,6 @@ namespace Barotrauma
{ {
bossHealthBar.FadeTimer = Math.Min(bossHealthBar.FadeTimer, 5.0f); bossHealthBar.FadeTimer = Math.Min(bossHealthBar.FadeTimer, 5.0f);
} }
else if (bossHealthBar.Character.AIController is EnemyAIController enemyAI && !enemyAI.IsTargetingPlayerTeam)
{
bossHealthBar.FadeTimer = Math.Min(bossHealthBar.FadeTimer, 60.0f);
}
bossHealthBar.FadeTimer -= deltaTime; bossHealthBar.FadeTimer -= deltaTime;
} }
@@ -3198,10 +3198,10 @@ namespace Barotrauma
return characters.Where(c => Character.Controlled == null || ((includeSelf || c != Character.Controlled) && c.TeamID == Character.Controlled.TeamID)).Union(GetOrderableFriendlyNPCs()) return characters.Where(c => Character.Controlled == null || ((includeSelf || c != Character.Controlled) && c.TeamID == Character.Controlled.TeamID)).Union(GetOrderableFriendlyNPCs())
// 1. Prioritize those who are on the same submarine than the controlled character // 1. Prioritize those who are on the same submarine than the controlled character
.OrderByDescending(c => Character.Controlled == null || c.Submarine == Character.Controlled.Submarine) .OrderByDescending(c => Character.Controlled == null || c.Submarine == Character.Controlled.Submarine)
// 2. Prioritize those who are already ordered to operate the item target of the new 'operate' order, or given the same maintenance order as now issued // 2. Prioritize those who have been given the same maintenance or operate order as now issued
.ThenByDescending(c => c.CurrentOrders.Any(o => .ThenByDescending(c => c.CurrentOrders.Any(o =>
o.Order != null && o.Order.Identifier == order.Identifier && o.Order != null && o.Order.Identifier == order.Identifier &&
(order.Category == OrderCategory.Maintenance || (order.Category == OrderCategory.Operate && o.Order.TargetSpatialEntity == order.TargetSpatialEntity)))) (order.Category == OrderCategory.Maintenance || order.Category == OrderCategory.Operate)))
// 3. Prioritize those with the appropriate job for the order // 3. Prioritize those with the appropriate job for the order
.ThenByDescending(c => order.HasAppropriateJob(c)) .ThenByDescending(c => order.HasAppropriateJob(c))
// 4. Prioritize bots over player controlled characters // 4. Prioritize bots over player controlled characters
@@ -113,14 +113,16 @@ namespace Barotrauma
public static void OnSetSelectedConstruction(Character character, Item oldConstruction, Item newConstruction) public static void OnSetSelectedConstruction(Character character, Item oldConstruction, Item newConstruction)
{ {
if (oldConstruction == newConstruction) { return; } if (oldConstruction == newConstruction) { return; }
if (Character.Controlled != null && Character.Controlled == character && oldConstruction != null && oldConstruction.GetComponent<Ladder>() == null) if (Character.Controlled != null && Character.Controlled == character && oldConstruction != null && oldConstruction.GetComponent<Ladder>() == null)
{ {
TimeStoppedInteracting = Timing.TotalTime; TimeStoppedInteracting = Timing.TotalTime;
} }
if (newConstruction != null && newConstruction.GetComponent<Ladder>() == null)
{ if (newConstruction == null) { return; }
OnStartedInteracting(character, newConstruction); if (newConstruction.GetComponent<Ladder>() != null) { return; }
} if (newConstruction.GetComponent<ConnectionPanel>() is ConnectionPanel cp && cp.User == character) { return; }
OnStartedInteracting(character, newConstruction);
} }
private static void OnStartedInteracting(Character character, Item item) private static void OnStartedInteracting(Character character, Item item)
@@ -136,6 +138,9 @@ namespace Barotrauma
if (DisplayHint($"{hintIdentifierBase}.brokenitem")) { return; } if (DisplayHint($"{hintIdentifierBase}.brokenitem")) { return; }
} }
// Don't display other item-related hints if the repair interface is displayed
if (item.Repairables.Any(r => r.ShouldDrawHUD(character))) { return; }
// onstartedinteracting.lootingisstealing // onstartedinteracting.lootingisstealing
if (item.Submarine?.Info?.Type == SubmarineType.Outpost && if (item.Submarine?.Info?.Type == SubmarineType.Outpost &&
item.ContainedItems.Any(i => !i.AllowStealing)) item.ContainedItems.Any(i => !i.AllowStealing))
@@ -183,7 +183,8 @@ namespace Barotrauma
//reputation panel ------------------------------------------------------------------------------- //reputation panel -------------------------------------------------------------------------------
if (gameMode is CampaignMode campaignMode) var campaignMode = gameMode as CampaignMode;
if (campaignMode != null)
{ {
GUIFrame reputationframe = new GUIFrame(new RectTransform(crewFrame.RectTransform.RelativeSize, background.RectTransform, Anchor.TopCenter, minSize: crewFrame.RectTransform.MinSize)); GUIFrame reputationframe = new GUIFrame(new RectTransform(crewFrame.RectTransform.RelativeSize, background.RectTransform, Anchor.TopCenter, minSize: crewFrame.RectTransform.MinSize));
rightPanels.Add(reputationframe); rightPanels.Add(reputationframe);
@@ -217,7 +218,14 @@ namespace Barotrauma
}; };
List<Mission> missionsToDisplay = new List<Mission>(selectedMissions); List<Mission> missionsToDisplay = new List<Mission>(selectedMissions);
if (!selectedMissions.Any() && startLocation?.SelectedMission != null) { missionsToDisplay.Add(startLocation.SelectedMission); } if (!selectedMissions.Any() && startLocation?.SelectedMission != null)
{
if (startLocation.SelectedMission.Locations[0] == startLocation.SelectedMission.Locations[1] ||
startLocation.SelectedMission.Locations.Contains(campaignMode?.Map.SelectedLocation))
{
missionsToDisplay.Add(startLocation.SelectedMission);
}
}
if (missionsToDisplay.Any()) if (missionsToDisplay.Any())
{ {
@@ -461,6 +469,7 @@ namespace Barotrauma
new string[] { Reputation.GetFormattedReputationText(normalizedUnlockReputation, unlockEvent.UnlockPathReputation, addColorTags: true), $"‖color:gui.orange‖{connection.LevelData.Biome.DisplayName}‖end‖" }); new string[] { Reputation.GetFormattedReputationText(normalizedUnlockReputation, unlockEvent.UnlockPathReputation, addColorTags: true), $"‖color:gui.orange‖{connection.LevelData.Biome.DisplayName}‖end‖" });
var unlockInfoPanel = new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.0f), reputationFrame.RectTransform, Anchor.BottomCenter) { MinSize = new Point(0, GUI.IntScale(30)), AbsoluteOffset = new Point(0, GUI.IntScale(3)) }, var unlockInfoPanel = new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.0f), reputationFrame.RectTransform, Anchor.BottomCenter) { MinSize = new Point(0, GUI.IntScale(30)), AbsoluteOffset = new Point(0, GUI.IntScale(3)) },
unlockText, style: "GUIButtonRound", textAlignment: Alignment.Center, textColor: GUI.Style.TextColor, parseRichText: true); unlockText, style: "GUIButtonRound", textAlignment: Alignment.Center, textColor: GUI.Style.TextColor, parseRichText: true);
unlockInfoPanel.Color = Color.Lerp(unlockInfoPanel.Color, Color.Black, 0.8f);
if (unlockInfoPanel.TextSize.X > unlockInfoPanel.Rect.Width * 0.7f) if (unlockInfoPanel.TextSize.X > unlockInfoPanel.Rect.Width * 0.7f)
{ {
unlockInfoPanel.Font = GUI.SmallFont; unlockInfoPanel.Font = GUI.SmallFont;
@@ -1334,6 +1334,11 @@ namespace Barotrauma
OnSelected = (tickBox) => OnSelected = (tickBox) =>
{ {
DisableInGameHints = tickBox.Selected; DisableInGameHints = tickBox.Selected;
if (!DisableInGameHints && GameMain.Config?.IgnoredHints != null)
{
// Reset the ignored hints when the hints are re-enabled (to-be-replaced by a separate button)
GameMain.Config.IgnoredHints.Clear();
}
UnsavedSettings = true; UnsavedSettings = true;
return true; return true;
} }
@@ -705,11 +705,12 @@ namespace Barotrauma.Items.Components
if (c.Params.HideInSonar) { continue; } if (c.Params.HideInSonar) { continue; }
if (!c.IsUnconscious && c.Params.DistantSonarRange > 0.0f && if (!c.IsUnconscious && c.Params.DistantSonarRange > 0.0f &&
c.AIController is EnemyAIController enemyAI && enemyAI.IsTargetingPlayerTeam &&
((c.WorldPosition - transducerCenter) * displayScale).LengthSquared() > DisplayRadius * DisplayRadius) ((c.WorldPosition - transducerCenter) * displayScale).LengthSquared() > DisplayRadius * DisplayRadius)
{ {
float dist = Vector2.Distance(c.WorldPosition, transducerCenter); Vector2 targetVector = c.WorldPosition - transducerCenter;
Vector2 targetDir = (c.WorldPosition - transducerCenter) / dist; if (targetVector.LengthSquared() > MathUtils.Pow2(c.Params.DistantSonarRange)) { continue; }
float dist = targetVector.Length();
Vector2 targetDir = targetVector / dist;
int blipCount = (int)MathHelper.Clamp(c.Mass, 50, 200); int blipCount = (int)MathHelper.Clamp(c.Mass, 50, 200);
for (int i = 0; i < blipCount; i++) for (int i = 0; i < blipCount; i++)
{ {
@@ -70,6 +70,8 @@ namespace Barotrauma
private List<RichTextData> tooltipRichTextData; private List<RichTextData> tooltipRichTextData;
private string prevTooltip; private string prevTooltip;
private (SubmarineInfo pendingSub, float realWorldCrushDepth) pendingSubInfo;
/*private (Rectangle targetArea, string tip)? connectionTooltip; /*private (Rectangle targetArea, string tip)? connectionTooltip;
private string sanitizedConnectionTooltip; private string sanitizedConnectionTooltip;
private List<RichTextData> connectionTooltipRichTextData; private List<RichTextData> connectionTooltipRichTextData;
@@ -855,7 +857,21 @@ namespace Barotrauma
if (connection.LevelData.HasHuntingGrounds) { iconCount++; } if (connection.LevelData.HasHuntingGrounds) { iconCount++; }
if (connection.Locked) { iconCount++; } if (connection.Locked) { iconCount++; }
string tooltip = null; string tooltip = null;
var subCrushDepth = Submarine.MainSub?.RealWorldCrushDepth ?? Level.DefaultRealWorldCrushDepth; float subCrushDepth = Level.DefaultRealWorldCrushDepth;
var currentOrPendingSub = SubmarineSelection.CurrentOrPendingSubmarine();
if (Submarine.MainSub != null && Submarine.MainSub.Info == currentOrPendingSub)
{
subCrushDepth = Submarine.MainSub.RealWorldCrushDepth;
}
else if (currentOrPendingSub != null)
{
if (pendingSubInfo.pendingSub != currentOrPendingSub)
{
// Store the real world crush depth for the pending sub so that we don't have to calculate it again every time
pendingSubInfo = (currentOrPendingSub, currentOrPendingSub.GetRealWorldCrushDepth());
}
subCrushDepth = pendingSubInfo.realWorldCrushDepth;
}
if (GameMain.GameSession?.Campaign?.UpgradeManager != null) if (GameMain.GameSession?.Campaign?.UpgradeManager != null)
{ {
var hullUpgradePrefab = UpgradePrefab.Find("increasewallhealth"); var hullUpgradePrefab = UpgradePrefab.Find("increasewallhealth");
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product> <Product>Barotrauma</Product>
<Version>0.1300.0.8</Version> <Version>0.1300.0.9</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName> <AssemblyName>Barotrauma</AssemblyName>
+1 -1
View File
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product> <Product>Barotrauma</Product>
<Version>0.1300.0.8</Version> <Version>0.1300.0.9</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName> <AssemblyName>Barotrauma</AssemblyName>
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product> <Product>Barotrauma</Product>
<Version>0.1300.0.8</Version> <Version>0.1300.0.9</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName> <AssemblyName>Barotrauma</AssemblyName>
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product> <Product>Barotrauma Dedicated Server</Product>
<Version>0.1300.0.8</Version> <Version>0.1300.0.9</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName> <AssemblyName>DedicatedServer</AssemblyName>
+1 -1
View File
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product> <Product>Barotrauma Dedicated Server</Product>
<Version>0.1300.0.8</Version> <Version>0.1300.0.9</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName> <AssemblyName>DedicatedServer</AssemblyName>
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product> <Product>Barotrauma Dedicated Server</Product>
<Version>0.1300.0.8</Version> <Version>0.1300.0.9</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName> <AssemblyName>DedicatedServer</AssemblyName>
@@ -141,7 +141,8 @@ namespace Barotrauma
{ {
DialogueIdentifier = "dialogcannotreachtarget", DialogueIdentifier = "dialogcannotreachtarget",
TargetName = container.Item.Name, TargetName = container.Item.Name,
abortCondition = obj => !ItemToContain.IsOwnedBy(character) abortCondition = obj => !ItemToContain.IsOwnedBy(character),
SpeakIfFails = !objectiveManager.IsCurrentOrder<AIObjectiveCleanupItems>()
}, },
onAbandon: () => Abandon = true, onAbandon: () => Abandon = true,
onCompleted: () => RemoveSubObjective(ref goToObjective)); onCompleted: () => RemoveSubObjective(ref goToObjective));
@@ -87,6 +87,7 @@ namespace Barotrauma
}, },
onAbandon: () => onAbandon: () =>
{ {
getOxygen = null;
int remainingTanks = ReportOxygenTankCount(); int remainingTanks = ReportOxygenTankCount();
// Try to seek any oxygen sources. // Try to seek any oxygen sources.
TryAddSubObjective(ref getOxygen, () => TryAddSubObjective(ref getOxygen, () =>
@@ -354,6 +354,7 @@ namespace Barotrauma
#if DEBUG #if DEBUG
DebugConsole.NewMessage($"{character.Name}: Cannot find an item with the following identifier(s) or tag(s): {string.Join(", ", identifiersOrTags)}", Color.Yellow); DebugConsole.NewMessage($"{character.Name}: Cannot find an item with the following identifier(s) or tag(s): {string.Join(", ", identifiersOrTags)}", Color.Yellow);
#endif #endif
SpeakCannotFind();
Abandon = true; Abandon = true;
} }
} }
@@ -415,6 +416,24 @@ namespace Barotrauma
#if DEBUG #if DEBUG
DebugConsole.NewMessage($"{character.Name}: Get item failed to reach {moveToTarget}", Color.Yellow); DebugConsole.NewMessage($"{character.Name}: Get item failed to reach {moveToTarget}", Color.Yellow);
#endif #endif
}
private void SpeakCannotFind()
{
// TODO: Use the item name as the variable here.
if (character.IsOnPlayerTeam && objectiveManager.CurrentOrder == objectiveManager.CurrentObjective)
{
string msg = TextManager.Get("dialogcannotreachtarget", true);
if (msg != null)
{
character.Speak(msg, identifier: "dialogcannotfinditem", minDurationBetweenSimilar: 20.0f);
}
}
}
// TODO: remove?
private void SpeakCannotReach()
{
if (character.IsOnPlayerTeam && objectiveManager.CurrentOrder == objectiveManager.CurrentObjective) if (character.IsOnPlayerTeam && objectiveManager.CurrentOrder == objectiveManager.CurrentObjective)
{ {
string TargetName = (moveToTarget as MapEntity)?.Name ?? (moveToTarget as Character)?.Name ?? moveToTarget.ToString(); string TargetName = (moveToTarget as MapEntity)?.Name ?? (moveToTarget as Character)?.Name ?? moveToTarget.ToString();
@@ -166,7 +166,11 @@ namespace Barotrauma
coroutine = CoroutineManager.InvokeAfter(() => coroutine = CoroutineManager.InvokeAfter(() =>
{ {
//round ended before the coroutine finished //round ended before the coroutine finished
#if CLIENT
if (GameMain.GameSession == null || Level.Loaded == null && !(GameMain.GameSession.GameMode is TestGameMode)) { return; }
#else
if (GameMain.GameSession == null || Level.Loaded == null) { return; } if (GameMain.GameSession == null || Level.Loaded == null) { return; }
#endif
DelayedObjectives.Remove(objective); DelayedObjectives.Remove(objective);
AddObjective(objective); AddObjective(objective);
callback?.Invoke(); callback?.Invoke();
@@ -612,10 +612,11 @@ namespace Barotrauma
set set
{ {
#if CLIENT #if CLIENT
HintManager.OnSetSelectedConstruction(this, _selectedConstruction, value); var prevSelectedConstruction = _selectedConstruction;
#endif #endif
_selectedConstruction = value; _selectedConstruction = value;
#if CLIENT #if CLIENT
HintManager.OnSetSelectedConstruction(this, prevSelectedConstruction, _selectedConstruction);
if (Controlled == this) if (Controlled == this)
{ {
if (_selectedConstruction == null) if (_selectedConstruction == null)
@@ -3815,6 +3816,10 @@ namespace Barotrauma
} }
} }
} }
else
{
canBePutInOriginalInventory = inventory.CanBePut(newItem, slotIndices[0]);
}
if (canBePutInOriginalInventory) if (canBePutInOriginalInventory)
{ {
@@ -898,11 +898,11 @@ namespace Barotrauma
case HitDetection.Distance: case HitDetection.Distance:
if (dist < attack.DamageRange) if (dist < attack.DamageRange)
{ {
structureBody = Submarine.PickBody(simPos, attackSimPos, collisionCategory: Physics.CollisionWall | Physics.CollisionLevel, allowInsideFixture: true); structureBody = Submarine.PickBody(simPos, attackSimPos, collisionCategory: Physics.CollisionWall | Physics.CollisionLevel, allowInsideFixture: true, customPredicate:
if (structureBody?.UserData as string == "ruinroom") (Fixture f) =>
{ {
structureBody = null; return f?.Body?.UserData as string != "ruinroom";
} });
if (damageTarget is Item i && i.GetComponent<Items.Components.Door>() != null) if (damageTarget is Item i && i.GetComponent<Items.Components.Door>() != null)
{ {
// If the attack is aimed to an item and hits an item, it's successful. // If the attack is aimed to an item and hits an item, it's successful.
@@ -31,10 +31,10 @@ namespace Barotrauma
foreach (LocationConnection connection in GameMain.GameSession?.Map?.CurrentLocation?.Connections) foreach (LocationConnection connection in GameMain.GameSession?.Map?.CurrentLocation?.Connections)
{ {
if (!connection.Locked) { continue; } if (!connection.Locked) { continue; }
connection.Locked = false;
#if SERVER #if SERVER
NotifyUnlock(connection); NotifyUnlock(connection);
#else #else
connection.Locked = false;
new GUIMessageBox(string.Empty, TextManager.Get("pathunlockedgeneric"), new GUIMessageBox(string.Empty, TextManager.Get("pathunlockedgeneric"),
new string[0], type: GUIMessageBox.Type.InGame, iconStyle: "UnlockPathIcon", relativeSize: new Vector2(0.3f, 0.15f), minSize: new Point(512, 128)); new string[0], type: GUIMessageBox.Type.InGame, iconStyle: "UnlockPathIcon", relativeSize: new Vector2(0.3f, 0.15f), minSize: new Point(512, 128));
#endif #endif
@@ -115,7 +115,11 @@ namespace Barotrauma
{ {
if (Map.CurrentLocation?.SelectedMission != null) if (Map.CurrentLocation?.SelectedMission != null)
{ {
yield return Map.CurrentLocation.SelectedMission; if (Map.CurrentLocation.SelectedMission.Locations[0] == Map.CurrentLocation.SelectedMission.Locations[1] ||
Map.CurrentLocation.SelectedMission.Locations.Contains(Map.SelectedLocation))
{
yield return Map.CurrentLocation.SelectedMission;
}
} }
foreach (Mission mission in extraMissions) foreach (Mission mission in extraMissions)
{ {
@@ -279,7 +283,7 @@ namespace Barotrauma
{ {
Random rand = new MTRandom(ToolBox.StringToInt(levelData.Seed)); Random rand = new MTRandom(ToolBox.StringToInt(levelData.Seed));
var huntingGroundsMissionPrefab = huntingGroundsMissionPrefabs.GetRandom(rand); var huntingGroundsMissionPrefab = huntingGroundsMissionPrefabs.GetRandom(rand);
if (!Missions.Any(m => m.Prefab.Type == huntingGroundsMissionPrefab.Type)) if (!Missions.Any(m => m.Prefab.Tags.Any(t => t.Equals("huntinggrounds", StringComparison.OrdinalIgnoreCase))))
{ {
extraMissions.Add(huntingGroundsMissionPrefab.Instantiate(Map.SelectedConnection.Locations)); extraMissions.Add(huntingGroundsMissionPrefab.Instantiate(Map.SelectedConnection.Locations));
} }
@@ -590,8 +590,7 @@ namespace Barotrauma.Items.Components
var container = item.GetComponent<ItemContainer>(); var container = item.GetComponent<ItemContainer>();
if (objective.SubObjectives.None()) if (objective.SubObjectives.None())
{ {
int itemCount = item.ContainedItems.Count(i => i != null && container.ContainableItems.Any(ri => ri.MatchesItem(i))) + 1; var containObjective = AIContainItems<Reactor>(container, character, objective, itemCount: 1, equip: true, removeEmpty: true, spawnItemIfNotFound: character.TeamID == CharacterTeamType.FriendlyNPC, dropItemOnDeselected: true);
var containObjective = AIContainItems<Reactor>(container, character, objective, itemCount, equip: false, removeEmpty: true, spawnItemIfNotFound: character.TeamID == CharacterTeamType.FriendlyNPC, dropItemOnDeselected: true);
containObjective.Completed += ReportFuelRodCount; containObjective.Completed += ReportFuelRodCount;
containObjective.Abandoned += ReportFuelRodCount; containObjective.Abandoned += ReportFuelRodCount;
character.Speak(TextManager.Get("DialogReactorFuel"), null, 0.0f, "reactorfuel", 30.0f); character.Speak(TextManager.Get("DialogReactorFuel"), null, 0.0f, "reactorfuel", 30.0f);
@@ -613,19 +612,15 @@ namespace Barotrauma.Items.Components
} }
return outOfFuel; return outOfFuel;
} }
else if (TooMuchFuel()) else
{ {
if (item.OwnInventory?.AllItems != null) if (TooMuchFuel())
{ {
var container = item.GetComponent<ItemContainer>(); DropFuel(minCondition: 0.1f, maxCondition: 100);
foreach (Item item in item.OwnInventory.AllItemsMod) }
{ else
if (container.ContainableItems.Any(ri => ri.MatchesItem(item))) {
{ DropFuel(minCondition: 0, maxCondition: 0);
item.Drop(character);
break;
}
}
} }
} }
} }
@@ -692,6 +687,23 @@ namespace Barotrauma.Items.Components
aiUpdateTimer = AIUpdateInterval; aiUpdateTimer = AIUpdateInterval;
return false; return false;
} }
void DropFuel(float minCondition, float maxCondition)
{
if (item.OwnInventory?.AllItems != null)
{
var container = item.GetComponent<ItemContainer>();
foreach (Item item in item.OwnInventory.AllItemsMod)
{
if (item.ConditionPercentage <= maxCondition && item.ConditionPercentage >= minCondition)
{
item.Drop(character);
break;
}
}
}
}
} }
public override void OnMapLoaded() public override void OnMapLoaded()
@@ -735,6 +747,5 @@ namespace Barotrauma.Items.Components
break; break;
} }
} }
} }
} }
@@ -3598,10 +3598,13 @@ namespace Barotrauma
if (!(GameMain.NetworkMember?.IsClient ?? false)) if (!(GameMain.NetworkMember?.IsClient ?? false))
{ {
//empty the reactor //empty the reactor
foreach (Item item in reactorContainer.Inventory.AllItems) if (reactorContainer != null)
{ {
if (item.NonInteractable) { continue; } foreach (Item item in reactorContainer.Inventory.AllItems)
Spawner.AddToRemoveQueue(item); {
if (item.NonInteractable) { continue; }
Spawner.AddToRemoveQueue(item);
}
} }
//remove wires //remove wires
@@ -1082,6 +1082,7 @@ namespace Barotrauma
int currentLocationConnection = element.GetAttributeInt("currentlocationconnection", -1); int currentLocationConnection = element.GetAttributeInt("currentlocationconnection", -1);
if (currentLocationConnection >= 0) if (currentLocationConnection >= 0)
{ {
Connections[currentLocationConnection].Locked = false;
SelectLocation(Connections[currentLocationConnection].OtherLocation(CurrentLocation)); SelectLocation(Connections[currentLocationConnection].OtherLocation(CurrentLocation));
} }
else else
@@ -165,10 +165,7 @@ namespace Barotrauma
if (structure.Submarine != this || !structure.HasBody || structure.Indestructible) { continue; } if (structure.Submarine != this || !structure.HasBody || structure.Indestructible) { continue; }
realWorldCrushDepth = Math.Min(structure.CrushDepth, realWorldCrushDepth.Value); realWorldCrushDepth = Math.Min(structure.CrushDepth, realWorldCrushDepth.Value);
} }
if (Info.SubmarineClass == SubmarineClass.DeepDiver) realWorldCrushDepth *= Info.GetRealWorldCrushDepthMultiplier();
{
realWorldCrushDepth *= 1.2f;
}
} }
return realWorldCrushDepth.Value; return realWorldCrushDepth.Value;
} }
@@ -1060,6 +1057,7 @@ namespace Barotrauma
} }
steering.MaintainPos = true; steering.MaintainPos = true;
steering.PosToMaintain = WorldPosition;
steering.AutoPilot = true; steering.AutoPilot = true;
#if SERVER #if SERVER
steering.UnsentChanges = true; steering.UnsentChanges = true;
@@ -464,6 +464,49 @@ namespace Barotrauma
} }
} }
/// <summary>
/// Calculated from <see cref="SubmarineElement"/>. Can be used when the sub hasn't been loaded and we can't access <see cref="Submarine.RealWorldCrushDepth"/>.
/// </summary>
public float GetRealWorldCrushDepth()
{
if (SubmarineElement == null) { return Level.DefaultRealWorldCrushDepth; }
bool structureCrushDepthsDefined = false;
float realWorldCrushDepth = float.PositiveInfinity;
foreach (var structureElement in SubmarineElement.GetChildElements("structure"))
{
string name = structureElement.Attribute("name")?.Value ?? "";
string identifier = structureElement.GetAttributeString("identifier", "");
var structurePrefab = Structure.FindPrefab(name, identifier);
if (structurePrefab == null || !structurePrefab.Body) { continue; }
if (!structureCrushDepthsDefined && structureElement.Attribute("crushdepth") != null)
{
structureCrushDepthsDefined = true;
}
float structureCrushDepth = structureElement.GetAttributeFloat("crushdepth", float.PositiveInfinity);
realWorldCrushDepth = Math.Min(structureCrushDepth, realWorldCrushDepth);
}
if (!structureCrushDepthsDefined)
{
realWorldCrushDepth = Level.DefaultRealWorldCrushDepth;
}
realWorldCrushDepth *= GetRealWorldCrushDepthMultiplier();
return realWorldCrushDepth;
}
/// <summary>
/// Based on <see cref="SubmarineClass"/>
/// </summary>
public float GetRealWorldCrushDepthMultiplier()
{
if (SubmarineClass == SubmarineClass.DeepDiver)
{
return 1.2f;
}
else
{
return 1.0f;
}
}
//saving/loading ---------------------------------------------------- //saving/loading ----------------------------------------------------
public bool SaveAs(string filePath, System.IO.MemoryStream previewImage = null) public bool SaveAs(string filePath, System.IO.MemoryStream previewImage = null)
@@ -224,7 +224,7 @@ namespace Barotrauma
if (Character.Controlled != null && if (Character.Controlled != null &&
Lights.LightManager.ViewTarget != null) Lights.LightManager.ViewTarget != null)
{ {
Vector2 targetPos = Lights.LightManager.ViewTarget.DrawPosition; Vector2 targetPos = Lights.LightManager.ViewTarget.WorldPosition;
if (Lights.LightManager.ViewTarget == Character.Controlled && if (Lights.LightManager.ViewTarget == Character.Controlled &&
(CharacterHealth.OpenHealthWindow != null || CrewManager.IsCommandInterfaceOpen || ConversationAction.IsDialogOpen)) (CharacterHealth.OpenHealthWindow != null || CrewManager.IsCommandInterfaceOpen || ConversationAction.IsDialogOpen))
{ {
@@ -4,6 +4,7 @@ using Barotrauma.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Barotrauma.Extensions;
namespace Barotrauma namespace Barotrauma
{ {
@@ -202,6 +203,8 @@ namespace Barotrauma
return false; return false;
} }
private static readonly List<string> availableTexts = new List<string>();
public static string Get(string textTag, bool returnNull = false, string fallBackTag = null, bool useEnglishAsFallBack = true) public static string Get(string textTag, bool returnNull = false, string fallBackTag = null, bool useEnglishAsFallBack = true)
{ {
lock (mutex) lock (mutex)
@@ -228,11 +231,19 @@ namespace Barotrauma
return textTag; return textTag;
} }
#endif #endif
availableTexts.Clear();
foreach (TextPack textPack in textPacks[Language]) foreach (TextPack textPack in textPacks[Language])
{ {
string text = textPack.Get(textTag); var texts = textPack.GetAll(textTag);
if (text != null) { return text; } if (texts != null)
{
availableTexts.AddRange(texts);
}
}
if (availableTexts.Any())
{
return availableTexts.GetRandom().Replace(@"\n", "\n");
} }
if (!string.IsNullOrEmpty(fallBackTag)) if (!string.IsNullOrEmpty(fallBackTag))
@@ -84,6 +84,22 @@ namespace Barotrauma
return retval; return retval;
} }
public override int Next(int minValue, int maxValue)
{
int range = maxValue - minValue;
return minValue + Next(range);
}
public override void NextBytes(byte[] buffer)
{
throw new NotImplementedException();
}
public override void NextBytes(Span<byte> buffer)
{
throw new NotImplementedException();
}
/// <summary> /// <summary>
/// Returns a random value is greater or equal than 0 and less than maxValue /// Returns a random value is greater or equal than 0 and less than maxValue
/// </summary> /// </summary>
+39
View File
@@ -1,3 +1,42 @@
---------------------------------------------------------------------------------------------------------
v0.1300.0.9 (unstable)
---------------------------------------------------------------------------------------------------------
Changes:
- Re-enabling in-game hints now resets hints previously set not be shown again.
- Reduced the stun duration of Molochs' and Hammerheads' attacks. Also add some bitewounds damage on the Molochs' attacks so that they trigger all the AI reactions and don't get treated as failed attacks.
Fixes:
- Fixed occasional "mission mismatch" errors when entering a hunting grounds level in the multiplayer campaign.
- Fixed camera shaking/vibrating when moving at high speed.
- Fixed monsters being able to attack through ruin walls.
- Fixed overlapping vending machine & light switch in CrewModule_02.
- Fixed respawn shuttle maintaining an incorrect position after getting dispatched.
- Fixed selected mission carrying over to whichever level you choose in the campaign.
- Fixed diving suit's vision obstructing effect disappearing if you also wear a diving mask.
- Removed unnecessary extra light components from large and normal engine.
- Fixed "attempted to select a locked connection" error when a player joins mid-round after the path to the next biome has been unlocked.
- Fixed campaign map crush depth warnings being always calculated for the currently docked submarine, not taking a possible pending submarine switch into account.
- Fixed Hammerhead Spawns not targeting decoys.
- Fixed the abyss monsters not targeting "provocative" items, like flares, glowsticks, scooters etc.
- Fixed Hammerhead Matriarch constantly fleeing from divers. It's intentional that that the matriarch avoids the divers, but not as much. Now they should flee briefly only when shot by the player, making it possible for the divers to reach it (#5449).
- Fixed distant sonar waves not being visible in multiplayer.
- Fixed distant sonar waves being visible from too far away.
- Fixed the boss health bar vanishing too quickly in the multiplayer game mode.
- Fixed bots sometimes getting stuck while trying to find a safer room, if they fail to find any oxygen tanks. They should run to a safety instead.
- Fixed monsters moving weirdly in multiplayer game (only unstable).
Modding:
- Fixed custom loading screen tips not showing up if the vanilla content package is enabled.
- Fixed crashing when loading a save where a stack contains more items than the maximum stack size for the item/container.
Bots:
- Fixed bots reporting unnecessarily when they abort a cleaning up task (#5400). Also fixes (much more rare) unnecessary reporting with the other orders.
- Fixed some inconsistencies in the automatic crew selection logic used for assigning orders without specifying the target.
- Fixed bots putting multiple fuel rods in the reactor if there's more than one rod in the reactor (#5213). Fixed bots swapping out full fuel rods from the reactor (#5503). Both issues closely related.
- Fixed job specific autonomous objectives being broken in the sub test mode.
- Fixed bots taking items from fabricators and deconstructors (#5431).
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
v0.1300.0.8 (unstable) v0.1300.0.8 (unstable)
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------