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_CampaignServiceEntityComponent.c
Go to the documentation of this file.
1
#define ENABLE_BASE_DESTRUCTION
2
[
EntityEditorProps
(
category
:
"GameScripted/Campaign"
, description:
"This component handles a destruction of entity in composition and how it affects composition operability."
)]
3
class
SCR_CampaignServiceEntityComponentClass
:
ScriptComponentClass
4
{
5
}
6
7
class
SCR_CampaignServiceEntityComponent :
ScriptComponent
8
{
10
[
Attribute
(
"50"
,
UIWidgets
.Slider,
"How much of service operability this entity represents"
,
"0 100 1"
)]
11
protected
int
m_iEntityOperabilityPart;
12
14
[
Attribute
(
"50"
,
UIWidgets
.Slider,
"Cost of repair"
,
"0 1000 1"
)]
15
protected
int
m_iRepairCost
;
16
17
protected
SCR_CampaignServiceCompositionComponent
m_ServiceCompositionComp
;
18
protected
SCR_DestructionMultiPhaseComponent
m_DestMultiComp
;
19
protected
bool
m_bCanEvaluateHit
=
true
;
20
protected
RplComponent
m_RplComponent
;
21
private
static
const
int
INITIAL_STATE = 0;
22
23
//------------------------------------------------------------------------------------------------
24
override
void
OnPostInit
(
IEntity
owner)
25
{
26
SetEventMask
(owner,
EntityEvent
.INIT);
27
}
28
29
//------------------------------------------------------------------------------------------------
30
override
void
EOnInit
(
IEntity
owner)
31
{
32
m_DestMultiComp
= SCR_DestructionMultiPhaseComponent.Cast(owner.
FindComponent
(SCR_DestructionMultiPhaseComponent));
33
if
(!
m_DestMultiComp
)
34
return
;
35
#ifdef ENABLE_BASE_DESTRUCTION
36
m_DestMultiComp
.GetOnDamageInvoker().Insert(EvaluateHit);
37
#endif
38
39
IEntity
parentComp = SCR_EntityHelper.GetMainParent(owner);
40
if
(!parentComp)
41
return
;
42
43
m_ServiceCompositionComp
= SCR_CampaignServiceCompositionComponent.Cast(parentComp.
FindComponent
(SCR_CampaignServiceCompositionComponent));
44
m_RplComponent
= RplComponent.Cast(parentComp.
FindComponent
(RplComponent));
45
ClearEventMask
(owner,
EntityEvent
.INIT);
46
}
47
48
//------------------------------------------------------------------------------------------------
50
void
EvaluateHit()
51
{
52
if
(
IsProxy
())
53
return
;
54
55
if
(!
m_bCanEvaluateHit
|| !
m_DestMultiComp
|| !
m_ServiceCompositionComp
)
56
return
;
57
58
#ifdef ENABLE_BASE_DESTRUCTION
59
if
(
m_DestMultiComp
.GetDestroyed())
60
{
61
SetHitEvaluation(
false
);
62
m_ServiceCompositionComp
.ChangeOperability(m_iEntityOperabilityPart);
63
m_DestMultiComp
.ReplicateDestructibleState();
64
}
65
#endif
66
}
67
68
#ifdef ENABLE_BASE_DESTRUCTION
69
//------------------------------------------------------------------------------------------------
71
void
RepairEntity()
72
{
73
if
(!
m_DestMultiComp
|| !
m_ServiceCompositionComp
)
74
return
;
75
76
m_DestMultiComp
.GoToDamagePhase(INITIAL_STATE,
false
);
77
m_DestMultiComp
.ReplicateDestructibleState(
true
);
78
m_ServiceCompositionComp
.ChangeOperability(-m_iEntityOperabilityPart);
79
SetHitEvaluation(
true
);
80
}
81
#endif
82
83
//------------------------------------------------------------------------------------------------
85
bool
IsProxy
()
86
{
87
return
(
m_RplComponent
&&
m_RplComponent
.IsProxy());
88
}
89
90
//------------------------------------------------------------------------------------------------
92
int
GetRepairCost()
93
{
94
return
m_iRepairCost
;
95
}
96
97
//------------------------------------------------------------------------------------------------
100
void
SetHitEvaluation(
bool
canEvaluate)
101
{
102
m_bCanEvaluateHit
= canEvaluate;
103
}
104
}
m_RplComponent
RplComponent m_RplComponent
Definition
SCR_CampaignBuildingManagerComponent.c:64
m_iRepairCost
int m_iRepairCost
Cost of repair.
Definition
SCR_CampaignServiceEntityComponent.c:15
m_DestMultiComp
SCR_DestructionMultiPhaseComponent m_DestMultiComp
Definition
SCR_CampaignServiceEntityComponent.c:18
m_ServiceCompositionComp
SCR_CampaignServiceCompositionComponent m_ServiceCompositionComp
Definition
SCR_CampaignServiceEntityComponent.c:17
m_bCanEvaluateHit
bool m_bCanEvaluateHit
Definition
SCR_CampaignServiceEntityComponent.c:19
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
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
IEntity
enum EVehicleType IEntity
GenericComponent::ClearEventMask
proto external int ClearEventMask(notnull IEntity owner, int mask)
GenericComponent::SetEventMask
proto external int SetEventMask(notnull IEntity owner, int mask)
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
SCR_CampaignServiceEntityComponentClass
Definition
SCR_CampaignServiceEntityComponent.c:4
ScriptComponentClass
Definition
ScriptComponentClass.c:8
ScriptComponent
Definition
ScriptComponent.c:24
ScriptComponent::EOnInit
void EOnInit(IEntity owner)
UIWidgets
Definition
attributes.c:40
IsProxy
bool IsProxy()
Definition
SCR_CampaignBuildingCompositionComponent.c:509
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EntityEvent
EntityEvent
Various entity events.
Definition
EntityEvent.c:14
OnPostInit
@ OnPostInit
Definition
SndComponentCallbacks.c:15
scripts
Game
Campaign
SCR_CampaignServiceEntityComponent.c
Generated by
1.17.0