Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkGetNearestEntity.c
Go to the documentation of this file.
3{
4 [Attribute(desc: "Center entity getter. ")]
5 ref SCR_ScenarioFrameworkGet m_CenterEntityGetter;
6
7 [Attribute(defvalue: "0", desc: "Radius", params: "0 inf 0.01")]
8 float m_fRadius;
9
10 [Attribute(defvalue: "", desc: "Searched Entity", uiwidget: UIWidgets.ResourcePickerThumbnail, params: "et xob")]
11 ResourceName m_sSearchedEntityResourceName;
12
13 protected IEntity m_Entity;
14
15 //------------------------------------------------------------------------------------------------
17 {
18 if (!m_CenterEntityGetter)
19 return null;
20
21 SCR_ScenarioFrameworkParam<IEntity> centerEntityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_CenterEntityGetter.Get());
22 if (!centerEntityWrapper)
23 return null;
24
25 IEntity centerEntity = centerEntityWrapper.GetValue();
26 if (!centerEntity)
27 return null;
28
29 if (m_sSearchedEntityResourceName.Contains(".xob"))
30 GetGame().GetWorld().QueryEntitiesBySphere(centerEntity.GetOrigin(), m_fRadius, QueryAddEntityXOB);
31 else
32 GetGame().GetWorld().QueryEntitiesBySphere(centerEntity.GetOrigin(), m_fRadius, QueryAddEntity);
33
34
35 return new SCR_ScenarioFrameworkParam<IEntity>(m_Entity);
36 }
37
38 //------------------------------------------------------------------------------------------------
39 bool QueryAddEntity(notnull IEntity entity)
40 {
41 if (entity.GetPrefabData().GetPrefabName() == m_sSearchedEntityResourceName)
42 {
43 m_Entity = entity;
44 return false;
45 }
46
47 return true;
48 }
49
50 //------------------------------------------------------------------------------------------------
51 bool QueryAddEntityXOB(notnull IEntity entity)
52 {
53 VObject vobject = entity.GetVObject();
54 if (vobject && vobject.GetResourceName() == m_sSearchedEntityResourceName)
55 {
56 m_Entity = entity;
57 return false;
58 }
59
60 return true;
61 }
62}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external vector GetOrigin()
proto external BaseWorld GetWorld()
override SCR_ScenarioFrameworkParamBase Get()
Visual object.
Definition VObject.c:14
SCR_FieldOfViewSettings Attribute