Client LuaCsForBarotrauma
OnRoundEndAction.cs
1 #nullable enable
2 
3 namespace Barotrauma
4 {
9  {
10  private readonly SubactionGroup subActions;
11 
12  public OnRoundEndAction(ScriptedEvent parentEvent, ContentXElement element) : base(parentEvent, element)
13  {
14  subActions = new SubactionGroup(parentEvent, element);
15  }
16 
17  public override bool IsFinished(ref string goToLabel)
18  {
19  return false;
20  }
21 
22  public override void Update(float deltaTime)
23  {
24  int remainingTries = 100;
25  string? throwaway = null;
26  //normally the ref string goTo passed to IsFinished should be used to jump another place in the event,
27  //but in this case we don't want that (the subactions should just run once when the round ends)
28  while (remainingTries > 0 && !subActions.IsFinished(ref throwaway))
29  {
30  subActions.Update(deltaTime);
31  Entity.Spawner?.Update(createNetworkEvents: false);
32  remainingTries--;
33  }
34  }
35 
36  public override void Reset()
37  {
38  }
39 
40  public override string ToDebugString()
41  {
42  return nameof(OnRoundEndAction);
43  }
44  }
45 }
static EntitySpawner Spawner
Definition: Entity.cs:31
Executes all the child actions when the round ends.
override bool IsFinished(ref string goToLabel)
Has the action finished.
override string ToDebugString()
Rich test to display in debugdraw
override void Update(float deltaTime)
OnRoundEndAction(ScriptedEvent parentEvent, ContentXElement element)