Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_FireSupportRequestedTaskEntity.c
Go to the documentation of this file.
4
5class SCR_FireSupportRequestedTaskEntity : SCR_BaseRequestedTaskEntity
6{
7 [Attribute("150", UIWidgets.EditBox, "Area radius [m]", "1 inf")]
8 protected float m_fAreaRadius;
9
10 [Attribute("4", UIWidgets.EditBox, desc: "Number of explosion events in the area required to complete the task", "1 inf")]
12
13 [Attribute("", UIWidgets.ResourceAssignArray, "Allowed explosion ammo for task evaluation", "et")]
14 protected ref array<ResourceName> m_aAllowedExplosionAmmo;
15
16 protected RplComponent m_RplComponent;
17 protected float m_fAreaRadiusSq;
18 protected int m_iExplosionEvents;
19
20 //------------------------------------------------------------------------------------------------
21 protected void AddXPReward()
22 {
23 if (!m_RplComponent || m_RplComponent.IsProxy())
24 return;
25
26 SCR_XPHandlerComponent comp = SCR_XPHandlerComponent.Cast(GetGame().GetGameMode().FindComponent(SCR_XPHandlerComponent));
27 if (!comp)
28 return;
29
30 // add XP to all players in the assigned group
31 array<int> assigneePlayerIDs = GetTaskAssigneePlayerIDs();
32 if (!assigneePlayerIDs)
33 return;
34
35 foreach (int playerID : assigneePlayerIDs)
36 {
37 comp.AwardXP(playerID, SCR_EXPRewards.FIRE_SUPPORT_TASK_COMPLETED, 1.0, false);
38 }
39 }
40
41 //------------------------------------------------------------------------------------------------
42 override void SetTaskState(SCR_ETaskState state)
43 {
44 if (state == SCR_ETaskState.COMPLETED)
46
47 super.SetTaskState(state);
48 }
49
50 //------------------------------------------------------------------------------------------------
51 protected bool IsAllowedExplosionAmmo(IEntity damageSource)
52 {
53 if (!damageSource)
54 return false;
55
56 EntityPrefabData damageSourcePrefabData = damageSource.GetPrefabData();
57 if (!damageSourcePrefabData)
58 return false;
59
60 ResourceName damageSourcePrefabName = damageSourcePrefabData.GetPrefabName();
61 if (damageSourcePrefabName.IsEmpty())
62 return false;
63
64 return m_aAllowedExplosionAmmo.Contains(damageSourcePrefabName);
65 }
66
67 //------------------------------------------------------------------------------------------------
68 protected void OnExplosionAmmoEffect(IEntity pHitEntity, inout vector outMat[3], IEntity damageSource, notnull Instigator instigator, string colliderName, float speed)
69 {
70 int instigatorPlayerID = instigator.GetInstigatorPlayerID();
71 if (instigatorPlayerID <= 0)
72 return;
73
74 if (!IsAllowedExplosionAmmo(damageSource))
75 return;
76
77 if (vector.DistanceSqXZ(outMat[0], GetTaskPosition()) > m_fAreaRadiusSq)
78 return;
79
80 array<int> assigneePlayerIDs = GetTaskAssigneePlayerIDs();
81 if (!assigneePlayerIDs)
82 return;
83
84 if (!assigneePlayerIDs.Contains(instigatorPlayerID))
85 return;
86
88
90 }
91
92 //------------------------------------------------------------------------------------------------
93 protected void EvaluateTask()
94 {
96 {
98 DeleteTask();
99 }
100 }
101
102 //------------------------------------------------------------------------------------------------
103 override void EOnInit(IEntity owner)
104 {
105 super.EOnInit(owner);
106
107 if (SCR_Global.IsEditMode(this))
108 return;
109
111
112 m_RplComponent = RplComponent.Cast(owner.FindComponent(RplComponent));
113 if (!m_RplComponent || m_RplComponent.IsProxy())
114 return;
115
117 }
118
119 //------------------------------------------------------------------------------------------------
124}
ArmaReforgerScripted GetGame()
Definition game.c:1398
void DeleteTask()
override void SetTaskState(SCR_ETaskState state)
float m_fAreaRadius
float m_fAreaRadiusSq
SCR_BaseGameMode GetGameMode()
RplComponent m_RplComponent
void AddXPReward()
bool IsAllowedExplosionAmmo(IEntity damageSource)
void OnExplosionAmmoEffect(IEntity pHitEntity, inout vector outMat[3], IEntity damageSource, notnull Instigator instigator, string colliderName, float speed)
ref array< ResourceName > m_aAllowedExplosionAmmo
void ~SCR_FireSupportRequestedTaskEntity()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
array< int > GetTaskAssigneePlayerIDs()
Definition SCR_Task.c:458
vector GetTaskPosition()
Definition SCR_Task.c:1282
SCR_ETaskState
Definition SCR_Task.c:3
proto external Managed FindComponent(typename typeName)
proto external EntityPrefabData GetPrefabData()
static OnExplosionAmmoEffectInvoker GetOnExplosionAmmoEffect()
static bool IsEditMode()
Definition Functions.c:1566
override void EOnInit(IEntity owner)
SCR_FieldOfViewSettings Attribute