1002 {
1003 CachedEquipmentStorageQuery query = new CachedEquipmentStorageQuery();
1004
1009
1010 NVGoggles nvgAttachment;
1011 array<Entity> nvgs = player.GetCachedEquipment().GetEntitiesByCategory(query);
1012 foreach (Entity nvg : nvgs)
1013 {
1014 if (NVGoggles.CastTo(nvgAttachment, nvg))
1015 break;
1016 }
1017
1018 if (player)
1019 {
1020 if (nvgAttachment)
1021 {
1022 if (attaching)
1023 {
1024 if (nvgAttachment.m_Strap && nvgAttachment.m_IsLowered)
1025 {
1026 nvgAttachment.SetPlayer(player);
1027 player.SetNVGLowered(true);
1028
1029 if (player.IsControlledPlayer())
1030 {
1031 player.RemoveActiveNV(
NVTypes.NV_GOGGLES);
1032 player.RemoveActiveNV(
NVTypes.NV_GOGGLES_2D);
1033 player.RemoveActiveNV(
NVTypes.NV_GOGGLES_OFF);
1034
1035 player.AddActiveNV(nvgAttachment.GetCurrentNVType());
1036 }
1037 }
1038 }
1039 else if (force_disable)
1040 {
1041 nvgAttachment.SetPlayer(null);
1042 player.SetNVGLowered(false);
1043
1044 if (player.IsControlledPlayer())
1045 {
1046 player.RemoveActiveNV(
NVTypes.NV_GOGGLES);
1047 player.RemoveActiveNV(
NVTypes.NV_GOGGLES_2D);
1048 player.RemoveActiveNV(
NVTypes.NV_GOGGLES_OFF);
1049 }
1050 }
1051 else
1052 {
1053 if (nvgAttachment.m_Strap && nvgAttachment.m_IsLowered)
1054 {
1055 nvgAttachment.SetPlayer(player);
1056 player.SetNVGLowered(true);
1057
1058 if (player.IsControlledPlayer())
1059 {
1060 player.RemoveActiveNV(
NVTypes.NV_GOGGLES);
1061 player.RemoveActiveNV(
NVTypes.NV_GOGGLES_2D);
1062 player.RemoveActiveNV(
NVTypes.NV_GOGGLES_OFF);
1063
1064 player.AddActiveNV(nvgAttachment.GetCurrentNVType());
1065 }
1066 }
1067 else
1068 {
1069 player.SetNVGLowered(false);
1070 if (player.IsControlledPlayer())
1071 {
1072 player.RemoveActiveNV(
NVTypes.NV_GOGGLES);
1073 player.RemoveActiveNV(
NVTypes.NV_GOGGLES_2D);
1074 player.RemoveActiveNV(
NVTypes.NV_GOGGLES_OFF);
1075 }
1076 }
1077 }
1078 }
1079 else
1080 {
1081 player.SetNVGLowered(false);
1082
1083 if (player.IsControlledPlayer())
1084 {
1085 player.RemoveActiveNV(
NVTypes.NV_GOGGLES);
1086 player.RemoveActiveNV(
NVTypes.NV_GOGGLES_2D);
1087 player.RemoveActiveNV(
NVTypes.NV_GOGGLES_OFF);
1088 }
1089 }
1090 }
1091 }
ECachedEquipmentItemCategory
ECachedEquipmentPlacement
ECachedEquipmentItemCategory m_Category
ref TIntArray m_ParentPlacement
ECachedEquipmentPlacement m_Placement