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_WindowHitZone.c
Go to the documentation of this file.
1
class
SCR_WindowHitZone
:
SCR_HitZone
2
{
3
override
protected
void
OnDamageStateChanged
(
EDamageState
newState,
EDamageState
previousDamageState,
bool
isJIP)
4
{
5
super.OnDamageStateChanged(newState, previousDamageState, isJIP);
6
7
if
(!
GetGame
().InPlayMode())
8
return
;
9
10
// Update the associated portal when the window is destroyed / restored
11
if
(newState ==
EDamageState
.DESTROYED)
12
SetSoundPassing(
true
);
13
else
if
(newState ==
EDamageState
.UNDAMAGED)
14
SetSoundPassing(
false
);
15
}
16
17
private
void
SetSoundPassing(
bool
value)
18
{
19
HitZoneContainerComponent
container = GetHitZoneContainer();
20
if
(container == null)
21
return
;
22
23
IEntity
owner = container.GetOwner();
24
25
// Find the entity with the subscene
26
WorldSubsceneComponent
subscene;
27
IEntity
parent = owner;
28
while
(parent != null)
29
{
30
subscene =
WorldSubsceneComponent
.Cast(parent.
FindComponent
(
WorldSubsceneComponent
));
31
if
(subscene != null)
32
break
;
33
34
parent = parent.
GetParent
();
35
}
36
37
if
(subscene == null)
38
return
;
39
40
// window world position
41
vector posHZ[4];
42
owner.
GetWorldTransform
(posHZ);
43
// subscene entity world position
44
vector matWS[4];
45
parent.
GetWorldTransform
(matWS);
46
47
// Invert the transform so we get the local position of the window within the parent
48
vector matLS[4];
49
Math3D.MatrixInvMultiply4(matWS, posHZ, matLS);
50
51
// Find the portal and update the sound passing flag as necessary
52
vector mins = matLS[3] - { 0.2, 0.2, 0.2 };
53
vector maxs = matLS[3] + { 0.2, 0.2, 0.2 };
54
int
portalIdx = subscene.FindPortalByOBB(mins, maxs, matWS);
55
if
(portalIdx < 0 || portalIdx >= 0xFFFF)
56
return
;
57
58
subscene.SetPortalPassingSound(portalIdx, value);
59
}
60
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
HitZoneContainerComponent
Definition
HitZoneContainerComponent.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
IEntity::GetWorldTransform
proto external void GetWorldTransform(out vector mat[])
See IEntity::GetTransform.
IEntity::GetParent
proto external IEntity GetParent()
SCR_HitZone
Definition
SCR_HitZone.c:2
SCR_WindowHitZone
Definition
SCR_WindowHitZone.c:2
SCR_WindowHitZone::OnDamageStateChanged
void OnDamageStateChanged(EDamageState newState, EDamageState previousDamageState, bool isJIP)
Definition
SCR_WindowHitZone.c:3
WorldSubsceneComponent
Definition
WorldSubsceneComponent.c:17
EDamageState
EDamageState
Definition
EDamageState.c:13
scripts
Game
HitZone
SCR_WindowHitZone.c
Generated by
1.17.0