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
@@ -918,5 +918,12 @@ namespace Barotrauma
DebugConsole.ThrowError($"GUITextBox: Invalid selection: ({exception})"); DebugConsole.ThrowError($"GUITextBox: Invalid selection: ({exception})");
} }
} }
public void ResetDelegates()
{
OnKeyHit = null;
OnEnterPressed = null;
OnTextChanged = null;
}
} }
} }
@@ -1031,7 +1031,7 @@ namespace Barotrauma.Items.Components
{ {
if (selectedItem == null) { return false; } if (selectedItem == null) { return false; }
if (fabricatedItem == null && 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); outputSlot.Flash(GUIStyle.Red);
return false; return false;
@@ -4773,18 +4773,28 @@ namespace Barotrauma
TeamChatSelected = false; TeamChatSelected = false;
} }
chatInput = new GUITextBox(new RectTransform(new Vector2(0.75f, 1.0f), chatRow.RectTransform, Anchor.CenterRight)) if (chatInput != null)
{ {
MaxTextLength = ChatMessage.MaxLength, chatInput.RectTransform.Parent = chatRow.RectTransform;
Font = GUIStyle.SmallFont, }
DeselectAfterMessage = false 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"); micIcon = new GUIImage(new RectTransform(new Vector2(0.05f, 1.0f), chatRow.RectTransform), style: "GUIMicrophoneUnavailable");
chatInput.Select();
}
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) if (GameMain.Client != null)
{ {
chatInput.ResetDelegates();
chatInput.OnEnterPressed = GameMain.Client.EnterChatMessage; chatInput.OnEnterPressed = GameMain.Client.EnterChatMessage;
chatInput.OnTextChanged += GameMain.Client.TypingChatMessage; chatInput.OnTextChanged += GameMain.Client.TypingChatMessage;
chatInput.OnDeselected += (sender, key) => chatInput.OnDeselected += (sender, key) =>
@@ -5937,7 +5937,7 @@ namespace Barotrauma
newItem.Remove(); 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); bool placedItem = itemContainer.Inventory.TryPutItem(newItem, dummyCharacter);
spawnedItem |= placedItem; spawnedItem |= placedItem;
@@ -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>1.6.18.1</Version> <Version>1.6.19.1</Version>
<Copyright>Copyright © FakeFish 2018-2024</Copyright> <Copyright>Copyright © FakeFish 2018-2024</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>1.6.18.1</Version> <Version>1.6.19.1</Version>
<Copyright>Copyright © FakeFish 2018-2024</Copyright> <Copyright>Copyright © FakeFish 2018-2024</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>1.6.18.1</Version> <Version>1.6.19.1</Version>
<Copyright>Copyright © FakeFish 2018-2024</Copyright> <Copyright>Copyright © FakeFish 2018-2024</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>1.6.18.1</Version> <Version>1.6.19.1</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright> <Copyright>Copyright © FakeFish 2018-2023</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>1.6.18.1</Version> <Version>1.6.19.1</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright> <Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName> <AssemblyName>DedicatedServer</AssemblyName>
@@ -1711,7 +1711,34 @@ namespace Barotrauma
SpawnItem(args, cursorWorldPos, client.Character, out string errorMsg); SpawnItem(args, cursorWorldPos, client.Character, out string errorMsg);
if (!string.IsNullOrWhiteSpace(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);
} }
} }
); );
@@ -1290,9 +1290,17 @@ namespace Barotrauma.Networking
{ {
mpCampaign.SendCrewState(); 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; c.InGame = true;
} }
@@ -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>1.6.18.1</Version> <Version>1.6.19.1</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright> <Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName> <AssemblyName>DedicatedServer</AssemblyName>
@@ -56,6 +56,7 @@
<Command name="showperm"/> <Command name="showperm"/>
<Command name="spawn"/> <Command name="spawn"/>
<Command name="spawnitem"/> <Command name="spawnitem"/>
<Command name="give"/>
<Command name="disablecrewai"/> <Command name="disablecrewai"/>
<Command name="gamemode"/> <Command name="gamemode"/>
<Command name="sub"/> <Command name="sub"/>
@@ -818,8 +818,9 @@ namespace Barotrauma
newStrength += existingAffliction.Strength; newStrength += existingAffliction.Strength;
} }
newStrength = Math.Min(existingAffliction.Prefab.MaxStrength, newStrength); newStrength = Math.Min(existingAffliction.Prefab.MaxStrength, newStrength);
if (existingAffliction == stunAffliction) { Character.SetStun(newStrength, true, true); }
existingAffliction.Strength = newStrength; 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; existingAffliction.Duration = existingAffliction.Prefab.Duration;
if (newAffliction.Source != null) { existingAffliction.Source = newAffliction.Source; } if (newAffliction.Source != null) { existingAffliction.Source = newAffliction.Source; }
if (recalculateVitality) if (recalculateVitality)
@@ -1,4 +1,4 @@
using System.Xml.Linq; using System.Xml.Linq;
namespace Barotrauma namespace Barotrauma
{ {
@@ -77,12 +77,15 @@ namespace Barotrauma
var rootElement = doc.Root.FromPackage(ContentPackage); var rootElement = doc.Root.FromPackage(ContentPackage);
LoadFromXElement(rootElement, false); LoadFromXElement(rootElement, false);
EventSet.RefreshAllEventPrefabs();
} }
public override void UnloadFile() public override void UnloadFile()
{ {
EventPrefab.Prefabs.RemoveByFile(this); EventPrefab.Prefabs.RemoveByFile(this);
EventSet.Prefabs.RemoveByFile(this); EventSet.Prefabs.RemoveByFile(this);
EventSet.RefreshAllEventPrefabs();
#if CLIENT #if CLIENT
EventSprite.Prefabs.RemoveByFile(this); EventSprite.Prefabs.RemoveByFile(this);
#endif #endif
@@ -92,6 +95,9 @@ namespace Barotrauma
{ {
EventPrefab.Prefabs.SortAll(); EventPrefab.Prefabs.SortAll();
EventSet.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 #if CLIENT
EventSprite.Prefabs.SortAll(); EventSprite.Prefabs.SortAll();
#endif #endif
@@ -273,12 +273,18 @@ namespace Barotrauma
{ {
if (Character.Controlled == null) 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); var modifiedArgs = new List<string>(args);
modifiedArgs.Insert(1, "inventory"); modifiedArgs.Insert(1, "inventory");
TrySpawnItem(modifiedArgs.ToArray()); TrySpawnItem(modifiedArgs.ToArray());
}, },
getValidArgs: () => getValidArgs: () =>
@@ -61,25 +61,46 @@ namespace Barotrauma
} }
#endif #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(); return AllEventPrefabs.Values;
foreach (var eventSet in Prefabs)
{
AddSetEventPrefabsToList(eventPrefabs, eventSet);
}
return eventPrefabs;
} }
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))); AllEventPrefabs.Clear();
foreach (var childSet in set.ChildSets) { AddSetEventPrefabsToList(list, childSet); } 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) public static EventPrefab GetEventPrefab(Identifier identifier)
{ {
return GetAllEventPrefabs().Find(prefab => prefab.Identifier == identifier); return AllEventPrefabs.GetValueOrDefault(identifier);
} }
/// <summary> /// <summary>
@@ -150,7 +150,7 @@ namespace Barotrauma
int maxCount = subElement.GetAttributeInt("maxcount", 10); int maxCount = subElement.GetAttributeInt("maxcount", 10);
if (itemsToSpawn.Count(it => it.element == subElement) >= maxCount) { continue; } if (itemsToSpawn.Count(it => it.element == subElement) >= maxCount) { continue; }
ItemPrefab itemPrefab = FindItemPrefab(subElement); 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); containers[i] = (containers[i].container, containers[i].freeSlots - 1);
itemsToSpawn.Add((subElement, containers[i].container)); itemsToSpawn.Add((subElement, containers[i].container));
@@ -479,10 +479,7 @@ namespace Barotrauma
} }
#endif #endif
enemySub.SetPosition(spawnPos); 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 // 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 // creating the pirates has to be done after the sub has been flipped, or it seems to break the AI pathing
@@ -333,7 +333,7 @@ namespace Barotrauma
} }
var existingItem = validContainer.Key.Inventory.AllItems.FirstOrDefault(it => it.Prefab == itemPrefab); 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); 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) var item = new Item(itemPrefab, validContainer.Key.Item.Position, validContainer.Key.Item.Submarine, callOnItemLoaded: false)
{ {
SpawnedInCurrentOutpost = validContainer.Key.Item.SpawnedInCurrentOutpost, SpawnedInCurrentOutpost = validContainer.Key.Item.SpawnedInCurrentOutpost,
@@ -546,7 +546,7 @@ namespace Barotrauma
if (!string.IsNullOrEmpty(item.CargoContainerIdentifier)) if (!string.IsNullOrEmpty(item.CargoContainerIdentifier))
{ {
itemContainer = availableContainers.Find(ac => itemContainer = availableContainers.Find(ac =>
ac.Inventory.CanBePut(item) && ac.Inventory.CanProbablyBePut(item) &&
(ac.Item.Prefab.Identifier == item.CargoContainerIdentifier || (ac.Item.Prefab.Identifier == item.CargoContainerIdentifier ||
ac.Item.Prefab.Tags.Contains(item.CargoContainerIdentifier))); ac.Item.Prefab.Tags.Contains(item.CargoContainerIdentifier)));
@@ -1160,7 +1160,7 @@ namespace Barotrauma.Items.Components
foreach (string id in splitIds) foreach (string id in splitIds)
{ {
ItemPrefab prefab = ItemPrefab.Prefabs.Find(m => m.Identifier == id); 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; bool isEditor = false;
#if CLIENT #if CLIENT
@@ -206,7 +206,7 @@ namespace Barotrauma.Items.Components
private void StartFabricating(FabricationRecipe selectedItem, Character user, bool addToServerLog = true) private void StartFabricating(FabricationRecipe selectedItem, Character user, bool addToServerLog = true)
{ {
if (selectedItem == null) { return; } 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; IsActive = true;
this.user = user; this.user = user;
@@ -58,7 +58,12 @@ namespace Barotrauma
return true; 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 (itemPrefab == null) { return false; }
if (items.Count > 0) if (items.Count > 0)
@@ -518,7 +523,12 @@ namespace Barotrauma
return slots[i].CanBePut(item, ignoreCondition); 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++) 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) public virtual bool CanBePutInSlot(ItemPrefab itemPrefab, int i, float? condition = null, int? quality = null)
{ {
if (i < 0 || i >= slots.Length) { return false; } 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) public int HowManyCanBePut(ItemPrefab itemPrefab, float? condition = null)
@@ -55,7 +55,7 @@ namespace Barotrauma
{ {
if (i < 0 || i >= slots.Length) { return false; } if (i < 0 || i >= slots.Length) { return false; }
if (!container.CanBeContained(itemPrefab, i)) { 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) public override int HowManyCanBePut(ItemPrefab itemPrefab, int i, float? condition, bool ignoreItemsInSlot = false)
@@ -70,11 +70,14 @@ namespace Barotrauma
Item spawnedItem; Item spawnedItem;
if (Inventory?.Owner != null) if (Inventory?.Owner != null)
{ {
if (!SpawnIfInventoryFull && !Inventory.CanBePut(Prefab)) if (!SpawnIfInventoryFull && !Inventory.CanProbablyBePut(Prefab))
{ {
return null; return null;
} }
spawnedItem = new Item(Prefab, Vector2.Zero, 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; var slot = Slot != InvSlotType.None ? Slot.ToEnumerable() : spawnedItem.AllowedSlots;
if (!Inventory.Owner.Removed && !Inventory.TryPutItem(spawnedItem, null, slot)) if (!Inventory.Owner.Removed && !Inventory.TryPutItem(spawnedItem, null, slot))
@@ -96,16 +99,21 @@ namespace Barotrauma
else else
{ {
spawnedItem = new Item(Prefab, Position, Submarine); spawnedItem = new Item(Prefab, Position, Submarine);
} SetItemProperties(spawnedItem);
if (Condition.TryUnwrap(out float condition))
{
spawnedItem.Condition = condition;
}
if (Quality.TryUnwrap(out int quality))
{
spawnedItem.Quality = quality;
} }
return 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) public void OnSpawned(Entity spawnedItem)
@@ -2473,7 +2473,7 @@ namespace Barotrauma
return; 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 => Entity.Spawner.AddItemToSpawnQueue(chosenItemSpawnInfo.ItemPrefab, inventory, spawnIfInventoryFull: chosenItemSpawnInfo.SpawnIfInventoryFull, onSpawned: item =>
{ {
@@ -2540,7 +2540,7 @@ namespace Barotrauma
foreach (Item item in thisInventory.AllItems) foreach (Item item in thisInventory.AllItems)
{ {
Inventory containedInventory = item.GetComponent<ItemContainer>()?.Inventory; 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) => Entity.Spawner.AddItemToSpawnQueue(chosenItemSpawnInfo.ItemPrefab, containedInventory, spawnIfInventoryFull: chosenItemSpawnInfo.SpawnIfInventoryFull, onSpawned: (Item newItem) =>
{ {
+19
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 v1.6.18.1
------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------