Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_MoveTask.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/Tasks", description: "Move task.", color: "0 0 255 255")]
3 {
4 };
6 {
7  [Attribute("5")]
8  protected float m_fMaxDistance;
9 
10  void PeriodicalCheck()
11  {
12  if (!GetTaskManager())
13  return;
14 
16  if (!supportEntity)
17  return;
18 
19  array<SCR_BaseTaskExecutor> assignees = new array<SCR_BaseTaskExecutor>();
20  GetAssignees(assignees);
21 
22  for (int x = assignees.Count() - 1; x >= 0; x--)
23  {
24  int id = SCR_BaseTaskExecutor.GetTaskExecutorID(assignees[x]);
25  IEntity controlledEntity = SCR_PossessingManagerComponent.GetPlayerMainEntity(id);
26 
27  if (!controlledEntity)
28  continue;
29 
30  float distance = vector.Distance(controlledEntity.GetOrigin(), GetOrigin());
31 
32  if (distance < m_fMaxDistance)
33  {
34  supportEntity.FinishTask(this);
35  return;
36  }
37  }
38  }
39 
40  override void SetTaskCompletionType(EEditorTaskCompletionType newTaskCompletionType)
41  {
42  if (m_iTaskCompletionType == newTaskCompletionType)
43  return;
44 
45  super.SetTaskCompletionType(newTaskCompletionType);
46 
47  if (GetTaskManager().IsProxy())
48  return;
49 
50  if (m_iTaskCompletionType == EEditorTaskCompletionType.AUTOMATIC)
51  SCR_BaseTaskManager.s_OnPeriodicalCheck2Second.Insert(PeriodicalCheck);
52  else
53  SCR_BaseTaskManager.s_OnPeriodicalCheck2Second.Remove(PeriodicalCheck);
54  }
55 
56  void SCR_MoveTask(IEntitySource src, IEntity parent)
57  {
58  if (SCR_Global.IsEditMode(this))
59  return;
60 
61  if (!GetTaskManager().IsProxy() && m_iTaskCompletionType == EEditorTaskCompletionType.AUTOMATIC)
62  SCR_BaseTaskManager.s_OnPeriodicalCheck2Second.Insert(PeriodicalCheck);
63  }
64  void ~SCR_MoveTask()
65  {
66  if (SCR_Global.IsEditMode(this) || !GetGame().GetGameMode())
67  return;
68 
69  if (!GetTaskManager().IsProxy() && m_iTaskCompletionType == EEditorTaskCompletionType.AUTOMATIC)
70  SCR_BaseTaskManager.s_OnPeriodicalCheck2Second.Remove(PeriodicalCheck);
71  }
72 
73 };
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
GetGameMode
SCR_BaseGameMode GetGameMode()
Definition: SCR_BaseGameModeComponent.c:15
GetOrigin
vector GetOrigin()
Definition: SCR_AIUtilityComponent.c:279
IsProxy
protected bool IsProxy()
Definition: SCR_CampaignBuildingCompositionComponent.c:456
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_MoveTaskClass
Definition: SCR_MoveTask.c:2
distance
float distance
Definition: SCR_DestructibleTreeV2.c:29
GetTaskManager
SCR_BaseTaskManager GetTaskManager()
Definition: SCR_BaseTaskManager.c:7
SCR_BaseTaskManager
Definition: SCR_BaseTaskManager.c:25
SCR_EditorTask
Definition: SCR_EditorTask.c:7
SCR_EditorTaskClass
Definition: SCR_EditorTask.c:2
SCR_BaseTaskSupportEntity
Definition: SCR_BaseTaskSupportEntity.c:8
EEditorTaskCompletionType
EEditorTaskCompletionType
Way of determening if a task is completed automaticly, manually or always manually (In the latter cas...
Definition: EEditorTaskCompletionType.c:2
SCR_BaseTaskExecutor
Definition: SCR_BaseTaskExecutor.c:7
SCR_Global
Definition: Functions.c:6
SCR_MoveTask
Definition: SCR_MoveTask.c:5
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180