v0.18.15.0

This commit is contained in:
Regalis11
2022-07-14 16:54:36 +03:00
parent 497045de7e
commit 4a03ee5ab2
36 changed files with 240 additions and 151 deletions
@@ -14,7 +14,7 @@ namespace Barotrauma
{
public abstract class ContentPackage
{
public static readonly Version MinimumHashCompatibleVersion = new Version(0, 18, 3, 0);
public static readonly Version MinimumHashCompatibleVersion = new Version(0, 18, 13, 0);
public const string LocalModsDir = "LocalMods";
public static readonly string WorkshopModsDir = Barotrauma.IO.Path.Combine(
@@ -180,7 +180,7 @@ namespace Barotrauma
{
if (!condition)
{
throw new InvalidOperationException($"Failed to load \"{Name ?? Path}\": {errorMsg}");
throw new InvalidOperationException($"Failed to load \"{Name}\" at {Path}: {errorMsg}");
}
}
@@ -1034,13 +1034,13 @@ namespace Barotrauma
foreach (Item item in Item.ItemList)
{
if (item.Removed) { continue; }
if (item.NonInteractable) { continue; }
if (item.NonInteractable || item.NonPlayerTeamInteractable) { continue; }
if (item.HiddenInGame) { continue; }
if (!connectedSubs.Contains(item.Submarine)) { continue; }
if (item.Prefab.DontTransferBetweenSubs) { continue; }
var rootOwner = item.GetRootInventoryOwner();
if (rootOwner is Character) { continue; }
if (rootOwner is Item ownerItem && (ownerItem.NonInteractable || ownerItem.HiddenInGame)) { continue; }
if (rootOwner is Item ownerItem && (ownerItem.NonInteractable || item.NonPlayerTeamInteractable || ownerItem.HiddenInGame)) { continue; }
if (item.GetComponent<Door>() != null) { continue; }
if (item.Components.None(c => c is Pickable)) { continue; }
if (item.Components.Any(c => c is Pickable p && p.IsAttached)) { continue; }
@@ -1067,7 +1067,7 @@ namespace Barotrauma
var connectedSubs = newSub.GetConnectedSubs().Where(s => s.Info.Type == SubmarineType.Player).ToHashSet();
// Move the transferred items
List<ItemContainer> availableContainers = Item.ItemList
.Where(it => connectedSubs.Contains(it.Submarine) && it.HasTag("crate") && !it.NonInteractable && !it.HiddenInGame && !it.Removed)
.Where(it => connectedSubs.Contains(it.Submarine) && it.HasTag("crate") && !it.NonInteractable && !it.NonPlayerTeamInteractable && !it.HiddenInGame && !it.Removed)
.Select(it => it.GetComponent<ItemContainer>())
.Where(c => c != null)
.ToList();
@@ -16,6 +16,7 @@ namespace Barotrauma
Deselect,
Shoot,
Command,
ToggleInventory,
TakeOneFromInventorySlot,
TakeHalfFromInventorySlot,
NextFireMode,
@@ -191,7 +191,7 @@ namespace Barotrauma.Items.Components
while (impactQueue.Count > 0)
{
var impact = impactQueue.Dequeue();
HandleImpact(impact.Body);
HandleImpact(impact);
}
//in case handling the impact does something to the picker
if (picker == null) { return; }
@@ -342,7 +342,7 @@ namespace Barotrauma.Items.Components
}
hitTargets.Add(targetCharacter);
}
else if (f2.Body.UserData is Structure targetStructure)
else if ((f2.Body.UserData as Structure ?? f2.UserData as Structure) is Structure targetStructure)
{
if (AllowHitMultiple)
{
@@ -380,8 +380,9 @@ namespace Barotrauma.Items.Components
return true;
}
private void HandleImpact(Body target)
private void HandleImpact(Fixture targetFixture)
{
var target = targetFixture.Body;
if (User == null || User.Removed || target == null)
{
RestoreCollision();
@@ -410,7 +411,7 @@ namespace Barotrauma.Items.Components
targetCharacter.LastDamageSource = item;
Attack.DoDamage(User, targetCharacter, item.WorldPosition, 1.0f);
}
else if (target.UserData is Structure targetStructure)
else if ((target.UserData as Structure ?? targetFixture.UserData as Structure) is Structure targetStructure)
{
if (targetStructure.Removed) { return; }
Attack.DoDamage(User, targetStructure, item.WorldPosition, 1.0f);
@@ -742,7 +742,7 @@ namespace Barotrauma.Items.Components
limb.body?.ApplyLinearImpulse(item.body.LinearVelocity * item.body.Mass * 0.1f, item.SimPosition);
return false;
}
if (!FriendlyFire && User != null && limb.character.IsFriendly(User))
if (!FriendlyFire && User != null && limb.character.IsFriendly(User) && HumanAIController.IsOnFriendlyTeam(limb.character, User))
{
return false;
}
@@ -238,6 +238,12 @@ namespace Barotrauma.Items.Components
base.OnItemLoaded();
SetLightSourceState(IsActive, lightBrightness);
turret = item.GetComponent<Turret>();
#if CLIENT
if (Screen.Selected.IsEditor)
{
OnMapLoaded();
}
#endif
}
public override void OnMapLoaded()
@@ -1,12 +1,11 @@
using System;
using System.Text.RegularExpressions;
using System.Xml.Linq;
namespace Barotrauma.Items.Components
{
class RegExFindComponent : ItemComponent
{
private static readonly TimeSpan timeout = TimeSpan.FromSeconds(Timing.Step);
private static readonly TimeSpan timeout = TimeSpan.FromMilliseconds(1);
private string expression;
@@ -63,10 +62,9 @@ namespace Barotrauma.Items.Components
get { return expression; }
set
{
if (expression == value) return;
if (expression == value) { return; }
expression = value;
previousReceivedSignal = "";
try
{
regex = new Regex(
@@ -74,11 +72,12 @@ namespace Barotrauma.Items.Components
options: RegexOptions.None,
matchTimeout: timeout);
}
catch
{
return;
}
//reactivate the component, in case some faulty/malicious expression caused it to time out and deactivate itself
IsActive = true;
}
}
@@ -105,11 +104,16 @@ namespace Barotrauma.Items.Components
}
catch (Exception e)
{
item.SendSignal(
e is RegexMatchTimeoutException
? "TIMEOUT"
: "ERROR",
"signal_out");
if (e is RegexMatchTimeoutException)
{
item.SendSignal("TIMEOUT", "signal_out");
//deactivate the component if the expression caused it to time out
IsActive = false;
}
else
{
item.SendSignal("ERROR", "signal_out");
}
previousResult = false;
return;
}
@@ -308,6 +308,8 @@ namespace Barotrauma.MapCreatures.Behavior
private BallastFloraBranch? root;
private readonly List<Body> bodies = new List<Body>();
private bool isDead;
public readonly BallastFloraStateMachine StateMachine;
public int GrowthWarps;
@@ -1230,6 +1232,8 @@ namespace Barotrauma.MapCreatures.Behavior
public void Kill()
{
isDead = true;
foreach (var branch in Branches)
{
branch.DisconnectedFromRoot = true;
@@ -203,7 +203,7 @@ namespace Barotrauma
if (Screen.Selected == GameMain.SubEditorScreen)
{
linkedSub = CreateDummy(submarine, element, pos, id);
linkedSub.saveElement = element;
linkedSub.saveElement = new XElement(element);
linkedSub.purchasedLostShuttles = false;
}
else
@@ -215,7 +215,7 @@ namespace Barotrauma
purchasedLostShuttles =
(GameMain.GameSession?.GameMode is CampaignMode campaign && campaign.PurchasedLostShuttles) ||
element.GetAttributeBool("purchasedlostshuttle", false),
saveElement = element
saveElement = new XElement(element)
};
bool levelMatches = string.IsNullOrWhiteSpace(levelSeed) || levelData == null || levelData.Seed == levelSeed;
@@ -453,12 +453,15 @@ namespace Barotrauma
saveElement.SetAttributeValue("pos", XMLExtensions.Vector2ToString(Position - Submarine.HiddenSubPosition));
var linkedPort =
linkedTo.FirstOrDefault(lt => (lt is Item item) && item.GetComponent<DockingPort>() != null) ??
FindEntityByID(linkedToID.First()) as MapEntity;
if (linkedPort != null)
if (linkedTo.Any() || linkedToID.Any())
{
saveElement.SetAttributeValue("linkedto", linkedPort.ID);
var linkedPort =
linkedTo.FirstOrDefault(lt => (lt is Item item) && item.GetComponent<DockingPort>() != null) ??
FindEntityByID(linkedToID.First()) as MapEntity;
if (linkedPort != null)
{
saveElement.SetAttributeValue("linkedto", linkedPort.ID);
}
}
}
else
@@ -113,15 +113,23 @@ namespace Barotrauma
string teamStr = element.GetAttributeString("outpostteam", "FriendlyNPC");
Enum.TryParse(teamStr, out OutpostTeam);
ContentPath nameFile = element.GetAttributeContentPath("namefile") ?? ContentPath.FromRaw(null, "Content/Map/locationNames.txt");
try
string[] rawNamePaths = element.GetAttributeStringArray("namefile", new string[] { "Content/Map/locationNames.txt" });
names = new List<string>();
foreach (string rawPath in rawNamePaths)
{
names = File.ReadAllLines(nameFile.Value).ToList();
try
{
var path = ContentPath.FromRaw(element.ContentPackage, rawPath.Trim());
names.AddRange(File.ReadAllLines(path.Value).ToList());
}
catch (Exception e)
{
DebugConsole.ThrowError($"Failed to read name file \"rawPath\" for location type \"{Identifier}\"!", e);
}
}
catch (Exception e)
if (!names.Any())
{
DebugConsole.ThrowError("Failed to read name file for location type \"" + Identifier + "\"!", e);
names = new List<string>() { "Name file not found" };
names.Add("ERROR: No names found");
}
string[] commonnessPerZoneStrs = element.GetAttributeStringArray("commonnessperzone", Array.Empty<string>());
@@ -92,6 +92,9 @@ namespace Barotrauma
set;
}
/// <summary>
/// Note: Refreshed for loaded submarines when they are saved, when they are loaded, and on round end. If you need to refresh it, please use Submarine.CheckFuel() method!
/// </summary>
public bool LowFuel
{
get;
@@ -302,6 +302,7 @@ namespace Barotrauma
{ InputType.Down, Keys.S },
{ InputType.Left, Keys.A },
{ InputType.Right, Keys.D },
{ InputType.ToggleInventory, Keys.Q },
{ InputType.SelectNextCharacter, Keys.Z },
{ InputType.SelectPreviousCharacter, Keys.X },
@@ -324,7 +324,10 @@ namespace Barotrauma.Steam
using (var copyIndicator = new CopyIndicator(copyIndicatorPath))
{
await CopyDirectory(itemDirectory, modPathDirName ?? modName, itemDirectory, installDir, ShouldCorrectPaths.Yes);
await CopyDirectory(itemDirectory, modPathDirName ?? modName, itemDirectory, installDir,
gameVersion < new Version(0, 18, 3, 0)
? ShouldCorrectPaths.Yes
: ShouldCorrectPaths.No);
string fileListDestPath = Path.Combine(installDir, ContentPackage.FileListFileName);
XDocument fileListDest = XMLExtensions.TryLoadXml(fileListDestPath);
+12 -4
View File
@@ -1,17 +1,17 @@
---------------------------------------------------------------------------------------------------------
v0.18.13.0
v0.18.15.0
---------------------------------------------------------------------------------------------------------
Changes:
- Show a warning when trying to switch to a submarine that's low on fuel.
- Show a warning when trying to switch to a submarine that's low on fuel or to a submarine that has no manually placed items to prevent softlocking the campaign if you switch to a sub that has no fuel. Whether a submarine is considered to have manually placed items can be set when saving it in the submarine editor (the checkbox "manually outfitted" in the saving dialog).
- Also show the low fuel warning when leaving an outpost without enough fuel.
- Items are always transferred when switching to a submarine that has no manually placed items, which should prevent softlocking the campaign if you switch to a sub that has no fuel. Whether a submarine is considered to have manually placed items can be set when saving it in the submarine editor (the checkbox "manually outfitted" in the saving dialog).
- Handheld sonars can't detect minerals from inside the sub.
- Changed the plus and minus button in the campaign settings into arrows. The button on the right increases difficulty, which in the case of the starting balance and supplies means reducing them, making the plus and minus buttons misleading.
- Reduced costs of handheld weapon ammunition significantly.
- Slightly reduced effectiveness of harpoons and revolver round to compensate for the cheaper ammo.
- Changed recipes for Handcannon, Assault Rifle and Auto-Shotgun. Weapon crafting is more expensive, to compensate for cheaper ammo.
- Adjusted numerous other recipes and price costs of materials. Previously little used materials (like tin) are now used more.
- Partially reintroduced the "toggle inventory" keybind, now called "toggle entity list". Even though toggling the in-game inventory is no longer possible, the keybind can be used to change the hotkey for toggling the sub editor's entity list.
Fixes:
- Fixed shuttles getting misplaced when switching and transferring items to a new sub with shuttles.
@@ -38,7 +38,16 @@ Fixes:
- Fixed missing background sprite in duct block.
- Fixed water particles not showing up when water is flowing down a duct block.
- Fixed changing the scale of resizeable structures (such as background doors) messing up the outline of linked subs in the sub editor.
- Fixed non-player-team interactable items getting transferred on sub switch.
- Fixed ballast flora root emitting particles when damaged client-side, even if it's already been destroyed.
- Fixed recycle recipes for Piercing Ammunition Box and Pulse Tri-Laser Fuel Box.
- Fixed friendly fire and karma always showing up as disabled on dedicated servers in the server list.
- Fixed some lights (e.g. vending machines, neon lights, holographics displays) looking different in the sub editor than they do in-game.
- Fixed undocked shuttles remaining undocked if you save and start a new game with the same submarine during the same session. Restarting the game fixed the issue though.
- Fixed sonar markers going crazy if the start and end locations have the same name + added some more variety to location names to prevent duplicate location names.
- Fixed multiediting an ItemComponent modifying all the components of that type in all the selected items (e.g. when editing the 1st light component of a switch, all lights in all switches would be edited).
- Fixed spineling spikes fired by a human with spineling genes not damaging any human characters (enemies in PvP, pirates in pirate missions) when friendly fire is disabled.
- Fixed melee weapons not damaging structures from outside.
Modding:
- Fixed removing a door mid-round crashing the game. Does not affect the vanilla game, because doors are never removed mid-round.
@@ -55,7 +64,6 @@ v0.18.12.0
- Fixed one of texts not appearing in the "captive souls" event.
- Fixed inability to fabricate rubber shells.
Modding:
- Fixed crashing when a MonsterEvent fails to find the character prefab.