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_DataCollectorCommunicationComponent.c
Go to the documentation of this file.
1
[
EntityEditorProps
(
category
:
"GameScripted/DataCollection/"
, description:
"Component used to send data to specific clients."
)]
2
class
SCR_DataCollectorCommunicationComponentClass
:
ScriptComponentClass
3
{
4
}
5
6
class
SCR_DataCollectorCommunicationComponent :
ScriptComponent
7
{
8
protected
ref
ScriptInvoker
m_OnDataReceived
;
9
10
//------------------------------------------------------------------------------------------------
11
notnull
ScriptInvoker
GetOnDataReceived
()
12
{
13
if
(!
m_OnDataReceived
)
14
m_OnDataReceived
=
new
ScriptInvoker
();
15
16
return
m_OnDataReceived
;
17
}
18
19
//------------------------------------------------------------------------------------------------
25
void
SendData
(notnull
SCR_PlayerData
playerData, notnull array<FactionKey> factionKeys, notnull array<float> values,
int
valuesSize)
26
{
27
Rpc
(
Rpc_DoSendData
, playerData.GetStats(), playerData.GetPreviousStats(), factionKeys, values, valuesSize);
28
}
29
30
//------------------------------------------------------------------------------------------------
37
[
RplRpc
(
RplChannel
.Reliable,
RplRcver
.Owner)]
38
void
Rpc_DoSendData
(notnull array<float> stats, notnull array<float> previousStats, notnull array<FactionKey> factionKeys, notnull array<float> values,
int
valuesSize)
39
{
40
foreach
(
float
stat : stats)
41
{
42
Print
(stat,
LogLevel
.DEBUG);
43
}
44
45
foreach
(
float
stat : previousStats)
46
{
47
Print
(stat,
LogLevel
.DEBUG);
48
}
49
50
BaseGameMode gameMode =
GetGame
().GetGameMode();
51
if
(!gameMode)
52
return
;
53
54
SCR_DataCollectorComponent dataCollector =
GetGame
().GetDataCollector();
55
if
(!dataCollector)
56
return
;
57
58
for
(
int
i = 0, factionsCount = factionKeys.Count(); i < factionsCount; i++)
59
{
60
array<float> valuesForFaction = {};
61
for
(
int
j = 0; j < valuesSize; j++)
62
{
63
valuesForFaction.Insert(values[i * valuesSize + j]);
64
}
65
66
dataCollector.AddStatsToFaction(factionKeys[i], valuesForFaction);
67
}
68
69
SCR_PlayerData
playerData = dataCollector.
GetPlayerData
(0,
true
,
false
);
// Use 0 as ID for local player, as this is always on the client
70
playerData.
SetStats
(stats);
71
playerData.
SetPreviousStats
(previousStats);
72
73
if
(
m_OnDataReceived
)
74
m_OnDataReceived
.Invoke(playerData);
75
}
76
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
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
SendData
void SendData(notnull SCR_PlayerData playerData, notnull array< FactionKey > factionKeys, notnull array< float > values, int valuesSize)
Definition
SCR_DataCollectorCommunicationComponent.c:25
Rpc_DoSendData
void Rpc_DoSendData(notnull array< float > stats, notnull array< float > previousStats, notnull array< FactionKey > factionKeys, notnull array< float > values, int valuesSize)
Definition
SCR_DataCollectorCommunicationComponent.c:38
GetOnDataReceived
notnull ScriptInvoker GetOnDataReceived()
Definition
SCR_DataCollectorCommunicationComponent.c:11
m_OnDataReceived
SCR_DataCollectorCommunicationComponentClass m_OnDataReceived
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
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)
SCR_DataCollectorCommunicationComponentClass
Definition
SCR_DataCollectorCommunicationComponent.c:3
SCR_PlayerData
Definition
SCR_PlayerData.c:3
SCR_PlayerData::SetStats
void SetStats(array< float > stats)
Definition
SCR_PlayerData.c:185
SCR_PlayerData::SetPreviousStats
void SetPreviousStats(array< float > previousStats)
Definition
SCR_PlayerData.c:171
SCR_PlayerData::GetPlayerData
static SCR_PlayerData GetPlayerData(int playerID)
Definition
SCR_PlayerData.c:131
ScriptComponentClass
Definition
ScriptComponentClass.c:8
ScriptComponent
Definition
ScriptComponent.c:24
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
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
ScriptInvoker
ScriptInvokerBase< func > ScriptInvoker
Definition
tools.c:134
scripts
Game
DataCollection
SCR_DataCollectorCommunicationComponent.c
Generated by
1.17.0