25 VoNComponent m_VoNComponent;
26 FactionAffiliationComponent m_FactionComp;
47 m_VoNComponent = VoNComponent.Cast(entity.FindComponent(VoNComponent));
49 m_FactionComp = FactionAffiliationComponent.Cast(entity.FindComponent(FactionAffiliationComponent));
56 AddDebugMessage(
string.Format(
"AddRequest: %1", request.GetDebugString()));
63 AddDebugMessage(
" Ignored because CommsHandler is muted");
84 int newPriority = request.m_iPriority;
91 if (newPriority > priority)
109 AddDebugMessage(
string.Format(
" Added to queue at: %1, new queue size: %2", idInsertAt,
m_aRequestQueue.Count()));
123 if (m_Agent.GetLOD() != 0 || !m_Agent.GetControlComponent().IsAIActivated())
131 AIGroup myGroup = m_Agent.GetParentGroup();
134 if ((!myGroup || myGroup.GetAgentsCount() <= 1) &&
135 !request.m_bTransmitIfNoReceivers)
137 if (!request.m_bTransmitIfPassenger)
140 if (
char &&
char.IsInVehicle())
142 CompartmentAccessComponent compAcc =
char.GetCompartmentAccessComponent();
151 if (scrAiGroup && scrAiGroup.
IsSlave() && scrAiGroup.GetLeaderAgent() == m_Agent)
161 AddDebugMessage(
string.Format(
"SetMuted: %1", mute));
193 AddDebugMessage(
string.Format(
"SetSuspended: %1", suspended));
248 float currentTime_ms =
GetGame().GetWorld().GetWorldTime();
319 AddDebugMessage(
"Reset");
333 float currentTime_ms =
GetGame().GetWorld().GetWorldTime();
338 if (currentTime_ms - thisRequest.m_fCreatedTimestamp_ms < thisRequest.m_fTimeout_ms)
340 request = thisRequest;
388 if (request.m_bTransmitIfChannelBusy)
408 array<IEntity> entities = {};
412 Print(
"SCR_AICommsHandler: TagManager is not present in the world, AI comms might behave incorrect",
LogLevel.ERROR);
420 myFaction = m_FactionComp.GetAffiliatedFaction();
421 foreach (
IEntity ent : entities)
423 SCR_ChimeraCharacter characterEnt = SCR_ChimeraCharacter.Cast(ent);
428 if (characterEnt.m_pFactionComponent && (characterEnt.m_pFactionComponent.GetAffiliatedFaction() != myFaction))
431 CharacterControllerComponent characterController = characterEnt.GetCharacterController();
432 AIControlComponent aiControlComponent = characterController.GetAIControlComponent();
434 if (!aiControlComponent)
437 AIAgent agent = aiControlComponent.GetControlAIAgent();
442 SCR_AIUtilityComponent utility = chimeraAgent.m_UtilityComponent;
474 AddDebugMessage(
string.Format(
"TransmitRequest: %1", rq.GetDebugString()));
478 bool txSuccess = SCR_AISoundHandling.SetSignalsAndTransmit(rq, m_Entity, m_VoNComponent, m_SignalsManagerComponent);
482 string str =
string.Format(
"SCR_AISoundHandling.SetSignalsAndTransmit failed for request: %1", rq.GetDebugString());
484 Print(
string.Format(
"SCR_AICommsHandler: %1", str),
LogLevel.ERROR);
487 AddDebugMessage(str,
LogLevel.ERROR);
496 AddDebugMessage(
string.Format(
"FailRequest: %1", rq.GetDebugString()));
505 AddDebugMessage(
string.Format(
"CompleteRequest: %1", rq.GetDebugString()));
515 AddDebugMessage(
"ClearAndFailAllRequests");
534 vector ownerPos = m_Entity.GetOrigin();
536 int color =
Color.GRAY;
538 string str =
string.Format(
"Queue: %1, State: %2",
545 color =
Color.MAGENTA;
547 color =
Color.ORANGE;
553 textPos[0], textPos[1], textPos[2], color: color, bgColor:
Color.BLACK,
566 protected void AddDebugMessage(
string str,
LogLevel logLevel =
LogLevel.NORMAL)
570 SCR_AIInfoBaseComponent infoComp = SCR_AIInfoBaseComponent.Cast(
m_Agent.FindComponent(SCR_AIInfoBaseComponent));
ArmaReforgerScripted GetGame()
SCR_ChimeraAIAgent m_Agent
SCR_EAICommunicationState
ScriptInvokerBase< SCR_AICommsStateChangedDelegate > SCR_AIOnCommsStateChangedInvoker
func SCR_AICommsStateChangedDelegate
SCR_AIGroupInfoComponentClass IDLE
Group has no waypoints and does not engage an enemy.
void SCR_AITalkRequest(ECommunicationType type, IEntity entity, vector pos, int enumSignal, bool transmitIfNoReceivers, bool transmitIfPassenger, SCR_EAITalkRequestPreset preset)
void ~SCR_AICommsHandler()
void TransmitRequest(SCR_AITalkRequest rq)
void SwitchToState(SCR_EAICommunicationState newState)
void CompleteRequest(SCR_AITalkRequest rq)
void ClearAndFailAllRequests()
Clears and fails all requests.
void SetSuspended(bool suspended)
void TryTransmitAndSwitchState()
Tries to transmit, if succeedes, switches to ACTIVE state, otherwise to WAITING state.
void Reset()
Fails and clears all requests, resets to initial state.
ref ref SCR_AITalkRequest m_CurrentRequest
void AddRequest(SCR_AITalkRequest request)
const float SAMPLE_LENGTH_MS
bool CanBypass(SCR_AITalkRequest request=null)
void SCR_AICommsHandler(notnull IEntity entity, notnull AIAgent agent)
ref array< ref SCR_AITalkRequest > m_aRequestQueue
bool CanTransmit(SCR_AITalkRequest request)
Checks if we can transmit with relation to channel state.
void EOnDiag(float timeSlice)
void FailRequest(SCR_AITalkRequest rq)
void Update(float timeSlice)
SCR_AITalkRequest FindValidRequest()
const float NEARBY_SPEAKER_CHECK_RANGE
SCR_EAICommunicationState m_eState
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
proto native vector Vector(float x, float y, float z)