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_SourceBaseAudioComponent.c
Go to the documentation of this file.
1
class
SCR_SourceBaseAudioComponentClass
:
ScriptComponentClass
2
{
3
}
4
5
class
SCR_SourceBaseAudioComponent :
ScriptComponent
6
{
7
[
Attribute
()]
8
protected
ref SCR_AudioSourceConfiguration
m_AudioSourceConfiguration
;
9
10
protected
SCR_CampaignSourceBaseComponent
m_SourceBaseComponent
;
11
12
//------------------------------------------------------------------------------------------------
13
override
void
OnPostInit
(
IEntity
owner)
14
{
15
super.OnPostInit(owner);
16
17
// Spawning of base building is delayed, so we also delay the assignment of source base component
18
GetGame
().GetCallqueue().CallLater(
SetSourceBaseComponent
, 1500,
false
);
19
}
20
21
//------------------------------------------------------------------------------------------------
23
protected
void
SetSourceBaseComponent
()
24
{
25
IEntity
ancestor =
GetOwner
().
GetRootParent
();
26
if
(!ancestor)
27
return
;
28
29
SCR_MilitaryBaseSystem
baseSystem =
SCR_MilitaryBaseSystem
.
GetInstance
();
30
if
(!baseSystem)
31
return
;
32
33
array<SCR_MilitaryBaseComponent> bases = {};
34
baseSystem.
GetBases
(bases);
35
36
foreach
(SCR_MilitaryBaseComponent
base
: bases)
37
{
38
SCR_CampaignSourceBaseComponent sourceBaseComponent = SCR_CampaignSourceBaseComponent.Cast(
base
);
39
if
(!sourceBaseComponent)
40
continue
;
41
42
if
(sourceBaseComponent.GetBaseBuildingComposition() != ancestor)
43
continue
;
44
45
m_SourceBaseComponent
= sourceBaseComponent;
46
break
;
47
}
48
49
if
(!
m_SourceBaseComponent
)
50
return
;
51
52
m_SourceBaseComponent
.GetOnSuppliesArrivalInvoker().Insert(
PlaySupplyArrivalSound
);
53
}
54
55
//------------------------------------------------------------------------------------------------
56
protected
void
PlaySupplyArrivalSound
()
57
{
58
RpcDo_PlaySupplyArrivalSound
();
59
Rpc
(
RpcDo_PlaySupplyArrivalSound
);
60
}
61
62
//------------------------------------------------------------------------------------------------
63
[
RplRpc
(
RplChannel
.Reliable,
RplRcver
.Broadcast)]
64
protected
void
RpcDo_PlaySupplyArrivalSound
()
65
{
66
SCR_SoundManagerModule
soundManagerModule =
SCR_SoundManagerModule
.GetInstance(
GetGame
().GetWorld());
67
if
(!soundManagerModule)
68
return
;
69
70
soundManagerModule.CreateAndPlayAudioSource(
GetOwner
(),
m_AudioSourceConfiguration
);
71
}
72
73
//------------------------------------------------------------------------------------------------
74
void
~SCR_SourceBaseAudioComponent
()
75
{
76
if
(!
m_SourceBaseComponent
)
77
return
;
78
79
m_SourceBaseComponent
.GetOnSuppliesArrivalInvoker().Remove(
PlaySupplyArrivalSound
);
80
}
81
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
base
around base
Definition
SCR_HoldCampaignMilitaryBaseTaskEntity.c:9
m_AudioSourceConfiguration
ref SCR_AudioSourceConfiguration m_AudioSourceConfiguration
Definition
SCR_ParticleContactComponent.c:40
RpcDo_PlaySupplyArrivalSound
void RpcDo_PlaySupplyArrivalSound()
Definition
SCR_SourceBaseAudioComponent.c:64
m_SourceBaseComponent
SCR_CampaignSourceBaseComponent m_SourceBaseComponent
Definition
SCR_SourceBaseAudioComponent.c:10
PlaySupplyArrivalSound
void PlaySupplyArrivalSound()
Definition
SCR_SourceBaseAudioComponent.c:56
~SCR_SourceBaseAudioComponent
void ~SCR_SourceBaseAudioComponent()
Definition
SCR_SourceBaseAudioComponent.c:74
SetSourceBaseComponent
void SetSourceBaseComponent()
Find the source base component of owner base, caches it and subscribes to GetOnSuppliesArrivalInvoker...
Definition
SCR_SourceBaseAudioComponent.c:23
GenericComponent::Rpc
void Rpc(func method, void p0=NULL, void p1=NULL, void p2=NULL, void p3=NULL, void p4=NULL, void p5=NULL, void p6=NULL, void p7=NULL)
IEntity
Definition
IEntity.c:13
IEntity::GetRootParent
proto external IEntity GetRootParent()
SCR_MilitaryBaseSystem
Definition
SCR_MilitaryBaseSystem.c:18
SCR_MilitaryBaseSystem::GetBases
int GetBases(notnull out array< SCR_MilitaryBaseComponent > bases)
Definition
SCR_MilitaryBaseSystem.c:330
SCR_MilitaryBaseSystem::GetInstance
static SCR_MilitaryBaseSystem GetInstance()
Definition
SCR_MilitaryBaseSystem.c:37
SCR_SoundManagerModule
Definition
SCR_SoundManagerModule.c:12
SCR_SourceBaseAudioComponentClass
Definition
SCR_SourceBaseAudioComponent.c:2
ScriptComponentClass
Definition
ScriptComponentClass.c:8
ScriptComponent
Definition
ScriptComponent.c:24
ScriptComponent::GetOwner
proto external GenericEntity GetOwner()
Get owner entity.
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
RplRpc
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
Definition
EnNetwork.c:95
RplRcver
RplRcver
Definition
RplRcver.c:59
RplChannel
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.
Definition
RplChannel.c:14
OnPostInit
@ OnPostInit
Definition
SndComponentCallbacks.c:15
scripts
Game
Components
Locations
SCR_SourceBaseAudioComponent.c
Generated by
1.17.0