Client LuaCsForBarotrauma
GoTo.cs
1 namespace Barotrauma
2 {
6  class GoTo : EventAction
7  {
8  [Serialize("", IsPropertySaveable.Yes, description: "Name of the label to jump to.")]
9  public string Name { get; set; }
10 
11  [Serialize(-1, IsPropertySaveable.Yes, description: "How many times can this GoTo action be repeated? Can be used to make some parts of an event repeat a limited number of times. If negative or zero, there's no limit.")]
12  public int MaxTimes { get; set; }
13 
14  [Serialize(true, IsPropertySaveable.Yes, description: "By default, jumping to another part in the event closes the active conversation prompt. Use this if if you want to keep it open instead.")]
15  public bool EndConversation { get; set; }
16 
17  private int counter;
18 
19  public GoTo(ScriptedEvent parentEvent, ContentXElement element) : base(parentEvent, element) { }
20 
21  public override bool IsFinished(ref string goTo)
22  {
23  if (counter < MaxTimes || MaxTimes <= 0)
24  {
25  goTo = Name;
26  counter++;
27  }
28  return true;
29  }
30 
31  public override string ToDebugString()
32  {
33  string msg = $"[-] Go to label \"{Name}\"";
34  if (MaxTimes > 0)
35  {
36  msg += $" ({counter}/{MaxTimes})";
37  }
38  return msg;
39  }
40 
41  public override void Reset() { }
42  }
43 }
Makes the event jump to a Label somewhere else in the event.
Definition: GoTo.cs:7
override bool IsFinished(ref string goTo)
Has the action finished.
Definition: GoTo.cs:21
override string ToDebugString()
Rich test to display in debugdraw
Definition: GoTo.cs:31
GoTo(ScriptedEvent parentEvent, ContentXElement element)
Definition: GoTo.cs:19
int MaxTimes
Definition: GoTo.cs:12
string Name
Definition: GoTo.cs:9
bool EndConversation
Definition: GoTo.cs:15
override void Reset()
Definition: GoTo.cs:41