Unstable 0.17.0.0
This commit is contained in:
@@ -4,23 +4,25 @@ using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
class EventPrefab
|
||||
class EventPrefab : Prefab
|
||||
{
|
||||
public readonly XElement ConfigElement;
|
||||
public static readonly PrefabCollection<EventPrefab> Prefabs = new PrefabCollection<EventPrefab>();
|
||||
|
||||
public readonly ContentXElement ConfigElement;
|
||||
public readonly Type EventType;
|
||||
public readonly float Probability;
|
||||
public readonly bool TriggerEventCooldown;
|
||||
public float Commonness;
|
||||
public string Identifier;
|
||||
public string BiomeIdentifier;
|
||||
public float SpawnDistance;
|
||||
public readonly float Commonness;
|
||||
public readonly Identifier BiomeIdentifier;
|
||||
public readonly float SpawnDistance;
|
||||
|
||||
public bool UnlockPathEvent;
|
||||
public string UnlockPathTooltip;
|
||||
public int UnlockPathReputation;
|
||||
public string UnlockPathFaction;
|
||||
public readonly bool UnlockPathEvent;
|
||||
public readonly string UnlockPathTooltip;
|
||||
public readonly int UnlockPathReputation;
|
||||
public readonly string UnlockPathFaction;
|
||||
|
||||
public EventPrefab(XElement element)
|
||||
public EventPrefab(ContentXElement element, RandomEventsFile file, Identifier fallbackIdentifier = default)
|
||||
: base(file, element.GetAttributeIdentifier("identifier", fallbackIdentifier))
|
||||
{
|
||||
ConfigElement = element;
|
||||
|
||||
@@ -37,8 +39,7 @@ namespace Barotrauma
|
||||
DebugConsole.ThrowError("Could not find an event class of the type \"" + ConfigElement.Name + "\".");
|
||||
}
|
||||
|
||||
Identifier = ConfigElement.GetAttributeString("identifier", string.Empty);
|
||||
BiomeIdentifier = ConfigElement.GetAttributeString("biome", string.Empty);
|
||||
BiomeIdentifier = ConfigElement.GetAttributeIdentifier("biome", Identifier.Empty);
|
||||
Commonness = element.GetAttributeFloat("commonness", 1.0f);
|
||||
Probability = Math.Clamp(element.GetAttributeFloat(1.0f, "probability", "spawnprobability"), 0, 1);
|
||||
TriggerEventCooldown = element.GetAttributeBool("triggereventcooldown", EventType != typeof(ScriptedEvent));
|
||||
@@ -73,6 +74,8 @@ namespace Barotrauma
|
||||
return instance;
|
||||
}
|
||||
|
||||
public override void Dispose() { }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"EventPrefab ({Identifier})";
|
||||
|
||||
Reference in New Issue
Block a user