Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_EvacuateTask.c
Go to the documentation of this file.
1
//[EntityEditorProps(category: "GameScripted/Tasks", description: "A support task.", color: "0 0 255 255")]
2
//class SCR_EvacuateTaskClass: SCR_RequestedTaskClass
3
//{
4
//};
5
//
7
//class SCR_EvacuateTask : SCR_RequestedTask
8
//{
9
// static const string SUPPORT_TASK_DESCRIPTION_TEXT = "#AR-CampaignTasks_TitleEvac";
10
// static const SCR_ECampaignBaseType BASES_FILTER = SCR_ECampaignBaseType.BASE;
11
//
12
// protected vector m_vStartOrigin;
13
//
14
// //------------------------------------------------------------------------------------------------
15
// static float GetMinDistanceFromStart()
16
// {
17
// if (!GetTaskManager())
18
// return 1000;
19
//
20
// SCR_EvacuateTaskSupportEntity supportEntity = SCR_EvacuateTaskSupportEntity.Cast(GetTaskManager().FindSupportEntity(SCR_EvacuateTaskSupportEntity));
21
// if (supportEntity)
22
// return supportEntity.GetMinDistanceFromStart();
23
//
24
// return 1000;
25
// }
26
//
27
// //------------------------------------------------------------------------------------------------
28
// static float GetMaxDistanceFromRequester()
29
// {
30
// if (!GetTaskManager())
31
// return 50;
32
//
33
// SCR_EvacuateTaskSupportEntity supportEntity = SCR_EvacuateTaskSupportEntity.Cast(GetTaskManager().FindSupportEntity(SCR_EvacuateTaskSupportEntity));
34
// if (supportEntity)
35
// return supportEntity.GetMaxDistanceFromRequester();
36
//
37
// return 50;
38
// }
39
//
40
// //------------------------------------------------------------------------------------------------
41
// void PeriodicalCheck()
42
// {
43
// if (!GetTaskManager())
44
// return;
45
//
46
// SCR_BaseTaskSupportEntity supportEntity = GetTaskManager().FindSupportEntity(SCR_BaseTaskSupportEntity);
47
// if (!supportEntity)
48
// return;
49
//
50
// bool assigneeCloseEnough = true;
51
// bool requesterInBase = false;
52
// GenericEntity requesterEntity = GenericEntity.Cast(m_Requester.GetControlledEntity());
53
//
54
// if (!requesterEntity)
55
// {
56
// supportEntity.FailTask(this);
57
// return;
58
// }
59
//
60
// FactionAffiliationComponent factionAffiliationComponent = FactionAffiliationComponent.Cast(requesterEntity.FindComponent(FactionAffiliationComponent));
61
// if (!factionAffiliationComponent)
62
// return;
63
//
64
// Faction requesterFaction = factionAffiliationComponent.GetAffiliatedFaction();
65
//
66
// vector requesterOrigin = requesterEntity.GetOrigin();
67
//
68
// array<SCR_MilitaryBaseComponent> bases = {};
69
// SCR_MilitaryBaseSystem.GetInstance().GetBases(bases);
70
//
71
// for (int i = 0; i < bases.Count(); i++)
72
// {
73
// SCR_CampaignMilitaryBaseComponent campaignBase = SCR_CampaignMilitaryBaseComponent.Cast(bases[i]);
74
//
75
// if (!campaignBase)
76
// continue;
77
//
78
// if (requesterFaction != campaignBase.GetCampaignFaction())
79
// continue;
80
//
81
// vector baseOrigin = campaignBase.GetOwner().GetOrigin();
82
// float baseToStartDistance = vector.Distance(baseOrigin, m_vStartOrigin);
83
//
84
// if (baseToStartDistance < SCR_EvacuateTask.GetMinDistanceFromStart())
85
// continue;
86
//
87
// if (!campaignBase.GetIsEntityPresent(requesterEntity))
88
// continue;
89
//
90
// requesterInBase = true;
91
// break;
92
// }
93
//
94
// SCR_BaseTaskExecutor assignee = GetAssignee();
95
// if (!assignee)
96
// assigneeCloseEnough = false;
97
// else
98
// {
99
// IEntity assigneeEntity = assignee.GetControlledEntity();
100
// vector assigneePosition = vector.Zero;
101
// if (assigneeEntity)
102
// assigneePosition = assigneeEntity.GetOrigin();
103
// float distance = vector.Distance(requesterOrigin, assigneePosition);
104
//
105
// if (distance > SCR_EvacuateTask.GetMaxDistanceFromRequester())
106
// assigneeCloseEnough = false;
107
// }
108
//
109
// if (requesterInBase)
110
// {
111
// if (assigneeCloseEnough)
112
// supportEntity.FinishTask(this);
113
// else
114
// supportEntity.FailTask(this);
115
// }
116
// }
117
//
118
// //------------------------------------------------------------------------------------------------
119
// void SetStartOrigin(vector startOrigin)
120
// {
121
// if (m_vStartOrigin != vector.Zero)
122
// {
123
// m_vStartOrigin = startOrigin;
124
// return;
125
// }
126
//
127
// if (!m_Requester)
128
// return;
129
//
130
// GenericEntity requesterEntity = GenericEntity.Cast(m_Requester.GetControlledEntity());
131
// if (!requesterEntity)
132
// return;
133
//
134
// m_vStartOrigin = requesterEntity.GetOrigin();
135
//
136
// ShowAvailableTask();
137
// }
138
//
139
// //------------------------------------------------------------------------------------------------
140
// vector GetStartOrigin()
141
// {
142
// return m_vStartOrigin;
143
// }
144
//
145
// //------------------------------------------------------------------------------------------------
146
// override bool RplSave(ScriptBitWriter writer)
147
// {
148
// vector startOrigin = GetStartOrigin();
149
// writer.WriteVector(startOrigin);
150
//
151
// return super.RplSave(writer);
152
// }
153
//
154
// //------------------------------------------------------------------------------------------------
155
// override bool RplLoad(ScriptBitReader reader)
156
// {
157
// vector startOrigin;
158
// reader.ReadVector(startOrigin);
159
// SetStartOrigin(startOrigin);
160
//
161
// return super.RplLoad(reader);
162
// }
163
//
164
// //------------------------------------------------------------------------------------------------
165
// void SCR_EvacuateTask(IEntitySource src, IEntity parent)
166
// {
167
// if (SCR_Global.IsEditMode(this))
168
// return;
169
//
170
// SetEventMask(EntityEvent.FRAME);
171
// SetIndividual(true);
172
//
173
// if (!GetTaskManager().IsProxy())
174
// SCR_BaseTaskManager.s_OnPeriodicalCheck5Second.Insert(PeriodicalCheck);
175
// }
176
//
177
// //------------------------------------------------------------------------------------------------
178
// void ~SCR_EvacuateTask()
179
// {
180
// if (SCR_Global.IsEditMode(this) || !GetGame().GetGameMode())
181
// return;
182
//
183
// if (!GetTaskManager().IsProxy())
184
// SCR_BaseTaskManager.s_OnPeriodicalCheck5Second.Remove(PeriodicalCheck);
185
// }
186
//
187
//};
scripts
Game
Tasks
SCR_EvacuateTask.c
Generated by
1.17.0