v1.6.19.1 (Unto the Breach Hotfix 1)

This commit is contained in:
Regalis11
2024-10-31 11:27:32 +02:00
parent c015059218
commit 26ffd2104e
28 changed files with 182 additions and 61 deletions

View File

@@ -918,5 +918,12 @@ namespace Barotrauma
DebugConsole.ThrowError($"GUITextBox: Invalid selection: ({exception})");
}
}
public void ResetDelegates()
{
OnKeyHit = null;
OnEnterPressed = null;
OnTextChanged = null;
}
}
}

View File

@@ -1031,7 +1031,7 @@ namespace Barotrauma.Items.Components
{
if (selectedItem == null) { return false; }
if (fabricatedItem == null &&
!outputContainer.Inventory.CanBePut(selectedItem.TargetItem, selectedItem.OutCondition * selectedItem.TargetItem.Health))
!outputContainer.Inventory.CanProbablyBePut(selectedItem.TargetItem, selectedItem.OutCondition * selectedItem.TargetItem.Health))
{
outputSlot.Flash(GUIStyle.Red);
return false;

View File

@@ -2726,7 +2726,7 @@ namespace Barotrauma
UpdateJobPreferences(GameMain.Client?.CharacterInfo ?? Character.Controlled?.Info);
JobSelectionFrame = null;
RefreshChatrow(); // to enable/disable team chat according to current selection
return true;
};
@@ -4772,19 +4772,29 @@ namespace Barotrauma
{
TeamChatSelected = false;
}
chatInput = new GUITextBox(new RectTransform(new Vector2(0.75f, 1.0f), chatRow.RectTransform, Anchor.CenterRight))
{
MaxTextLength = ChatMessage.MaxLength,
Font = GUIStyle.SmallFont,
DeselectAfterMessage = false
};
micIcon = new GUIImage(new RectTransform(new Vector2(0.05f, 1.0f), chatRow.RectTransform), style: "GUIMicrophoneUnavailable");
chatInput.Select();
if (chatInput != null)
{
chatInput.RectTransform.Parent = chatRow.RectTransform;
}
else
{
chatInput = new GUITextBox(new RectTransform(new Vector2(0.75f, 1.0f), chatRow.RectTransform, Anchor.CenterRight))
{
MaxTextLength = ChatMessage.MaxLength,
Font = GUIStyle.SmallFont,
DeselectAfterMessage = false
};
micIcon = new GUIImage(new RectTransform(new Vector2(0.05f, 1.0f), chatRow.RectTransform), style: "GUIMicrophoneUnavailable");
chatInput.Select();
}
//this needs to be done even if we're using the existing chatinput instance instead of creating a new one,
//because the client might not have existed when the input box was first created
if (GameMain.Client != null)
{
chatInput.ResetDelegates();
chatInput.OnEnterPressed = GameMain.Client.EnterChatMessage;
chatInput.OnTextChanged += GameMain.Client.TypingChatMessage;
chatInput.OnDeselected += (sender, key) =>

View File

@@ -5937,7 +5937,7 @@ namespace Barotrauma
newItem.Remove();
}
}
else if (itemContainer != null && itemContainer.Inventory.CanBePut(itemPrefab))
else if (itemContainer != null && itemContainer.Inventory.CanProbablyBePut(itemPrefab))
{
bool placedItem = itemContainer.Inventory.TryPutItem(newItem, dummyCharacter);
spawnedItem |= placedItem;

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>1.6.18.1</Version>
<Version>1.6.19.1</Version>
<Copyright>Copyright © FakeFish 2018-2024</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>1.6.18.1</Version>
<Version>1.6.19.1</Version>
<Copyright>Copyright © FakeFish 2018-2024</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>1.6.18.1</Version>
<Version>1.6.19.1</Version>
<Copyright>Copyright © FakeFish 2018-2024</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>1.6.18.1</Version>
<Version>1.6.19.1</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>1.6.18.1</Version>
<Version>1.6.19.1</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>

View File

@@ -1711,7 +1711,34 @@ namespace Barotrauma
SpawnItem(args, cursorWorldPos, client.Character, out string errorMsg);
if (!string.IsNullOrWhiteSpace(errorMsg))
{
GameMain.Server.SendConsoleMessage(errorMsg, client);
GameMain.Server.SendConsoleMessage(errorMsg, client, Color.Red);
}
}
);
AssignOnClientRequestExecute(
"give",
(Client client, Vector2 cursorWorldPos, string[] args) =>
{
if (client.Character == null)
{
GameMain.Server.SendConsoleMessage("No character is selected!", client, Color.Red);
return;
}
if (args.Length == 0)
{
GameMain.Server.SendConsoleMessage("Please give the name or identifier of the item to spawn.", client, Color.Red);
return;
}
var modifiedArgs = new List<string>(args);
modifiedArgs.Insert(1, "inventory");
SpawnItem(modifiedArgs.ToArray(), cursorWorldPos, client.Character, out string errorMsg);
if (!string.IsNullOrWhiteSpace(errorMsg))
{
GameMain.Server.SendConsoleMessage(errorMsg, client, Color.Red);
}
}
);

