Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_TriggerTask.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/Tasks", description: "")]
5
6class SCR_TriggerTask : SCR_AttachableTask
7{
8 [Attribute(desc: "When enabled, task will fail upon activation instead of being completed.", category: "Trigger Task")]
9 protected bool m_bToFail;
10
11 [Attribute(desc: "When enabled, task will change state when its trigger is deactivated instead of activated.", category: "Trigger Task")]
12 protected bool m_bOnTriggerDeactivate;
13
15
16 //------------------------------------------------------------------------------------------------
17 protected void OnTriggerActivate()
18 {
19 SCR_TaskSystem taskSystem = SCR_TaskSystem.GetInstance();
20 if (!taskSystem)
21 return;
22
24 return;
25
27 {
28 if (m_bToFail)
29 taskSystem.SetTaskState(this, SCR_ETaskState.FAILED);
30 else
31 taskSystem.SetTaskState(this, SCR_ETaskState.COMPLETED);
32 }
33 }
34
35 //------------------------------------------------------------------------------------------------
36 protected void OnTriggerDeactivate()
37 {
38 SCR_TaskSystem taskSystem = SCR_TaskSystem.GetInstance();
39 if (!taskSystem)
40 return;
41
43 return;
44
46 {
47 if (m_bToFail)
48 taskSystem.SetTaskState(this, SCR_ETaskState.FAILED);
49 else
50 taskSystem.SetTaskState(this, SCR_ETaskState.COMPLETED);
51 }
52 }
53
54 //------------------------------------------------------------------------------------------------
55 override void AddOwnerFactionKey(FactionKey factionKey)
56 {
57 super.AddOwnerFactionKey(factionKey);
58
59 if (m_Trigger)
60 m_Trigger.AddOwnerFaction(factionKey);
61 }
62
63 //------------------------------------------------------------------------------------------------
64 override void EOnInit(IEntity owner)
65 {
66 super.EOnInit(owner);
67
68 if (Replication.IsServer())
69 {
70 IEntity child = GetChildren();
71 while (child)
72 {
74 if (m_Trigger)
75 break;
76 else
77 child = child.GetSibling();
78 }
79
80 if (m_Trigger)
81 {
82 m_Trigger.GetOnActivate().Insert(OnTriggerActivate);
83 m_Trigger.GetOnDeactivate().Insert(OnTriggerDeactivate);
84 }
85 else if (!SCR_Global.IsEditMode(this))
86 {
87 Print("SCR_TriggerTask is missing a child of type SCR_BaseFactionTriggerEntity!", LogLevel.ERROR);
88 }
89 }
90 }
91}
EEditorTaskCompletionType
Way of determening if a task is completed automaticly, manually or always manually (In the latter cas...
void SCR_BaseFactionTriggerEntity(IEntitySource src, IEntity parent)
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
EEditorTaskCompletionType m_iTaskCompletionType
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void GetChildren(out array< SCR_ScenarioFrameworkLayerBase > children)
SCR_ETaskState
Definition SCR_Task.c:3
void OnTriggerDeactivate()
void OnTriggerActivate()
bool m_bOnTriggerDeactivate
SCR_BaseFactionTriggerEntity m_Trigger
override void AddOwnerFactionKey(FactionKey factionKey)
proto external IEntity GetSibling()
Main replication API.
Definition Replication.c:14
static bool IsEditMode()
Definition Functions.c:1566
override void EOnInit(IEntity owner)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute