DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ ProcessVoiceEvent()

AbstractWave DayZPlayer::ProcessVoiceEvent ( string pEventType,
string pUserString,
int pUserInt )
inlineprotected

См. определение в файле DayZPlayerImplement.c строка 3716

3717 {
3718 #ifdef SERVER//none of this code needs to run on server, ifdef put here rather than before the method call to maintain mod compatibility
3719 return null;
3720 #endif
3722 DayZPlayerTypeVoiceSoundLookupTable table = type.GetVoiceSoundLookupTable();
3723 if (!table)
3724 return null;
3725 AbstractWave wave;
3726 GameInventory inventory = GetInventory();
3727 EntityAI mask = inventory.FindAttachment(InventorySlots.MASK);
3728 EntityAI head_gear = inventory.FindAttachment(InventorySlots.HEADGEAR);
3729
3730 string category;
3731 if (mask || head_gear)
3732 {
3733 string category_mask;
3734 string category_headgear;
3735
3736 int priority_mask;
3737 int priority_headgear;
3738
3739 if (mask)
3740 {
3741 category_mask = mask.ConfigGetString("soundVoiceType");
3742 priority_mask = mask.ConfigGetInt("soundVoicePriority");
3743 }
3744 if (head_gear)
3745 {
3746 category_headgear = head_gear.ConfigGetString("soundVoiceType");
3747 priority_headgear = head_gear.ConfigGetInt("soundVoicePriority");
3748 }
3749
3750 if (priority_headgear >= priority_mask && category_headgear != "")
3751 {
3752 category = category_headgear;
3753 }
3754 else
3755 {
3756 category = category_mask;
3757 }
3758 }
3759
3760 if (category == "")
3761 {
3762 category = "none";
3763 }
3764
3765 SoundObjectBuilder soundBuilder = table.GetSoundBuilder(pUserInt, category.Hash());
3766
3767 if (soundBuilder)
3768 {
3769 PlayerBase player = PlayerBase.Cast(this);
3770 //this code block looks super shady, but it's the only way the sounds play correctly, god knows what's going on on c++ side
3771 int maleVoiceType = 0;
3772 int femaleVoiceType = 0;
3773 if (player.IsMale())
3774 {
3775 maleVoiceType = player.GetVoiceType();
3776 }
3777 else
3778 {
3779 femaleVoiceType = player.GetVoiceType();
3780 }
3781
3782 soundBuilder.AddVariable("male", maleVoiceType);
3783 soundBuilder.AddVariable("female", femaleVoiceType);
3784
3785 // end of weirdness
3786 SoundObject soundObject = soundBuilder.BuildSoundObject();
3787 if (soundObject != NULL)
3788 {
3789 AttenuateSoundIfNecessary(soundObject);
3790 wave = PlaySound(soundObject, soundBuilder);
3791 }
3792
3793 }
3794
3795 return wave;
3796 }
class LogManager EntityAI
void PlaySound()
Определения HungerSoundHandler.c:39
void AttenuateSoundIfNecessary(SoundObject soundObject)
Определения DayZPlayerImplement.c:3976
override SoundObjectBuilder GetSoundBuilder(int eventId, int parameterHash)
Определения DayZPlayerCfgSounds.c:211
proto native EntityAI FindAttachment(int slot)
Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)
void DayZPlayerType()
Определения dayzplayer.c:512
proto native DayZPlayerType GetDayZPlayerType()
returns appropriate DayZPlayerType
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
void SoundObject(SoundParams soundParams)
void AbstractWave()
Определения Sound.c:167
proto native int Hash()
Returns hash of string.

Перекрестные ссылки AbstractWave(), AttenuateSoundIfNecessary(), DayZPlayerType(), GameInventory::FindAttachment(), GetDayZPlayerType(), DayZPlayerTypeVoiceSoundLookupTable::GetSoundBuilder(), string::Hash(), PlaySound() и SoundObjectBuilder().

Используется в OnSoundEvent().