42 enum SCR_ECommunicationSoundEventPriority
52 class SCR_CommunicationSoundComponent : CommunicationSoundComponent
55 private static const int SUBTITLES_MAX_DISTANCE = 20;
56 static const int DEFAULT_EVENT_PRIORITY_DELAY = 100;
57 private static const string DAMAGE_TYPE_SIGNAL_NAME =
"DamageType";
58 private static const string HIT_SCREAM_INTENSITY_SIGNAL_NAME =
"HitScreamIntensity";
60 protected string m_sDelayedSoundEvent;
61 protected SCR_ECommunicationSoundEventPriority m_eDelayedSoundEventPriority;
63 protected int m_iHitScreamIntensity;
65 protected int m_iDamageTypeSignalIdx;
66 protected int m_iHitScreamIntensitySignalIdx;
68 protected static bool m_bShowSubtitles;
73 void ShowSubtitles(array<string> metadata)
75 int size = metadata.Count();
79 Print(
"Too many metadata. Metadata size = " + size.ToString(), LogLevel.ERROR);
86 for (
int i = size - 1; i >= 0; i--)
88 if (!metadata[i].IsEmpty())
103 for (
int i = 0; i < textIdx; i++)
105 if (!metadata[i].IsEmpty())
107 param[paramIndex] = metadata[i];
114 string localizedText = WidgetManager.Translate(metadata[textIdx], param[0], param[1], param[2], param[3], param[4], param[5], param[6], param[7], param[8]);
116 SCR_ChatComponent.RadioProtocolMessage(localizedText);
121 static void SetSubtitiles()
123 BaseContainer settings =
GetGame().GetGameUserSettings().GetModule(
"SCR_GameplaySettings");
125 settings.Get(
"m_bShowRadioProtocolText", m_bShowSubtitles);
134 void SetCallsignSignals(
int company,
int platoon,
int squad,
int character,
int characterRole)
149 void SoundEventHit(
bool critical,
EDamageType damageType)
152 m_iHitScreamIntensity += 1;
154 SCR_ECommunicationSoundEventPriority priority = SCR_ECommunicationSoundEventPriority.SOUND_HIT + m_iHitScreamIntensity;
155 if (priority >= SCR_ECommunicationSoundEventPriority.SOUND_DEATH)
156 priority = SCR_ECommunicationSoundEventPriority.SOUND_DEATH - 1;
158 DelayedSoundEventPriority(
SCR_SoundEvent.SOUND_HIT, priority, DEFAULT_EVENT_PRIORITY_DELAY, damageType);
167 void DelayedSoundEventPriority(
string eventName, SCR_ECommunicationSoundEventPriority priority,
int delayMS,
EDamageType damageType =
EDamageType.TRUE)
169 if (priority < m_eDelayedSoundEventPriority)
172 m_sDelayedSoundEvent = eventName;
173 m_eDelayedSoundEventPriority = priority;
174 m_eEDamageType = damageType;
176 ScriptCallQueue queue =
GetGame().GetCallqueue();
178 int remainingTime = queue.GetRemainingTime(PlayDelayedSoundEventPriority);
180 if (delayMS < remainingTime)
182 queue.Remove(PlayDelayedSoundEventPriority);
186 if (remainingTime <= 0)
187 queue.CallLater(PlayDelayedSoundEventPriority, delayMS);
193 void PlayDelayedSoundEventPriority()
203 m_sDelayedSoundEvent =
string.Empty;
204 m_eDelayedSoundEventPriority = SCR_ECommunicationSoundEventPriority.SOUND_NONE;
208 m_iHitScreamIntensity = 0;
215 void SoundEventDeath(
bool silent)
217 GetGame().GetCallqueue().Remove(DelayedSoundEventPriority);
229 if (callsignBaseComponent)
230 callsignBaseComponent.GetOnCallsignChanged().Insert(SetCallsignSignals);
251 override void OnSoundEventFinished(
string eventName, AudioHandle handle,
int priority,
bool terminated)
261 void SCR_CommunicationSoundComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
268 void ~SCR_CommunicationSoundComponent()
271 if (callsignBaseComponent)
272 callsignBaseComponent.GetOnCallsignChanged().Remove(SetCallsignSignals);