v0.19.0.0 (unstable)

This commit is contained in:
Regalis11
2022-07-20 18:47:07 +03:00
parent 2e2663a175
commit 6b55adcdd9
170 changed files with 2769 additions and 1634 deletions
@@ -92,7 +92,13 @@ namespace Barotrauma
public readonly bool ChooseRandom;
public readonly int EventCount = 1;
private readonly int eventCount = 1;
private readonly Dictionary<Identifier, int> overrideEventCount = new Dictionary<Identifier, int>();
/// <summary>
/// 'Exhaustible' sets won't appear in the same level until after one world step (~10 min, see Map.ProgressWorld) has passed.
/// </summary>
public readonly bool Exhaustible;
public readonly float MinDistanceTraveled;
public readonly float MinMissionTime;
@@ -250,7 +256,8 @@ namespace Barotrauma
MaxIntensity = Math.Max(element.GetAttributeFloat("maxintensity", 100.0f), MinIntensity);
ChooseRandom = element.GetAttributeBool("chooserandom", false);
EventCount = element.GetAttributeInt("eventcount", 1);
eventCount = element.GetAttributeInt("eventcount", 1);
Exhaustible = element.GetAttributeBool("exhaustible", false);
MinDistanceTraveled = element.GetAttributeFloat("mindistancetraveled", 0.0f);
MinMissionTime = element.GetAttributeFloat("minmissiontime", 0.0f);
@@ -288,6 +295,13 @@ namespace Barotrauma
case "eventset":
childSets.Add(new EventSet(subElement, file, this));
break;
case "overrideeventcount":
Identifier locationType = subElement.GetAttributeIdentifier("locationtype", "");
if (!overrideEventCount.ContainsKey(locationType))
{
overrideEventCount.Add(locationType, subElement.GetAttributeInt("eventcount", eventCount));
}
break;
default:
//an element with just an identifier = reference to an event prefab
if (!subElement.HasElements && subElement.Attributes().First().Name.ToString().Equals("identifier", StringComparison.OrdinalIgnoreCase))
@@ -332,6 +346,12 @@ namespace Barotrauma
return OverrideCommonness.ContainsKey(key) ? OverrideCommonness[key] : DefaultCommonness;
}
public int GetEventCount(Level level)
{
if (level?.StartLocation == null || !overrideEventCount.TryGetValue(level.StartLocation.Type.Identifier, out int count)) { return eventCount; }
return count;
}
public static List<string> GetDebugStatistics(int simulatedRoundCount = 100, Func<MonsterEvent, bool> filter = null, bool fullLog = false)
{
List<string> debugLines = new List<string>();
@@ -358,7 +378,7 @@ namespace Barotrauma
var unusedEvents = thisSet.EventPrefabs.ToList();
if (unusedEvents.Any())
{
for (int i = 0; i < thisSet.EventCount; i++)
for (int i = 0; i < thisSet.eventCount; i++)
{
var eventPrefab = ToolBox.SelectWeightedRandom(unusedEvents, unusedEvents.Select(e => e.Commonness).ToList(), Rand.RandSync.Unsynced);
if (eventPrefab.EventPrefabs.Any(p => p != null))