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

◆ UpdateNVGStatus()

void ItemBase::UpdateNVGStatus ( PlayerBase player,
bool attaching = false,
bool force_disable = false )
inlineprivate

generic detach

См. определение в файле 4_World/Entities/Core/Inherited/InventoryItem.c строка 850

851 {
852 bool hasNVGSlot;
853 for (int i = 0; i < GetInventory().GetAttachmentSlotsCount(); ++i)
854 {
855 hasNVGSlot = GetInventory().GetAttachmentSlotId(i) == InventorySlots.GetSlotIdFromString("NVG");
856 if (hasNVGSlot)
857 break;
858 }
859
860 if (player && hasNVGSlot)
861 {
862 NVGoggles nvgAttachment;
863 nvgAttachment = NVGoggles.Cast(FindAttachmentBySlotName("NVG"));
864 if (nvgAttachment)
865 {
866 if (attaching)
867 {
868 if (nvgAttachment.m_Strap && nvgAttachment.m_IsLowered)
869 {
870 nvgAttachment.SetPlayer(player);
871 player.SetNVGLowered(true);
872
873 if (player.IsControlledPlayer())
874 {
875 player.RemoveActiveNV(NVTypes.NV_GOGGLES);
876 player.RemoveActiveNV(NVTypes.NV_GOGGLES_2D);
877 player.RemoveActiveNV(NVTypes.NV_GOGGLES_OFF);
878
879 player.AddActiveNV(nvgAttachment.GetCurrentNVType());
880 }
881 }
882 }
883 else if (force_disable)
884 {
885 nvgAttachment.SetPlayer(null);
886 player.SetNVGLowered(false);
887
888 if (player.IsControlledPlayer())
889 {
890 player.RemoveActiveNV(NVTypes.NV_GOGGLES);
891 player.RemoveActiveNV(NVTypes.NV_GOGGLES_2D);
892 player.RemoveActiveNV(NVTypes.NV_GOGGLES_OFF);
893 }
894 }
895 else // common case during operational state
896 {
897 if (nvgAttachment.m_Strap && nvgAttachment.m_IsLowered)
898 {
899 nvgAttachment.SetPlayer(player);
900 player.SetNVGLowered(true);
901
902 if (player.IsControlledPlayer())
903 {
904 player.RemoveActiveNV(NVTypes.NV_GOGGLES);
905 player.RemoveActiveNV(NVTypes.NV_GOGGLES_2D);
906 player.RemoveActiveNV(NVTypes.NV_GOGGLES_OFF);
907
908 player.AddActiveNV(nvgAttachment.GetCurrentNVType());
909 }
910 }
911 else
912 {
913 player.SetNVGLowered(false);
914 if (player.IsControlledPlayer())
915 {
916 player.RemoveActiveNV(NVTypes.NV_GOGGLES);
917 player.RemoveActiveNV(NVTypes.NV_GOGGLES_2D);
918 player.RemoveActiveNV(NVTypes.NV_GOGGLES_OFF);
919 }
920 }
921 }
922 }
923 else
924 {
925 player.SetNVGLowered(false);
926
927 if (player.IsControlledPlayer())
928 {
929 player.RemoveActiveNV(NVTypes.NV_GOGGLES);
930 player.RemoveActiveNV(NVTypes.NV_GOGGLES_2D);
931 player.RemoveActiveNV(NVTypes.NV_GOGGLES_OFF);
932 }
933 }
934 }
935 }
NVTypes
Определения DayZPlayerCamera_Base.c:55

Перекрестные ссылки InventorySlots::GetSlotIdFromString().