Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CampaignServiceCompositionComponent.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/Campaign", description: "This component handles service (composition) operability")]
5
6class SCR_CampaignServiceCompositionComponent : ScriptComponent
7{
9 [Attribute("100", UIWidgets.Slider, "Initial operability of service. If this goes to (or under) Service Unavailable value, composition is not providing it's service", "0 100 1")];
10 protected int m_iServiceOperability;
11
13 [Attribute("0", UIWidgets.Slider, "Service is unavailable when operability drops to this value (or bellow)", "0 100 1")];
14 protected int m_iServiceUnavailable;
15
17 protected static const int SLOT_SEARCH_DISTANCE = 5;
18 protected IEntity m_Owner;
21 protected SCR_ServicePointComponent m_Service;
22
25
26 protected static const bool AVAILABLE = true;
27 protected static const bool UNAVAILABLE = false;
28
29 //------------------------------------------------------------------------------------------------
30 override void OnPostInit(IEntity owner)
31 {
32 m_Owner = owner;
33 }
34
35 //------------------------------------------------------------------------------------------------
38 void ChangeOperability(int operability)
39 {
40 // First check whether the Service is operable now or not.
41 bool isOperableBeforeChange = IsServiceOperable();
42
43 // Reduce operability
44 m_iServiceOperability -= operability;
45
47
48 // Check if the Service was disabled.
49 if (isOperableBeforeChange && !IsServiceOperable())
50 {
51 if (desc)
52 desc.SetServiceMarkerActive(UNAVAILABLE);
53
55 }
56
57 // Check if the Service was recovered from disabled state.
58 if (!isOperableBeforeChange && IsServiceOperable())
59 {
60 if (desc)
61 desc.SetServiceMarkerActive(AVAILABLE);
62
64 }
65 }
66
67 //------------------------------------------------------------------------------------------------
73
74 //------------------------------------------------------------------------------------------------
76 void SetService(SCR_ServicePointComponent service)
77 {
78 m_Service = service;
79 }
80
81 //------------------------------------------------------------------------------------------------
87
88 //------------------------------------------------------------------------------------------------
90 SCR_ServicePointComponent GetService()
91 {
92 return m_Service;
93 }
94
95 //------------------------------------------------------------------------------------------------
96 // Get the nearest slot to this composition
97 protected bool GetNearestSlot(IEntity ent)
98 {
99 SCR_SiteSlotEntity slotEnt = SCR_SiteSlotEntity.Cast(ent);
100 if (!slotEnt)
101 return true;
102
103 m_Slot = slotEnt;
104 return false;
105 }
106
107 //------------------------------------------------------------------------------------------------
113}
EEditableEntityLabel
ref ScriptInvoker Event_EOnServiceRepaired
SCR_ServicePointComponent m_Service
bool GetNearestSlot(IEntity ent)
int m_iServiceUnavailable
Service operability limit.
void SetCompositionType(EEditableEntityLabel type)
ref ScriptInvoker Event_EOnServiceDisabled
EEditableEntityLabel GetCompositionType()
void ChangeOperability(int operability)
EEditableEntityLabel m_CompositionType
SCR_SiteSlotEntity m_Slot
void SetService(SCR_ServicePointComponent service)
SCR_ServicePointComponent GetService()
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
EDamageType type
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void SCR_ServicePointMapDescriptorComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
SCR_CampaignMilitaryBaseComponent m_Base
SCR_FieldOfViewSettings Attribute
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134