View File

@@ -1290,9 +1290,17 @@ namespace Barotrauma.Networking
{
mpCampaign.SendCrewState();
}
else if (GameMain.GameSession.GameMode is PvPMode && c.TeamID == CharacterTeamType.None)
else if (GameMain.GameSession.GameMode is PvPMode)
{
AssignClientToPvpTeamMidgame(c);
if (c.TeamID == CharacterTeamType.None)
{
AssignClientToPvpTeamMidgame(c);
}
}
else
{
//everyone's in team 1 in non-pvp game modes
c.TeamID = CharacterTeamType.Team1;
}
c.InGame = true;
}

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>1.6.18.1</Version>
<Version>1.6.19.1</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>

View File

@@ -56,6 +56,7 @@
<Command name="showperm"/>
<Command name="spawn"/>
<Command name="spawnitem"/>
<Command name="give"/>
<Command name="disablecrewai"/>
<Command name="gamemode"/>
<Command name="sub"/>

View File

@@ -818,8 +818,9 @@ namespace Barotrauma
newStrength += existingAffliction.Strength;
}
newStrength = Math.Min(existingAffliction.Prefab.MaxStrength, newStrength);
if (existingAffliction == stunAffliction) { Character.SetStun(newStrength, true, true); }
existingAffliction.Strength = newStrength;
//set stun after setting the strength, because stun multipliers might want to set the strength to something else
if (existingAffliction == stunAffliction) { Character.SetStun(newStrength, allowStunDecrease: true, isNetworkMessage: true); }
existingAffliction.Duration = existingAffliction.Prefab.Duration;
if (newAffliction.Source != null) { existingAffliction.Source = newAffliction.Source; }
if (recalculateVitality)

View File

