Client LuaCsForBarotrauma
TriggerEventAction.cs
1
namespace
Barotrauma
2
{
6
class
TriggerEventAction
:
EventAction
7
{
8
[
Serialize
(
""
,
IsPropertySaveable
.Yes, description:
"Identifier of the event to trigger."
)]
9
public
Identifier
Identifier
{
get
;
set
; }
10
11
[
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."
)]
12
public
bool
NextRound
{
get
;
set
; }
13
14
private
bool
isFinished;
15
16
public
TriggerEventAction
(
ScriptedEvent
parentEvent,
ContentXElement
element) : base(parentEvent, element) { }
17
18
public
override
bool
IsFinished
(ref
string
goTo)
19
{
20
return
isFinished;
21
}
22
public
override
void
Reset
()
23
{
24
isFinished =
false
;
25
}
26
27
public
override
void
Update
(
float
deltaTime)
28
{
29
if
(isFinished) {
return
; }
30
31
if
(
GameMain
.
GameSession
?.
EventManager
!=
null
)
32
{
33
if
(
NextRound
)
34
{
35
GameMain
.
GameSession
.
EventManager
.
QueuedEventsForNextRound
.Enqueue(
Identifier
);
36
}
37
else
38
{
39
var eventPrefab =
EventSet
.
GetEventPrefab
(
Identifier
);
40
if
(eventPrefab ==
null
)
41
{
42
DebugConsole.ThrowError($
"Error in TriggerEventAction - could not find an event with the identifier {Identifier}."
,
43
contentPackage:
ParentEvent
.
Prefab
.
ContentPackage
);
44
}
45
else
46
{
47
var ev = eventPrefab.
CreateInstance
(
GameMain
.
GameSession
.
EventManager
.
RandomSeed
);
48
if
(ev !=
null
)
49
{
50
GameMain
.
GameSession
.
EventManager
.
QueuedEvents
.Enqueue(ev);
51
}
52
}
53
}
54
}
55
56
isFinished =
true
;
57
}
58
59
public
override
string
ToDebugString
()
60
{
61
return
$
"{ToolBox.GetDebugSymbol(isFinished)} {nameof(TriggerEventAction)} -> (EventPrefab: {Identifier.ColorizeObject()})"
;
62
}
63
}
64
}
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.EventAction
Definition:
EventAction.cs:9
Barotrauma.EventAction.ParentEvent
readonly ScriptedEvent ParentEvent
Definition:
EventAction.cs:102
Barotrauma.Event.Prefab
EventPrefab Prefab
Definition:
Event.cs:16
Barotrauma.EventManager.QueuedEvents
readonly Queue< Event > QueuedEvents
Definition:
BarotraumaShared/SharedSource/Events/EventManager.cs:118
Barotrauma.EventManager.QueuedEventsForNextRound
readonly Queue< Identifier > QueuedEventsForNextRound
Definition:
BarotraumaShared/SharedSource/Events/EventManager.cs:120
Barotrauma.EventManager.RandomSeed
int RandomSeed
Definition:
BarotraumaShared/SharedSource/Events/EventManager.cs:147
Barotrauma.EventPrefab.CreateInstance
Event CreateInstance(int seed)
Definition:
EventPrefab.cs:115
Barotrauma.EventSet
Event sets are sets of random events that occur within a level (most commonly, monster spawns and scr...
Definition:
EventSet.cs:31
Barotrauma.EventSet.GetEventPrefab
static EventPrefab GetEventPrefab(Identifier identifier)
Definition:
EventSet.cs:80
Barotrauma.GameMain
Definition:
GameMain.cs:25
Barotrauma.GameMain.GameSession
static GameSession?? GameSession
Definition:
GameMain.cs:88
Barotrauma.GameSession.EventManager
readonly EventManager EventManager
Definition:
BarotraumaShared/SharedSource/GameSession/GameSession.cs:26
Barotrauma.Prefab.ContentPackage
ContentPackage? ContentPackage
Definition:
Prefab.cs:37
Barotrauma.ScriptedEvent
Definition:
ScriptedEvent.cs:9
Barotrauma.Serialize
Definition:
SerializableProperty.cs:23
Barotrauma.TriggerEventAction
Triggers another scripted event.
Definition:
TriggerEventAction.cs:7
Barotrauma.TriggerEventAction.Update
override void Update(float deltaTime)
Definition:
TriggerEventAction.cs:27
Barotrauma.TriggerEventAction.TriggerEventAction
TriggerEventAction(ScriptedEvent parentEvent, ContentXElement element)
Definition:
TriggerEventAction.cs:16
Barotrauma.TriggerEventAction.IsFinished
override bool IsFinished(ref string goTo)
Has the action finished.
Definition:
TriggerEventAction.cs:18
Barotrauma.TriggerEventAction.ToDebugString
override string ToDebugString()
Rich test to display in debugdraw
Definition:
TriggerEventAction.cs:59
Barotrauma.TriggerEventAction.Reset
override void Reset()
Definition:
TriggerEventAction.cs:22
Barotrauma.TriggerEventAction.NextRound
bool NextRound
Definition:
TriggerEventAction.cs:12
Barotrauma.TriggerEventAction.Identifier
Identifier Identifier
Definition:
TriggerEventAction.cs:9
Barotrauma
Definition:
AchievementManager.cs:12
Barotrauma.IsPropertySaveable
IsPropertySaveable
Definition:
SerializableProperty.cs:16
Barotrauma
BarotraumaShared
SharedSource
Events
EventActions
TriggerEventAction.cs
Generated by
1.9.1