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

◆ ProcessVoiceEvent()

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

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

3578 {
3579 #ifdef SERVER//none of this code needs to run on server, ifdef put here rather than before the method call to maintain mod compatibility
3580 return null;
3581 #endif
3583 DayZPlayerTypeVoiceSoundLookupTable table = type.GetVoiceSoundLookupTable();
3584 if (!table)
3585 return null;
3586 AbstractWave wave;
3587 GameInventory inventory = GetInventory();
3588 EntityAI mask = inventory.FindAttachment(InventorySlots.MASK);
3589 EntityAI head_gear = inventory.FindAttachment(InventorySlots.HEADGEAR);
3590
3591 string category;
3592 if (mask || head_gear)
3593 {
3594 string category_mask;
3595 string category_headgear;
3596
3597 int priority_mask;
3598 int priority_headgear;
3599
3600 if (mask)
3601 {
3602 category_mask = mask.ConfigGetString("soundVoiceType");
3603 priority_mask = mask.ConfigGetInt("soundVoicePriority");
3604 }
3605 if (head_gear)
3606 {
3607 category_headgear = head_gear.ConfigGetString("soundVoiceType");
3608 priority_headgear = head_gear.ConfigGetInt("soundVoicePriority");
3609 }
3610
3611 if (priority_headgear >= priority_mask && category_headgear != "")
3612 {
3613 category = category_headgear;
3614 }
3615 else
3616 {
3617 category = category_mask;
3618 }
3619 }
3620
3621 if (category == "")
3622 {
3623 category = "none";
3624 }
3625
3626 SoundObjectBuilder soundBuilder = table.GetSoundBuilder(pUserInt, category.Hash());
3627
3628 if (soundBuilder)
3629 {
3630 PlayerBase player = PlayerBase.Cast(this);
3631 //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
3632 int maleVoiceType = 0;
3633 int femaleVoiceType = 0;
3634 if (player.IsMale())
3635 {
3636 maleVoiceType = player.GetVoiceType();
3637 }
3638 else
3639 {
3640 femaleVoiceType = player.GetVoiceType();
3641 }
3642
3643 soundBuilder.AddVariable("male", maleVoiceType);
3644 soundBuilder.AddVariable("female", femaleVoiceType);
3645
3646 // end of weirdness
3647 SoundObject soundObject = soundBuilder.BuildSoundObject();
3648 if (soundObject != NULL)
3649 {
3650 AttenuateSoundIfNecessary(soundObject);
3651 wave = PlaySound(soundObject, soundBuilder);
3652 }
3653
3654 }
3655
3656 return wave;
3657 }
class LogManager EntityAI
void PlaySound()
Определения HungerSoundHandler.c:39
void AttenuateSoundIfNecessary(SoundObject soundObject)
Определения DayZPlayerImplement.c:3832
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().