Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SupportStationAreaMeshComponent.c
Go to the documentation of this file.
5
6class SCR_SupportStationAreaMeshComponent : SCR_BaseAreaMeshComponent
7{
8 [Attribute(desc: "Set NONE to get first found support station. Else it will find the specific support station of the same type. It will always search itself, the parent, compartments and the compartments of the parents to find the SupportStation", uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(ESupportStationType), category: "Support Station")]
9 protected ESupportStationType m_eSearchForType;
10
11 [Attribute("{6FD8A355A2011A46}Assets/Editor/VirtualArea/VirtualArea_SupportStation_Disabled.emat", desc: "Material mapped on outside and inside of the mesh when support station is disabled. Inside mapping is mirrored.", uiwidget: UIWidgets.ResourcePickerThumbnail, params: "emat", category: "Virtual Area")]
13
14 [Attribute("1", desc: "Used when mesh area is a child of the Support Station. This will make sure that the preview displayed when placing is the correct size", category: "Support Station")]
15 protected float m_fRadius;
16
17 //~ Save ref of support station after getting it
18 protected SCR_BaseSupportStationComponent m_SupportStationComponent;
19
20 //------------------------------------------------------------------------------------------------
21 override float GetRadius()
22 {
24 return m_fRadius;
25
26 //~ Get Radius of support station
27 return m_SupportStationComponent.GetRange();
28 }
29
30 //------------------------------------------------------------------------------------------------
31 //~ Get support station component from owner, parent or siblings
32 protected SCR_BaseSupportStationComponent GetSupportStation(IEntity owner)
33 {
34 if (!owner)
35 return null;
36
37 SCR_BaseSupportStationComponent supportStation = SCR_BaseSupportStationComponent.FindSupportStation(owner, m_eSearchForType, SCR_EComponentFinderQueryFlags.ENTITY | SCR_EComponentFinderQueryFlags.SLOTS | SCR_EComponentFinderQueryFlags.PARENT);
38
39 if (supportStation && supportStation.GetOwner() != owner && supportStation.GetOwner() != owner.GetParent())
40 {
41 if (m_fRadius != supportStation.GetRange())
42 Print("'SCR_SupportStationAreaMeshComponent' is on a child entity yet the m_fRadius (" + m_fRadius + ") is not equal to the support Station range (" + supportStation.GetRange() + ") make sure it is equal else the preview will not show correctly", LogLevel.ERROR);
43 }
44
45 return supportStation;
46 }
47
48 //------------------------------------------------------------------------------------------------
49 //~ Get material used for area mesh. Enabled states sets the correct mesh area
50 protected override ResourceName GetMaterial()
51 {
54 else
55 return super.GetMaterial();
56 }
57
58 //------------------------------------------------------------------------------------------------
59 //~ Regenerates mesh area if on enabled changed as material changed
60 protected void OnEnabledChanged(bool enabled)
61 {
63 }
64
65 //------------------------------------------------------------------------------------------------
66 override void EOnInit(IEntity owner)
67 {
68 if (!owner)
69 return;
70
72
73 //~ Did not find support station
75 {
76 //~ Give warning in workbench
77 #ifdef WORKBENCH
78 Print("'SCR_SupportStationAreaMeshComponent' (" + owner + ") Component must be attached to enity with SCR_BaseSupportStationComponent! BasePrefab should not have a support Station component", LogLevel.WARNING);
79 return;
80 #endif
81
82 //~ Call one frame later to make sure that Support Station component is known to system
83 GetGame().GetCallqueue().CallLater(Init, param1: owner);
84 return;
85 }
86
87 //~ Call actual init if Support Station was found
88 Init(owner);
89 }
90
91 //------------------------------------------------------------------------------------------------
92 protected void Init(IEntity owner)
93 {
95 {
97
99 {
100 Print("'SCR_SupportStationAreaMeshComponent' (" + owner + ") Component must be attached to enity with SCR_BaseSupportStationComponent! BasePrefab should not have a support Station component", LogLevel.WARNING);
101 return;
102 }
103 }
104
105 //~ Ignore if does not use range
106 if (!m_SupportStationComponent.UsesRange())
107 return;
108
109 vector offset = m_SupportStationComponent.GetOffset();
110 if (offset != vector.Zero)
111 {
112 if (m_SupportStationComponent.GetOwner() != owner)
113 {
114 vector localTransform[4];
115 owner.GetLocalTransform(localTransform);
116
117 if (localTransform[3] != offset)
118 Print("'SCR_SupportStationAreaMeshComponent' (" + owner + ") linked support station (" + typename.EnumToString(ESupportStationType, m_SupportStationComponent.GetSupportStationType()) + ") has an offset but the local position of the area mesh is: '" + localTransform[3] + "' were as the support station offset is '" + offset + "' this must be the same else the zone shows an incorrect area!", LogLevel.ERROR);
119 }
120 else
121 {
122 Print("'SCR_SupportStationAreaMeshComponent' (" + owner + ") linked support station (" + typename.EnumToString(ESupportStationType, m_SupportStationComponent.GetSupportStationType()) + ") has an offset but the support station is on the same entity as the mesh so no offset could be given. Make the mesh a child entity of the support station else the zone shows an incorrect area!", LogLevel.ERROR);
123 }
124 }
125
126 //~ Only show when enabled. If disabled it will only start showing the zone if enabled in runtime (including disabled zone)
127 if (m_SupportStationComponent.IsEnabled())
129
130 //~ Listen to when support station is enabled/disabled
131 m_SupportStationComponent.GetOnEnabledChanged().Insert(OnEnabledChanged);
132 }
133
134 //------------------------------------------------------------------------------------------------
135 override void OnDelete(IEntity owner)
136 {
137 super.OnDelete(owner);
138
140 m_SupportStationComponent.GetOnEnabledChanged().Remove(OnEnabledChanged);
141 }
142}
override void Init()
ESupportStationType
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
ResourceName GetMaterial()
Get material used for area mesh.
void GenerateAreaMesh()
Generate area mesh based on its settings.
SCR_EComponentFinderQueryFlags
Used for component finding to know where it can search to get the given component.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
SCR_BaseSupportStationComponent m_SupportStationComponent
ResourceName m_sDisabledMaterial
void OnEnabledChanged(bool enabled)
SCR_BaseSupportStationComponent GetSupportStation(IEntity owner)
proto external IEntity GetParent()
proto external void GetLocalTransform(out vector mat[])
See IEntity::GetTransform.
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
Tuple param1
proto int Init(T init[])