v1.6.19.1 (Unto the Breach Hotfix 1)
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user