Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ServicePointComponent.c
Go to the documentation of this file.
4
5class SCR_ServicePointComponent : SCR_MilitaryBaseLogicComponent
6{
7 [Attribute(SCR_EServicePointType.SUPPLY_DEPOT.ToString(), uiwidget: UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(SCR_EServicePointType))]
9
10 [Attribute(defvalue: "0", uiwidget: UIWidgets.SearchComboBox, desc: "Type", enums: ParamEnumArray.FromEnum(EEditableEntityLabel))]
12
13 [Attribute("", UIWidgets.ResourceNamePicker, "Prefab of entity which will hold the UI data in case this entity gets streamed out.", "et")]
15
16 // This var will later represent a service status - functional, broken or any other...
17 [RplProp(onRplName: "ServiceStateChanged")]
18 protected SCR_EServicePointStatus m_eServiceState = SCR_EServicePointStatus.OFFLINE;
19
21 protected static bool s_bSpawnAsOffline;
25 protected SCR_ServicePointDelegateComponent m_Delegate;
26
27 //------------------------------------------------------------------------------------------------
30 {
32 return null;
33
34 Faction faction = m_FactionControl.GetAffiliatedFaction();
35 if (!faction)
36 faction = m_FactionControl.GetDefaultAffiliatedFaction();
37
38 return faction;
39 }
40
41 //------------------------------------------------------------------------------------------------
47
48 //------------------------------------------------------------------------------------------------
57
58 //------------------------------------------------------------------------------------------------
67
68 //------------------------------------------------------------------------------------------------
77
78 //------------------------------------------------------------------------------------------------
81 {
82 return m_eType;
83 }
84
85 //------------------------------------------------------------------------------------------------
91
92 //------------------------------------------------------------------------------------------------
94 SCR_EServicePointStatus GetServiceState()
95 {
96 return m_eServiceState;
97 }
98
99 //------------------------------------------------------------------------------------------------
101 void SetServiceState(SCR_EServicePointStatus state)
102 {
103 m_eServiceState = state;
105 m_OnServiceStateChanged.Invoke(state, this);
106
107 Replication.BumpMe();
108 }
109
110 //------------------------------------------------------------------------------------------------
117
118 //------------------------------------------------------------------------------------------------
120 void SetDelegate(notnull SCR_ServicePointDelegateComponent delegate)
121 {
122 m_Delegate = delegate;
123 }
124
125 //------------------------------------------------------------------------------------------------
126 override void OnBaseRegistered(notnull SCR_MilitaryBaseComponent base)
127 {
128 super.OnBaseRegistered(base);
129
131 m_OnBaseRegistered.Invoke(this, base);
132 }
133
134 //------------------------------------------------------------------------------------------------
135 override void OnBaseUnregistered(notnull SCR_MilitaryBaseComponent base)
136 {
138 m_OnServiceStateChanged.Invoke(SCR_EServicePointStatus.DELETED, this);
139
141 m_OnBaseUnregistered.Invoke(this, base);
142 }
143
144 //------------------------------------------------------------------------------------------------
145 protected void OnFactionChanged(FactionAffiliationComponent owner, Faction previousFaction, Faction faction);
146
147 //------------------------------------------------------------------------------------------------
150 {
152 if (!baseManager)
153 return;
154
155 baseManager.RegisterLogicComponent(this);
156
158 {
159 Faction faction = m_FactionControl.GetAffiliatedFaction();
160 if (!faction)
161 faction = m_FactionControl.GetDefaultAffiliatedFaction();
162
163 OnFactionChanged(null, null, faction);
164 m_FactionControl.GetOnFactionChanged().Insert(OnFactionChanged);
165 }
166 }
167
168 //------------------------------------------------------------------------------------------------
170 static void SpawnAsOffline(bool val)
171 {
172 s_bSpawnAsOffline = val;
173 }
174
175 //------------------------------------------------------------------------------------------------
178 {
179 SetServiceState(SCR_EServicePointStatus.ONLINE);
180 }
181
182 //------------------------------------------------------------------------------------------------
183 override void OnPostInit(IEntity owner)
184 {
186
187 super.OnPostInit(owner);
188
189 SCR_EditorLinkComponent linkComponent = SCR_EditorLinkComponent.Cast(SCR_EntityHelper.GetMainParent(GetOwner(), true).FindComponent(SCR_EditorLinkComponent));
190 if (linkComponent)
191 linkComponent.GetOnLinkedEntitiesSpawned().Insert(RegisterService);
192 else
194
195 if (s_bSpawnAsOffline && linkComponent)
196 {
197 linkComponent.GetOnLinkedEntitiesSpawned().Insert(SetServiceOnline);
198 return;
199 }
200
201 SetServiceState(SCR_EServicePointStatus.ONLINE);
202 }
203
204 //------------------------------------------------------------------------------------------------
205 override void OnDelete(IEntity owner)
206 {
207 super.OnDelete(owner);
208
209 if (m_Delegate)
210 RplComponent.DeleteRplEntity(m_Delegate.GetOwner(), false);
211 }
212}
213
227
228enum SCR_EServicePointStatus
229{
234 DELETED
235}
EEditableEntityLabel
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
void OnFactionChanged(Faction faction)
override EGadgetType GetType()
SCR_ECampaignBaseType m_eType
SCR_CampaignFaction GetFaction()
override void OnBaseRegistered(notnull SCR_MilitaryBaseComponent base)
@ DELETED
Character was deleted.
Get all prefabs that have the spawner the given labels and are valid in the editor mode param catalogType Type to catalog to get prefabs from param editorMode Editor mode to get valid entries from param faction Faction(Optional)
void OnBaseUnregistered(notnull SCR_MilitaryBaseComponent base)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
enum SCR_EServicePointType OFFLINE
SCR_EServicePointStatus m_eServiceState
enum SCR_EServicePointType BROKEN
SCR_ServicePointDelegateComponent m_Delegate
ref ScriptInvoker m_OnServiceStateChanged
enum SCR_EServicePointType UNDER_CONSTRUCTION
ScriptInvoker GetOnServiceStateChanged()
void SetDelegate(notnull SCR_ServicePointDelegateComponent delegate)
EEditableEntityLabel m_eBuildingLabel
ScriptInvoker< SCR_ServicePointComponent, SCR_MilitaryBaseComponent > GetOnBaseRegistered()
ref ScriptInvoker< SCR_ServicePointComponent, SCR_MilitaryBaseComponent > m_OnBaseUnregistered
ScriptInvoker< SCR_ServicePointComponent, SCR_MilitaryBaseComponent > GetOnBaseUnregistered()
SCR_FactionAffiliationComponent m_FactionControl
EEditableEntityLabel GetLabel()
enum SCR_EServicePointType ONLINE
void SetServiceOnline()
Switch service to online status.
void RegisterService()
ref ScriptInvoker< SCR_ServicePointComponent, SCR_MilitaryBaseComponent > m_OnBaseRegistered
void ServiceStateChanged()
Called from RplProp event.
ResourceName GetDelegatePrefab()
SCR_EServicePointStatus GetServiceState()
ResourceName m_sDelegatePrefab
void SetServiceState(string serviceId, EServiceStatus status)
proto external Managed FindComponent(typename typeName)
Main replication API.
Definition Replication.c:14
static IEntity GetMainParent(IEntity entity, bool self=false)
static SCR_MilitaryBaseSystem GetInstance()
void RegisterLogicComponent(notnull SCR_MilitaryBaseLogicComponent component)
IEntity GetOwner()
Owner entity of the fuel tank.
SCR_FieldOfViewSettings Attribute
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134