Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
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"
)]
2
class
SCR_CampaignServiceCompositionComponentClass
:
ScriptComponentClass
3
{
4
}
5
6
class
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
16
protected
SCR_SiteSlotEntity
m_Slot
;
17
protected
static
const
int
SLOT_SEARCH_DISTANCE = 5;
18
protected
IEntity
m_Owner
;
19
protected
SCR_CampaignMilitaryBaseComponent
m_Base
;
20
protected
EEditableEntityLabel
m_CompositionType
;
21
protected
SCR_ServicePointComponent
m_Service
;
22
23
ref
ScriptInvoker
Event_EOnServiceDisabled
=
new
ScriptInvoker
();
24
ref
ScriptInvoker
Event_EOnServiceRepaired
=
new
ScriptInvoker
();
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
46
SCR_ServicePointMapDescriptorComponent
desc
=
SCR_ServicePointMapDescriptorComponent
.Cast(
m_Owner
.FindComponent(
SCR_ServicePointMapDescriptorComponent
));
47
48
// Check if the Service was disabled.
49
if
(isOperableBeforeChange && !
IsServiceOperable
())
50
{
51
if
(
desc
)
52
desc
.SetServiceMarkerActive(UNAVAILABLE);
53
54
Event_EOnServiceDisabled
.Invoke();
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
63
Event_EOnServiceRepaired
.Invoke();
64
}
65
}
66
67
//------------------------------------------------------------------------------------------------
69
void
SetCompositionType
(
EEditableEntityLabel
type
)
70
{
71
m_CompositionType
=
type
;
72
}
73
74
//------------------------------------------------------------------------------------------------
76
void
SetService
(SCR_ServicePointComponent service)
77
{
78
m_Service
= service;
79
}
80
81
//------------------------------------------------------------------------------------------------
83
EEditableEntityLabel
GetCompositionType
()
84
{
85
return
m_CompositionType
;
86
}
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
//------------------------------------------------------------------------------------------------
109
bool
IsServiceOperable
()
110
{
111
return
m_iServiceOperability
>
m_iServiceUnavailable
;
112
}
113
}
EEditableEntityLabel
EEditableEntityLabel
Definition
EEditableEntityLabel.c:2
Event_EOnServiceRepaired
ref ScriptInvoker Event_EOnServiceRepaired
Definition
SCR_CampaignServiceCompositionComponent.c:24
m_iServiceOperability
int m_iServiceOperability
Definition
SCR_CampaignServiceCompositionComponent.c:10
m_Service
SCR_ServicePointComponent m_Service
Definition
SCR_CampaignServiceCompositionComponent.c:21
IsServiceOperable
bool IsServiceOperable()
Definition
SCR_CampaignServiceCompositionComponent.c:109
GetNearestSlot
bool GetNearestSlot(IEntity ent)
Definition
SCR_CampaignServiceCompositionComponent.c:97
m_iServiceUnavailable
int m_iServiceUnavailable
Service operability limit.
Definition
SCR_CampaignServiceCompositionComponent.c:14
SetCompositionType
void SetCompositionType(EEditableEntityLabel type)
Definition
SCR_CampaignServiceCompositionComponent.c:69
m_Owner
IEntity m_Owner
Definition
SCR_CampaignServiceCompositionComponent.c:18
Event_EOnServiceDisabled
ref ScriptInvoker Event_EOnServiceDisabled
Definition
SCR_CampaignServiceCompositionComponent.c:23
GetCompositionType
EEditableEntityLabel GetCompositionType()
Definition
SCR_CampaignServiceCompositionComponent.c:83
ChangeOperability
void ChangeOperability(int operability)
Definition
SCR_CampaignServiceCompositionComponent.c:38
m_CompositionType
EEditableEntityLabel m_CompositionType
Definition
SCR_CampaignServiceCompositionComponent.c:20
m_Slot
SCR_SiteSlotEntity m_Slot
Definition
SCR_CampaignServiceCompositionComponent.c:16
SetService
void SetService(SCR_ServicePointComponent service)
Definition
SCR_CampaignServiceCompositionComponent.c:76
GetService
SCR_ServicePointComponent GetService()
Definition
SCR_CampaignServiceCompositionComponent.c:90
EntityEditorProps
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
Definition
SCR_CompassComponent.c:10
type
EDamageType type
Definition
SCR_DestructibleTreeV2.c:32
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
SCR_ServicePointMapDescriptorComponent
void SCR_ServicePointMapDescriptorComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_ServicePointMapDescriptorComponent.c:198
m_Base
SCR_CampaignMilitaryBaseComponent m_Base
Definition
SCR_SuppliesTransferWaypoint.c:64
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
IEntity
Definition
IEntity.c:13
SCR_CampaignMilitaryBaseComponent
Definition
SCR_CampaignMilitaryBaseComponent.c:38
SCR_CampaignServiceCompositionComponentClass
Definition
SCR_CampaignServiceCompositionComponent.c:3
SCR_SiteSlotEntity
Definition
SCR_SiteSlotEntity.c:27
ScriptComponentClass
Definition
ScriptComponentClass.c:8
ScriptComponent
Definition
ScriptComponent.c:24
UIWidgets
Definition
attributes.c:40
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
OnPostInit
@ OnPostInit
Definition
SndComponentCallbacks.c:15
ScriptInvoker
ScriptInvokerBase< func > ScriptInvoker
Definition
tools.c:134
scripts
Game
Campaign
SCR_CampaignServiceCompositionComponent.c
Generated by
1.17.0