v0.13.0.11

This commit is contained in:
Joonas Rikkonen
2021-04-22 17:33:08 +03:00
parent 0697d7fc64
commit 8bb31f2893
391 changed files with 17271 additions and 5949 deletions
@@ -13,7 +13,8 @@ namespace Barotrauma
private int prevEntityCount;
private int prevPlayerCount, prevBotCount;
private string[] requiredDestinationTypes;
private readonly string[] requiredDestinationTypes;
public readonly bool RequireBeaconStation;
public int CurrentActionIndex { get; private set; }
public List<EventAction> Actions { get; } = new List<EventAction>();
@@ -21,7 +22,7 @@ namespace Barotrauma
public override string ToString()
{
return "ScriptedEvent (" + prefab.EventType.ToString() +")";
return $"ScriptedEvent ({prefab.Identifier})";
}
public ScriptedEvent(EventPrefab prefab) : base(prefab)
@@ -43,6 +44,7 @@ namespace Barotrauma
}
requiredDestinationTypes = prefab.ConfigElement.GetAttributeStringArray("requireddestinationtypes", null);
RequireBeaconStation = prefab.ConfigElement.GetAttributeBool("requirebeaconstation", false);
}
public void AddTarget(string tag, Entity target)
@@ -208,9 +210,16 @@ namespace Barotrauma
{
if (requiredDestinationTypes == null) { return true; }
var currLocation = GameMain.GameSession?.Campaign?.Map.CurrentLocation;
if (currLocation == null) { return true; }
var locations = currLocation?.Connections?.Select(c => c.Locations.First(l => l != currLocation));
return locations.Any(l => requiredDestinationTypes.Any(t => l.Type.Identifier.Equals(t, StringComparison.OrdinalIgnoreCase)));
if (currLocation?.Connections == null) { return true; }
foreach (LocationConnection c in currLocation.Connections)
{
if (RequireBeaconStation && !c.LevelData.HasBeaconStation) { continue; }
if (requiredDestinationTypes.Any(t => c.OtherLocation(currLocation).Type.Identifier.Equals(t, StringComparison.OrdinalIgnoreCase)))
{
return true;
}
}
return false;
}
}
}