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_TreeHitZoneV2.c
Go to the documentation of this file.
1
//---- REFACTOR NOTE START: This code will need to be refactored as current implementation is not conforming to the standards ----
2
// TODO: Data redundancy is very high, variables are private and replication handling is invalid
3
class
SCR_TreeHitZoneV2
:
SCR_HitZone
4
{
5
[
Attribute
(
"0"
,
UIWidgets
.EditBox,
"Enter the tree part number."
)]
6
private
int
m_iTreePartIndex;
7
8
#ifdef ENABLE_DESTRUCTION
9
private
SCR_TreePartV2
m_OwnerPart;
10
private
SCR_DestructibleTreeV2
m_OwnerTree;
11
private
IEntity
m_OwnerEntity
;
12
13
//------------------------------------------------------------------------------------------------
14
override
void
OnInit
(
IEntity
pOwnerEntity,
GenericComponent
pManagerComponent)
15
{
16
//Determine whether this hit zone is on a tree part or a destructible tree
17
m_OwnerPart =
SCR_TreePartV2
.Cast(pOwnerEntity);
18
if
(!m_OwnerPart)
19
{
20
m_OwnerEntity
= pOwnerEntity;
21
while
(
m_OwnerEntity
)
22
{
23
m_OwnerTree =
SCR_DestructibleTreeV2
.Cast(
m_OwnerEntity
);
24
if
(m_OwnerTree)
25
return
;
26
27
m_OwnerEntity
=
m_OwnerEntity
.GetParent();
28
}
29
}
30
}
31
32
//------------------------------------------------------------------------------------------------
33
override
void
OnDamage
(
float
damage,
34
EDamageType
type
,
35
IEntity
pHitEntity,
36
inout
vector
outMat[3],
37
IEntity
damageSource,
38
notnull
Instigator
instigator,
39
int
colliderID,
40
float
speed)
41
{
42
if
(
RplSession
.Mode() ==
RplMode
.Client)
43
return
;
44
45
//Calculate direction vector based on normal of the hit
46
vector
directionVector = -outMat[2];
47
directionVector.Normalize();
48
49
AddDamage(damage);
50
//If the damage / impulse was big enough to move the tree part
51
if
(GetDamageState() ==
EDamageState
.DESTROYED)
52
{
53
//Calculate impulse vector from direction vector and damage
54
vector
positionVector = outMat[0];
55
56
if
(
type
==
EDamageType
.EXPLOSIVE)
57
{
58
positionVector =
"0 0 0"
;
59
if
(
m_OwnerEntity
)
60
directionVector = (
m_OwnerEntity
.GetOrigin() - outMat[0]) * damage;
61
}
62
63
directionVector.Normalize();
64
vector
impulseVector = directionVector * (damage / 10);
65
if
(m_OwnerPart)
66
{
67
m_OwnerPart.SetToBreak(positionVector: positionVector, impulseVector: impulseVector, damageType:
type
);
68
return
;
69
}
70
71
if
(m_OwnerTree)
72
{
73
//m_OwnerTree.SetToDestroy(positionVector, impulseVector, m_iTreePartIndex);
74
}
75
}
76
}
77
#endif
78
}
79
//---- REFACTOR NOTE END ----
RplMode
RplMode
Mode of replication.
Definition
RplMode.c:9
m_OwnerEntity
SCR_AIUtilityComponentClass m_OwnerEntity
OnDamage
SCR_CharacterBloodHitZone OnDamage
Resilience - incapacitation or death, depending on game mode settings.
Definition
SCR_CharacterHitZone.c:382
type
EDamageType type
Definition
SCR_DestructibleTreeV2.c:32
GenericComponent
Definition
GenericComponent.c:13
IEntity
Definition
IEntity.c:13
Instigator
Definition
Instigator.c:13
RplSession
Definition
RplSession.c:8
SCR_DestructibleTreeV2
Encapsulates the functionality of a destructible tree entity in the world.
Definition
SCR_DestructibleTreeV2.c:56
SCR_HitZone
Definition
SCR_HitZone.c:2
SCR_TreeHitZoneV2
Definition
SCR_TreeHitZoneV2.c:4
SCR_TreePartV2
Definition
SCR_TreePartV2.c:9
UIWidgets
Definition
attributes.c:40
vector
Definition
vector.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EDamageType
EDamageType
Definition
EDamageType.c:13
EDamageState
EDamageState
Definition
EDamageState.c:13
OnInit
@ OnInit
Definition
SndComponentCallbacks.c:17
scripts
Game
Destruction
Tree
SCR_TreeHitZoneV2.c
Generated by
1.17.0