Barotrauma Client Doc
Barotrauma.EventSet Class Reference

Event sets are sets of random events that occur within a level (most commonly, monster spawns and scripted events). Event sets can also be nested: a "parent set" can choose from several "subsets", either randomly or by some kind of criteria. More...

Inheritance diagram for Barotrauma.EventSet:
Barotrauma.Prefab

Classes

class  EventDebugStats
 
struct  SubEventPrefab
 

Public Member Functions

 EventSet (ContentXElement element, RandomEventsFile file, EventSet parentSet=null)
 
void CheckLocationTypeErrors ()
 
float GetCommonness (Level level)
 
int GetEventCount (Level level)
 
override string ToString ()
 
override void Dispose ()
 
- Public Member Functions inherited from Barotrauma.Prefab
 Prefab (ContentFile file, Identifier identifier)
 
 Prefab (ContentFile file, ContentXElement element)
 

Static Public Member Functions

static Sprite GetEventSprite (string identifier)
 
static List< EventPrefabGetAllEventPrefabs ()
 
static void AddSetEventPrefabsToList (List< EventPrefab > list, EventSet set)
 
static EventPrefab GetEventPrefab (Identifier identifier)
 
static List< string > GetDebugStatistics (int simulatedRoundCount=100, Func< MonsterEvent, bool > filter=null, bool fullLog=false)
 
- Static Public Member Functions inherited from Barotrauma.Prefab
static void DisallowCallFromConstructor ()
 

Public Attributes

readonly bool IsCampaignSet
 If enabled, this set can only be chosen in the campaign mode. More...
 
readonly float MinLevelDifficulty
 The difficulty of the current level must be equal to or higher than this for this set to be chosen. More...
 
readonly float MaxLevelDifficulty
 The difficulty of the current level must be equal to or less than this for this set to be chosen. More...
 
readonly Identifier BiomeIdentifier
 If set, the event set can only be chosen in this biome. More...
 
readonly LevelData.LevelType LevelType
 If set, the event set can only be chosen in this type of level (outpost level or a connection between outpost levels). More...
 
readonly ImmutableArray< IdentifierLocationTypeIdentifiers
 If set, the event set can only be chosen in locations of this type. More...
 
readonly Identifier Faction
 If set, the event set can only be chosen in locations that belong to this faction. More...
 
readonly bool ChooseRandom
 If set, one event, or a sub event set, is chosen randomly from this set. More...
 
readonly int SubSetCount = 1
 
readonly bool Exhaustible
 'Exhaustible' sets won't appear in the same level until after one world step (~10 min, see Map.ProgressWorld) has passed. More...
 
readonly float MinDistanceTraveled
 The event set won't become active until the submarine has travelled at least this far. A value between 0-1, where 0 is the beginning of the level and 1 the end of the level (e.g. 0.5 would mean the sub needs to be half-way through the level). More...
 
readonly float MinMissionTime
 The event set won't become active until the round has lasted at least this many seconds. More...
 
readonly float MinIntensity
 
readonly bool AllowAtStart
 If the event is not allowed at start, it won't become active until the submarine has moved at least 50 meters away from the beginning of the level. Only valid in LocationConnections (levels between locations). More...
 
readonly bool IgnoreCoolDown
 Normally an event (such as a monster spawn) triggers a cooldown during which no new events are created. This can be used to ignore the cooldown. More...
 
readonly bool TriggerEventCooldown
 Should this event set trigger the event cooldown (during which no new events are created) when it becomes active? More...
 
