Client LuaCsForBarotrauma
TriggerEventAction.cs
1 namespace Barotrauma
2 {
7  {
8  [Serialize("", IsPropertySaveable.Yes, description: "Identifier of the event to trigger.")]
9  public Identifier Identifier { get; set; }
10 
11  [Serialize("", IsPropertySaveable.Yes, description: "Tag of the event to trigger.")]
12  public Identifier EventTag { get; set; }
13 
14  [Serialize(false, IsPropertySaveable.Yes, description: "If set to true, the event will trigger at the beginning of the next round. Useful for e.g. triggering some scripted event in the outpost after you finish a mission.")]
15  public bool NextRound { get; set; }
16 
17  private bool isFinished;
18 
19  public TriggerEventAction(ScriptedEvent parentEvent, ContentXElement element) : base(parentEvent, element) { }
20 
21  public override bool IsFinished(ref string goTo)
22  {
23  return isFinished;
24  }
25  public override void Reset()
26  {
27  isFinished = false;
28  }
29 
30  public override void Update(float deltaTime)
31  {
32  if (isFinished) { return; }
33 
34  if (GameMain.GameSession?.EventManager != null)
35  {
36  if (NextRound)
37  {
39  }
40  else
41  {
43  if (eventPrefab != null)
44  {
46  if (ev != null)
47  {
49  }
50  }
51  }
52  }
53 
54  isFinished = true;
55  }
56 
57  public override string ToDebugString()
58  {
59  return $"{ToolBox.GetDebugSymbol(isFinished)} {nameof(TriggerEventAction)} -> (EventPrefab: {Identifier.ColorizeObject()})";
60  }
61  }
62 }
readonly ScriptedEvent ParentEvent
Definition: EventAction.cs:106
EventPrefab Prefab
Definition: Event.cs:16
Event CreateInstance(int seed)
Definition: EventPrefab.cs:127
static EventPrefab FindEventPrefab(Identifier identifier, Identifier tag, ContentPackage source)
Finds an event prefab with the specified identifier, or if it isn't defined, a random event prefab wi...
Definition: EventPrefab.cs:167
static GameSession?? GameSession
Definition: GameMain.cs:88
ContentPackage? ContentPackage
Definition: Prefab.cs:37
Triggers another event (can also trigger things other than scripted events, for example monster event...
override void Update(float deltaTime)
TriggerEventAction(ScriptedEvent parentEvent, ContentXElement element)
override bool IsFinished(ref string goTo)
Has the action finished.
override string ToDebugString()
Rich test to display in debugdraw