Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AITalkRequest.c
Go to the documentation of this file.
2 {
3  IDLE, // Waiting in queue or waiting for free channel
4  TRANSMITTING, // Currently transmitting
5  COMPLETED, // Was transmitted
6  FAILED // Failed to transmit
7 }
8 
9 enum SCR_EAITalkRequestPreset
10 {
11  IRRELEVANT_IMMEDIATE, // Small priority, tiny timeout. For almost irrelevant phrases, which become irrelevant in a second.
12  IRRELEVANT, // Small priority, small timeout. For almost irrelevant phrases.
13  MEDIUM, // Medium priority, medium timeout.
14  MANDATORY, // Highest priority, infinite timeout. For phrases related to orders and similar.
15  IMMEDIATE // Same as MANDATORY, but also ignores channel state
16 }
17 
18 class SCR_AITalkRequest : Managed
19 {
20  // Properties from SCR_AISoundHandlingParams
22  IEntity m_Entity;
23  vector m_vPosition;
25 
26  float m_fCreatedTimestamp_ms; // Time when it was added
27  float m_fTimeout_ms; // Request is discarded if we were not able to start saying this during this interval
28  int m_iPriority; // Priority of request, higher priority gets processed sooner
29  bool m_bTransmitIfChannelBusy; // If true, we will not care to wait for channel to be free and transmit over others
30  bool m_bTransmitIfNoReceivers; // If true, will transmit even if we know noone's listening
31  bool m_bTransmitIfPassenger; // If true, will transmit if inside vehicle as passenger (gunner is not affected)
32 
33  SCR_EAITalkRequestState m_eState; // READ ONLY - CommsHandler sets this when it processes the request. This can be read to know the outcome of request.
34 
35  //-------------------------------------------------------------------------------------
36  // Some parameters are initialized in constructor, others from InitFromPreset
37  void SCR_AITalkRequest(ECommunicationType type, IEntity entity, vector pos, int enumSignal, bool transmitIfNoReceivers, bool transmitIfPassenger, SCR_EAITalkRequestPreset preset)
38  {
39  m_fCreatedTimestamp_ms = GetGame().GetWorld().GetWorldTime();
40 
41  m_eCommType = type;
42  m_Entity = entity;
43  m_vPosition = pos;
44  m_EnumSignal = enumSignal;
45  m_bTransmitIfNoReceivers = transmitIfNoReceivers;
46  m_bTransmitIfPassenger = transmitIfPassenger;
47 
48  InitFromPreset(preset);
49  }
50 
51  //-------------------------------------------------------------------------------------
53  void InitFromPreset(SCR_EAITalkRequestPreset preset)
54  {
55  int prio;
56  float timeout;
57  bool transmitIfBusy = false;
58  switch (preset)
59  {
60  case SCR_EAITalkRequestPreset.IRRELEVANT_IMMEDIATE:
61  {
62  prio = 5;
63  timeout = 500.0;
64  break;
65  }
66 
67  case SCR_EAITalkRequestPreset.IRRELEVANT:
68  {
69  prio = 10;
70  timeout = 4000.0;
71  break;
72  }
73 
74  case SCR_EAITalkRequestPreset.MEDIUM:
75  {
76  prio = 20;
77  timeout = 10000.0;
78  break;
79  }
80 
81  case SCR_EAITalkRequestPreset.MANDATORY:
82  {
83  prio = 30;
84  timeout = float.MAX;
85  break;
86  }
87 
88  case SCR_EAITalkRequestPreset.IMMEDIATE:
89  {
90  prio = 40;
91  timeout = float.MAX;
92  transmitIfBusy = true;
93  break;
94  }
95  }
96 
97  m_iPriority = prio;
98  m_fTimeout_ms = timeout;
99  m_bTransmitIfChannelBusy = transmitIfBusy;
100  }
101 
102  string GetDebugString()
103  {
104  return string.Format("%1, prio: %2, timeout: %3, txIfBusy: %4, type: %5",
105  this,
106  m_iPriority,
109  typename.EnumToString(ECommunicationType, m_eCommType));
110  }
111 }
MEDIUM
enum SCR_EAITalkRequestState MEDIUM
Definition: SCR_DamageIntensityHolder.c:6
IRRELEVANT
enum SCR_EAITalkRequestState IRRELEVANT
m_bTransmitIfChannelBusy
bool m_bTransmitIfChannelBusy
Definition: SCR_AITalkRequest.c:29
m_bTransmitIfNoReceivers
bool m_bTransmitIfNoReceivers
Definition: SCR_AITalkRequest.c:30
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
m_fCreatedTimestamp_ms
float m_fCreatedTimestamp_ms
Definition: SCR_AITalkRequest.c:26
FAILED
@ FAILED
Definition: SCR_AITalkRequest.c:6
m_EnumSignal
int m_EnumSignal
Definition: SCR_AITalkRequest.c:24
m_eCommType
enum SCR_EAITalkRequestState m_eCommType
IDLE
@ IDLE
Definition: SCR_AITalkRequest.c:3
m_fTimeout_ms
float m_fTimeout_ms
Definition: SCR_AITalkRequest.c:27
SCR_AITalkRequest
void SCR_AITalkRequest(ECommunicationType type, IEntity entity, vector pos, int enumSignal, bool transmitIfNoReceivers, bool transmitIfPassenger, SCR_EAITalkRequestPreset preset)
Definition: SCR_AITalkRequest.c:37
m_Entity
IEntity m_Entity
Definition: SCR_AITalkRequest.c:22
m_bTransmitIfPassenger
bool m_bTransmitIfPassenger
Definition: SCR_AITalkRequest.c:31
MANDATORY
enum SCR_EAITalkRequestState MANDATORY
ECommunicationType
ECommunicationType
Definition: SCR_AISoundHandling.c:1
m_eState
SCR_EAITalkRequestState m_eState
Definition: SCR_AITalkRequest.c:33
TRANSMITTING
@ TRANSMITTING
Definition: SCR_AITalkRequest.c:4
COMPLETED
@ COMPLETED
Definition: SCR_AITalkRequest.c:5
InitFromPreset
void InitFromPreset(SCR_EAITalkRequestPreset preset)
Initializes timeout, priority, transmitIfBusy according to preset.
Definition: SCR_AITalkRequest.c:53
type
EDamageType type
Definition: SCR_DestructibleTreeV2.c:32
GetDebugString
string GetDebugString()
Definition: SCR_AITalkRequest.c:102
m_vPosition
vector m_vPosition
Definition: SCR_AITalkRequest.c:23
IRRELEVANT_IMMEDIATE
enum SCR_EAITalkRequestState IRRELEVANT_IMMEDIATE
m_iPriority
int m_iPriority
Definition: SCR_AITalkRequest.c:28
SCR_EAITalkRequestState
SCR_EAITalkRequestState
Definition: SCR_AITalkRequest.c:1