readonly bool IgnoreIntensity
 Normally events can only trigger if the intensity of the situation is low enough (e.g. you won't get new monster spawns if the submarine is already facing a disaster). This can be used to ignore the intensity. More...
 
readonly bool PerRuin
 The set is applied once per each ruin in the level. Can be used to ensure there's a consistent amount of monster spawns in the ruins in the level regardless of how many there are (and that no ruin monsters spawn if there are no ruins). More...
 
readonly bool PerCave
 The set is applied once per each cave in the level. Can be used to ensure there's a consistent amount of monster spawns in the cave in the level regardless of how many there are (and that no cave monsters spawn if there are no caves). More...
 
readonly bool PerWreck
 The set is applied once per each wreck in the level. Can be used to ensure there's a consistent amount of monster spawns in the wreck in the level regardless of how many there are (and that no wreck monsters spawn if there are no wreck). More...
 
readonly bool DisableInHuntingGrounds
 If enabled, this event will not be applied if the level contains hunting grounds. More...
 
readonly bool OncePerLevel
 If enabled, events from this set can only occur once in the level. More...
 
readonly bool DelayWhenCrewAway
 Should the event set be delayed if at least half of the crew is away from the submarine? The maximum amount of time the events can get delayed is defined in event manager settings (EventManagerSettings.FreezeDurationWhenCrewAway) More...
 
readonly bool Additive
 Additive sets are important to be aware of when creating custom event sets! If an additive set gets chosen for a level, the game will also select a non-additive one. This means you can for example configure an additive set that spawns custom monsters (and make it very common if you want the monsters to spawn frequently), which will spawn those custom monsters in addition to the vanilla monsters spawned by vanilla sets, without you having to add your custom monsters to every single vanilla set. More...
 
readonly float DefaultCommonness
 The commonness of the event set (i.e. how likely it is for this specific set to be chosen). More...
 
readonly ImmutableDictionary< Identifier, float > OverrideCommonness
 
readonly float ResetTime
 If set, the event set can trigger again after this amount of seconds has passed since it last triggered. More...
 
readonly int ForceAtDiscoveredNr
 Used to force an event set based on how many other locations have been discovered before this (used for campaign tutorial event sets). More...
 
readonly int ForceAtVisitedNr
 Used to force an event set based on how many other outposts have been visited before this (used for campaign tutorial event sets). More...
 
readonly bool CampaignTutorialOnly
 If enabled, this set can only occur when the campaign tutorial is enabled (generally used for the tutorial events). More...
 
readonly ImmutableArray< SubEventPrefabEventPrefabs
 
readonly ImmutableArray< EventSetChildSets
 
- Public Attributes inherited from Barotrauma.Prefab
readonly Identifier Identifier
 
readonly ContentFile ContentFile
 

Static Public Attributes

static readonly PrefabCollection< EventSetPrefabs = new PrefabCollection<EventSet>()
 
- Static Public Attributes inherited from Barotrauma.Prefab
static readonly ImmutableHashSet< Type > Types
 

Additional Inherited Members

- Protected Member Functions inherited from Barotrauma.Prefab
virtual Identifier DetermineIdentifier (XElement element)
 
- Properties inherited from Barotrauma.Prefab
ContentPackageContentPackage [get]
 
ContentPath FilePath [get]
 

Detailed Description

Event sets are sets of random events that occur within a level (most commonly, monster spawns and scripted events). Event sets can also be nested: a "parent set" can choose from several "subsets", either randomly or by some kind of criteria.

Definition at line 30 of file EventSet.cs.

Constructor & Destructor Documentation

◆ EventSet()

Barotrauma.EventSet.EventSet ( ContentXElement  element,
RandomEventsFile  file,
EventSet  parentSet = null 
)

Definition at line 336 of file EventSet.cs.

Member Function Documentation

◆ AddSetEventPrefabsToList()

static void Barotrauma.EventSet.AddSetEventPrefabsToList ( List< EventPrefab list,
EventSet  set 
)
static

Definition at line 74 of file EventSet.cs.

◆ CheckLocationTypeErrors()

void Barotrauma.EventSet.CheckLocationTypeErrors ( )

Definition at line 454 of file EventSet.cs.

◆ Dispose()

override void Barotrauma.EventSet.Dispose ( )
virtual

Implements Barotrauma.Prefab.

Definition at line 642 of file EventSet.cs.

◆ GetAllEventPrefabs()

static List<EventPrefab> Barotrauma.EventSet.GetAllEventPrefabs ( )
static

Definition at line 64 of file EventSet.cs.

◆ GetCommonness()

float Barotrauma.EventSet.GetCommonness ( Level  level)

Definition at line 466 of file EventSet.cs.

◆ GetDebugStatistics()

static List<string> Barotrauma.EventSet.GetDebugStatistics ( int  simulatedRoundCount = 100,
Func< MonsterEvent, bool >  filter = null,
bool  fullLog = false 
)
static

Definition at line 500 of file EventSet.cs.

◆ GetEventCount()

int Barotrauma.EventSet.GetEventCount ( Level  level)

Definition at line 486 of file EventSet.cs.

◆ GetEventPrefab()

static EventPrefab Barotrauma.EventSet.GetEventPrefab ( Identifier  identifier)
static

Definition at line 80 of file EventSet.cs.

◆ GetEventSprite()

static Sprite Barotrauma.EventSet.GetEventSprite ( string  identifier)
static

Definition at line 46 of file EventSet.cs.

◆ ToString()

override string Barotrauma.EventSet.ToString ( )

Definition at line 637 of file EventSet.cs.

Member Data Documentation

◆ Additive

readonly bool Barotrauma.EventSet.Additive

Additive sets are important to be aware of when creating custom event sets! If an additive set gets chosen for a level, the game will also select a non-additive one. This means you can for example configure an additive set that spawns custom monsters (and make it very common if you want the monsters to spawn frequently), which will spawn those custom monsters in addition to the vanilla monsters spawned by vanilla sets, without you having to add your custom monsters to every single vanilla set.

Definition at line 204 of file EventSet.cs.

◆ AllowAtStart

readonly bool Barotrauma.EventSet.AllowAtStart

If the event is not allowed at start, it won't become active until the submarine has moved at least 50 meters away from the beginning of the level. Only valid in LocationConnections (levels between locations).

Definition at line 152 of file EventSet.cs.

◆ BiomeIdentifier

readonly Identifier Barotrauma.EventSet.BiomeIdentifier

If set, the event set can only be chosen in this biome.

Definition at line 102 of file EventSet.cs.

◆ CampaignTutorialOnly

readonly bool Barotrauma.EventSet.CampaignTutorialOnly

If enabled, this set can only occur when the campaign tutorial is enabled (generally used for the tutorial events).

Definition at line 230 of file EventSet.cs.

◆ ChildSets

readonly ImmutableArray<EventSet> Barotrauma.EventSet.ChildSets

Definition at line 295 of file EventSet.cs.

◆ ChooseRandom

readonly bool Barotrauma.EventSet.ChooseRandom

If set, one event, or a sub event set, is chosen randomly from this set.

Definition at line 122 of file EventSet.cs.

◆ DefaultCommonness

readonly float Barotrauma.EventSet.DefaultCommonness

The commonness of the event set (i.e. how likely it is for this specific set to be chosen).

Definition at line 209 of file EventSet.cs.

◆ DelayWhenCrewAway

readonly bool Barotrauma.EventSet.DelayWhenCrewAway

Should the event set be delayed if at least half of the crew is away from the submarine? The maximum amount of time the events can get delayed is defined in event manager settings (EventManagerSettings.FreezeDurationWhenCrewAway)

Definition at line 197 of file EventSet.cs.

◆ DisableInHuntingGrounds

readonly bool Barotrauma.EventSet.DisableInHuntingGrounds

If enabled, this event will not be applied if the level contains hunting grounds.

Definition at line 187 of file EventSet.cs.

◆ EventPrefabs

readonly ImmutableArray<SubEventPrefab> Barotrauma.EventSet.EventPrefabs

Definition at line 293 of file EventSet.cs.

◆ Exhaustible

readonly bool Barotrauma.EventSet.Exhaustible

'Exhaustible' sets won't appear in the same level until after one world step (~10 min, see Map.ProgressWorld) has passed.

Definition at line 134 of file EventSet.cs.

◆ Faction

readonly Identifier Barotrauma.EventSet.Faction

If set, the event set can only be chosen in locations that belong to this faction.

Definition at line 117 of file EventSet.cs.

◆ ForceAtDiscoveredNr

readonly int Barotrauma.EventSet.ForceAtDiscoveredNr

Used to force an event set based on how many other locations have been discovered before this (used for campaign tutorial event sets).

Definition at line 220 of file EventSet.cs.

◆ ForceAtVisitedNr

readonly int Barotrauma.EventSet.ForceAtVisitedNr

Used to force an event set based on how many other outposts have been visited before this (used for campaign tutorial event sets).

Definition at line 225 of file EventSet.cs.

◆ IgnoreCoolDown

readonly bool Barotrauma.EventSet.IgnoreCoolDown

Normally an event (such as a monster spawn) triggers a cooldown during which no new events are created. This can be used to ignore the cooldown.

Definition at line 157 of file EventSet.cs.

◆ IgnoreIntensity

readonly bool Barotrauma.EventSet.IgnoreIntensity

Normally events can only trigger if the intensity of the situation is low enough (e.g. you won't get new monster spawns if the submarine is already facing a disaster). This can be used to ignore the intensity.

Definition at line 167 of file EventSet.cs.

◆ IsCampaignSet

readonly bool Barotrauma.EventSet.IsCampaignSet

If enabled, this set can only be chosen in the campaign mode.

Definition at line 88 of file EventSet.cs.

◆ LevelType

readonly LevelData.LevelType Barotrauma.EventSet.LevelType

If set, the event set can only be chosen in this type of level (outpost level or a connection between outpost levels).

Definition at line 107 of file EventSet.cs.

◆ LocationTypeIdentifiers

readonly ImmutableArray<Identifier> Barotrauma.EventSet.LocationTypeIdentifiers

If set, the event set can only be chosen in locations of this type.

Definition at line 112 of file EventSet.cs.

◆ MaxLevelDifficulty

readonly float Barotrauma.EventSet.MaxLevelDifficulty

The difficulty of the current level must be equal to or less than this for this set to be chosen.

Definition at line 97 of file EventSet.cs.

◆ MinDistanceTraveled

readonly float Barotrauma.EventSet.MinDistanceTraveled

The event set won't become active until the submarine has travelled at least this far. A value between 0-1, where 0 is the beginning of the level and 1 the end of the level (e.g. 0.5 would mean the sub needs to be half-way through the level).

Definition at line 139 of file EventSet.cs.

◆ MinIntensity

readonly float Barotrauma.EventSet.MinIntensity

Definition at line 147 of file EventSet.cs.

◆ MinLevelDifficulty

readonly float Barotrauma.EventSet.MinLevelDifficulty

The difficulty of the current level must be equal to or higher than this for this set to be chosen.

Definition at line 93 of file EventSet.cs.

◆ MinMissionTime

readonly float Barotrauma.EventSet.MinMissionTime

The event set won't become active until the round has lasted at least this many seconds.

Definition at line 144 of file EventSet.cs.

◆ OncePerLevel

readonly bool Barotrauma.EventSet.OncePerLevel

If enabled, events from this set can only occur once in the level.

Definition at line 192 of file EventSet.cs.

◆ OverrideCommonness

readonly ImmutableDictionary<Identifier, float> Barotrauma.EventSet.OverrideCommonness

Definition at line 210 of file EventSet.cs.

◆ PerCave

readonly bool Barotrauma.EventSet.PerCave

The set is applied once per each cave in the level. Can be used to ensure there's a consistent amount of monster spawns in the cave in the level regardless of how many there are (and that no cave monsters spawn if there are no caves).

Definition at line 177 of file EventSet.cs.

◆ PerRuin

readonly bool Barotrauma.EventSet.PerRuin

The set is applied once per each ruin in the level. Can be used to ensure there's a consistent amount of monster spawns in the ruins in the level regardless of how many there are (and that no ruin monsters spawn if there are no ruins).

Definition at line 172 of file EventSet.cs.

◆ PerWreck

readonly bool Barotrauma.EventSet.PerWreck

The set is applied once per each wreck in the level. Can be used to ensure there's a consistent amount of monster spawns in the wreck in the level regardless of how many there are (and that no wreck monsters spawn if there are no wreck).

Definition at line 182 of file EventSet.cs.

◆ Prefabs

readonly PrefabCollection<EventSet> Barotrauma.EventSet.Prefabs = new PrefabCollection<EventSet>()
static

Definition at line 44 of file EventSet.cs.

◆ ResetTime

readonly float Barotrauma.EventSet.ResetTime

If set, the event set can trigger again after this amount of seconds has passed since it last triggered.

Definition at line 215 of file EventSet.cs.

◆ SubSetCount

readonly int Barotrauma.EventSet.SubSetCount = 1

Definition at line 128 of file EventSet.cs.

◆ TriggerEventCooldown

readonly bool Barotrauma.EventSet.TriggerEventCooldown

Should this event set trigger the event cooldown (during which no new events are created) when it becomes active?

Definition at line 162 of file EventSet.cs.