@@ -1,4 +1,4 @@
using System.Xml.Linq;
using System.Xml.Linq;
namespace Barotrauma
{
@@ -77,12 +77,15 @@ namespace Barotrauma
var rootElement = doc.Root.FromPackage(ContentPackage);
LoadFromXElement(rootElement, false);
EventSet.RefreshAllEventPrefabs();
}
public override void UnloadFile()
{
EventPrefab.Prefabs.RemoveByFile(this);
EventSet.Prefabs.RemoveByFile(this);
EventSet.RefreshAllEventPrefabs();
#if CLIENT
EventSprite.Prefabs.RemoveByFile(this);
#endif
@@ -92,6 +95,9 @@ namespace Barotrauma
{
EventPrefab.Prefabs.SortAll();
EventSet.Prefabs.SortAll();
//need to referesh, because the order of the prefabs may affect which content package overrides some event
EventSet.RefreshAllEventPrefabs();
#if CLIENT
EventSprite.Prefabs.SortAll();
#endif

View File

@@ -273,12 +273,18 @@ namespace Barotrauma
{
if (Character.Controlled == null)
{
NewMessage("No character is selected!", Color.Red);
ThrowError("No character is selected!");
return;
}
if (args.Length == 0)
{
ThrowError("Please give the name or identifier of the item to spawn.");
return;
}
var modifiedArgs = new List<string>(args);
modifiedArgs.Insert(1, "inventory");
TrySpawnItem(modifiedArgs.ToArray());
},
getValidArgs: () =>

View File

@@ -61,25 +61,46 @@ namespace Barotrauma
}
#endif
public static List<EventPrefab> GetAllEventPrefabs()
private static readonly Dictionary<Identifier, EventPrefab> AllEventPrefabs = new Dictionary<Identifier, EventPrefab>();
public static IEnumerable<EventPrefab> GetAllEventPrefabs()
{
List<EventPrefab> eventPrefabs = EventPrefab.Prefabs.ToList();
foreach (var eventSet in Prefabs)
{
AddSetEventPrefabsToList(eventPrefabs, eventSet);
}
return eventPrefabs;
return AllEventPrefabs.Values;
}
public static void AddSetEventPrefabsToList(List<EventPrefab> list, EventSet set)
/// <summary>
/// Finds all the event prefabs (both "normal prefabs" that exists by themselves, present in <see cref="EventPrefab.Prefabs"/>, and the ones that exists only inside child event sets),
/// and adds them to <see cref="AllEventPrefabs"/>.
/// </summary>
public static void RefreshAllEventPrefabs()
{
list.AddRange(set.EventPrefabs.SelectMany(ep => ep.EventPrefabs).Where(ep => !list.Contains(ep)));
foreach (var childSet in set.ChildSets) { AddSetEventPrefabsToList(list, childSet); }
AllEventPrefabs.Clear();
foreach (var eventPrefab in EventPrefab.Prefabs)
{
AllEventPrefabs.TryAdd(eventPrefab.Identifier, eventPrefab);
}
foreach (var eventSet in Prefabs)
{
AddChildEventPrefabs(eventSet);
}
}
private static void AddChildEventPrefabs(EventSet set)
{
foreach (var subEventPrefabs in set.EventPrefabs)
{
foreach (var eventPrefab in subEventPrefabs.EventPrefabs)
{
AllEventPrefabs.TryAdd(eventPrefab.Identifier, eventPrefab);
}
}
foreach (var childSet in set.ChildSets) { AddChildEventPrefabs(childSet); }
}
public static EventPrefab GetEventPrefab(Identifier identifier)
{
return GetAllEventPrefabs().Find(prefab => prefab.Identifier == identifier);
return AllEventPrefabs.GetValueOrDefault(identifier);
}
/// <summary>

View File

@@ -150,7 +150,7 @@ namespace Barotrauma
int maxCount = subElement.GetAttributeInt("maxcount", 10);
if (itemsToSpawn.Count(it => it.element == subElement) >= maxCount) { continue; }
ItemPrefab itemPrefab = FindItemPrefab(subElement);
while (containers[i].freeSlots > 0 && containers[i].container.Inventory.CanBePut(itemPrefab))
while (containers[i].freeSlots > 0 && containers[i].container.Inventory.CanProbablyBePut(itemPrefab))
{
containers[i] = (containers[i].container, containers[i].freeSlots - 1);
itemsToSpawn.Add((subElement, containers[i].container));

View File

@@ -479,10 +479,7 @@ namespace Barotrauma
}
#endif
enemySub.SetPosition(spawnPos);
if (!IsClient)
{
InitPirateShip();
}
InitPirateShip();
// flipping the sub on the frame it is moved into place must be done after it's been moved, or it breaks item connections in the submarine
// creating the pirates has to be done after the sub has been flipped, or it seems to break the AI pathing

View File

@@ -333,7 +333,7 @@ namespace Barotrauma
}
var existingItem = validContainer.Key.Inventory.AllItems.FirstOrDefault(it => it.Prefab == itemPrefab);
int quality = existingItem?.Quality ?? Quality.GetSpawnedItemQuality(validContainer.Key.Item.Submarine, Level.Loaded, Rand.RandSync.ServerAndClient);
if (!validContainer.Key.Inventory.CanBePut(itemPrefab, quality: quality)) { break; }
if (!validContainer.Key.Inventory.CanProbablyBePut(itemPrefab, quality: quality)) { break; }
var item = new Item(itemPrefab, validContainer.Key.Item.Position, validContainer.Key.Item.Submarine, callOnItemLoaded: false)
{
SpawnedInCurrentOutpost = validContainer.Key.Item.SpawnedInCurrentOutpost,

View File

@@ -546,7 +546,7 @@ namespace Barotrauma
if (!string.IsNullOrEmpty(item.CargoContainerIdentifier))
{
itemContainer = availableContainers.Find(ac =>
ac.Inventory.CanBePut(item) &&
ac.Inventory.CanProbablyBePut(item) &&
(ac.Item.Prefab.Identifier == item.CargoContainerIdentifier ||
ac.Item.Prefab.Tags.Contains(item.CargoContainerIdentifier)));

View File

@@ -1160,7 +1160,7 @@ namespace Barotrauma.Items.Components
foreach (string id in splitIds)
{
ItemPrefab prefab = ItemPrefab.Prefabs.Find(m => m.Identifier == id);
if (prefab != null && Inventory != null && Inventory.CanBePut(prefab))
if (prefab != null && Inventory != null && Inventory.CanProbablyBePut(prefab))
{
bool isEditor = false;
#if CLIENT

View File

@@ -206,7 +206,7 @@ namespace Barotrauma.Items.Components
private void StartFabricating(FabricationRecipe selectedItem, Character user, bool addToServerLog = true)
{
if (selectedItem == null) { return; }
if (!outputContainer.Inventory.CanBePut(selectedItem.TargetItem, selectedItem.OutCondition * selectedItem.TargetItem.Health)) { return; }
if (!outputContainer.Inventory.CanProbablyBePut(selectedItem.TargetItem, selectedItem.OutCondition * selectedItem.TargetItem.Health)) { return; }
IsActive = true;
this.user = user;

View File

@@ -58,7 +58,12 @@ namespace Barotrauma
return true;
}
public bool CanBePut(ItemPrefab itemPrefab, float? condition = null, int? quality = null)
/// <summary>
/// Can an instance of the item prefab be put into the slot?
/// Note that if the condition and quality aren't given, they are ignored, and the method can return true even if the item can't go in the slot
/// due to it being occupied by another item with a different condition or quality (which disallows stacking).
/// </summary>
public bool CanProbablyBePut(ItemPrefab itemPrefab, float? condition = null, int? quality = null)
{
if (itemPrefab == null) { return false; }
if (items.Count > 0)
@@ -518,7 +523,12 @@ namespace Barotrauma
return slots[i].CanBePut(item, ignoreCondition);
}
public bool CanBePut(ItemPrefab itemPrefab, float? condition = null, int? quality = null)
/// <summary>
/// Can an instance of the item prefab be put into the inventory?
/// Note that if the condition and quality aren't given, they are ignored, and the method can return true even if the item can't go in the inventory
/// due to the slots being occupied by another item with a different condition or quality (which disallows stacking).
/// </summary>
public bool CanProbablyBePut(ItemPrefab itemPrefab, float? condition = null, int? quality = null)
{
for (int i = 0; i < capacity; i++)
{
@@ -530,7 +540,7 @@ namespace Barotrauma
public virtual bool CanBePutInSlot(ItemPrefab itemPrefab, int i, float? condition = null, int? quality = null)
{
if (i < 0 || i >= slots.Length) { return false; }
return slots[i].CanBePut(itemPrefab, condition);
return slots[i].CanProbablyBePut(itemPrefab, condition, quality);
}
public int HowManyCanBePut(ItemPrefab itemPrefab, float? condition = null)

View File

@@ -55,7 +55,7 @@ namespace Barotrauma
{
if (i < 0 || i >= slots.Length) { return false; }
if (!container.CanBeContained(itemPrefab, i)) { return false; }
return itemPrefab != null && slots[i].CanBePut(itemPrefab, condition, quality) && slots[i].Items.Count < container.GetMaxStackSize(i);
return itemPrefab != null && slots[i].CanProbablyBePut(itemPrefab, condition, quality) && slots[i].Items.Count < container.GetMaxStackSize(i);
}
public override int HowManyCanBePut(ItemPrefab itemPrefab, int i, float? condition, bool ignoreItemsInSlot = false)

View File

@@ -70,11 +70,14 @@ namespace Barotrauma
Item spawnedItem;
if (Inventory?.Owner != null)
{
if (!SpawnIfInventoryFull && !Inventory.CanBePut(Prefab))
if (!SpawnIfInventoryFull && !Inventory.CanProbablyBePut(Prefab))
{
return null;
}
spawnedItem = new Item(Prefab, Vector2.Zero, null);
//this needs to be done before attempting to put the item in the inventory,
//because the quality and condition may affect whether it can go in the inventory (into an existing stack)
SetItemProperties(spawnedItem);
var slot = Slot != InvSlotType.None ? Slot.ToEnumerable() : spawnedItem.AllowedSlots;
if (!Inventory.Owner.Removed && !Inventory.TryPutItem(spawnedItem, null, slot))
@@ -96,16 +99,21 @@ namespace Barotrauma
else
{
spawnedItem = new Item(Prefab, Position, Submarine);
}
if (Condition.TryUnwrap(out float condition))
{
spawnedItem.Condition = condition;
}
if (Quality.TryUnwrap(out int quality))
{
spawnedItem.Quality = quality;
SetItemProperties(spawnedItem);
}
return spawnedItem;
void SetItemProperties(Item spawnedItem)
{
if (Condition.TryUnwrap(out float condition))
{
spawnedItem.Condition = condition;
}
if (Quality.TryUnwrap(out int quality))
{
spawnedItem.Quality = quality;
}
}
}
public void OnSpawned(Entity spawnedItem)

View File

@@ -2473,7 +2473,7 @@ namespace Barotrauma
return;
}
}
if (inventory != null && (inventory.CanBePut(chosenItemSpawnInfo.ItemPrefab) || chosenItemSpawnInfo.SpawnIfInventoryFull))
if (inventory != null && (inventory.CanProbablyBePut(chosenItemSpawnInfo.ItemPrefab) || chosenItemSpawnInfo.SpawnIfInventoryFull))
{
Entity.Spawner.AddItemToSpawnQueue(chosenItemSpawnInfo.ItemPrefab, inventory, spawnIfInventoryFull: chosenItemSpawnInfo.SpawnIfInventoryFull, onSpawned: item =>
{
@@ -2540,7 +2540,7 @@ namespace Barotrauma
foreach (Item item in thisInventory.AllItems)
{
Inventory containedInventory = item.GetComponent<ItemContainer>()?.Inventory;
if (containedInventory != null && (containedInventory.CanBePut(chosenItemSpawnInfo.ItemPrefab) || chosenItemSpawnInfo.SpawnIfInventoryFull))
if (containedInventory != null && (containedInventory.CanProbablyBePut(chosenItemSpawnInfo.ItemPrefab) || chosenItemSpawnInfo.SpawnIfInventoryFull))
{
Entity.Spawner.AddItemToSpawnQueue(chosenItemSpawnInfo.ItemPrefab, containedInventory, spawnIfInventoryFull: chosenItemSpawnInfo.SpawnIfInventoryFull, onSpawned: (Item newItem) =>
{

View File

@@ -1,4 +1,23 @@
-------------------------------------------------------------------------------------------------------------------------------------------------
v1.6.19.1
-------------------------------------------------------------------------------------------------------------------------------------------------
- Fixed chat input box getting cleared whenever someone changes their team, or when the game mode or team selection mode changes.
- Fixed stun resistance PvP setting doing nothing.
- Made Crimson Acid less powerful against large monsters.
- Fixed everyone's name tags being shown in red until you spawn when you join a campaign mid-round.
- Fixed stackable items with a non-default quality (e.g. grenades) failing to stack in the fabricator's output slot, instead just falling to the floor.
- Fixed very large PvP outposts often clipping into the level walls.
- Fixed decorative structures such as background walls not showing up on hostile (non-player) subs in multiplayer.
- Fixed "giveitem" command crashing the game when used with no arguments.
- Fixed Gravity Flak Shell's "gravity pull effect" being affected by gravity.
- Fixed Fulgurium Batteries sometimes spawning automatically in tools at the start of a campaign.
- Changed cargo scooter recipe to be more consistent with the normal scooter recipe (Underwater Scooter + x2 Ti-Al Alloy).
Modding:
- Fixed freezes / lag spikes in multiplayer when a scripted event uses StatusEffectAction when there's lots of mods with custom events enabled.
-------------------------------------------------------------------------------------------------------------------------------------------------
v1.6.18.1
-------------------------------------------------------------------------------------------------------------------------------------------------