5 static int REFLECTOR_ID = 1;
6 static int GLASS_ID = 2;
8 static string LIGHT_OFF_GLASS =
"dz\\gear\\tools\\data\\flashlight_glass.rvmat";
9 static string LIGHT_OFF_REFLECTOR =
"dz\\weapons\\attachments\\data\\m4_flashlight.rvmat";
10 static string LIGHT_ON_GLASS =
"dz\\gear\\tools\\data\\flashlight_glass_on.rvmat";
11 static string LIGHT_ON_REFLECTOR =
"dz\\weapons\\attachments\\data\\m4_flashlight_on.rvmat";
17 InitAttachmentsSlotsToCheck(m_AttachmentSlotsCheck);
27 if ( !super.CanPutAsAttachment(parent) ) {
return false;}
29 bool req_attachment =
false;
30 bool rail_attachment_found =
false;
33 for (
int i = 0; i < parent.GetInventory().GetAttachmentSlotsCount(); i++ )
35 slot_id = parent.GetInventory().GetAttachmentSlotId(i);
36 if ( m_AttachmentSlotsCheck.Find(slot_id) != -1 )
38 req_attachment =
true;
39 attachment =
ItemBase.Cast(parent.GetInventory().FindAttachment(slot_id));
40 if ( attachment && attachment.ConfigIsExisting(
"hasRailFunctionality") && attachment.ConfigGetBool(
"hasRailFunctionality") )
41 rail_attachment_found =
true;
44 return !req_attachment || (req_attachment && rail_attachment_found);
52 m_Light.AttachOnMemoryPoint(
this,
"beamStart",
"beamEnd");
53 SetObjectMaterial(GLASS_ID, LIGHT_ON_GLASS);
54 SetObjectMaterial(REFLECTOR_ID, LIGHT_ON_REFLECTOR);
58 override void OnWork(
float consumed_energy )
66 float efficiency = battery.GetEfficiency0To1();
70 m_Light.SetIntensity( efficiency, GetCompEM().GetUpdateInterval() );
89 SetObjectMaterial(GLASS_ID, LIGHT_OFF_GLASS);
90 SetObjectMaterial(REFLECTOR_ID, LIGHT_OFF_REFLECTOR);
97 super.OnInventoryExit(player);
99 if ( GetCompEM().IsWorking() )
103 vector ori_rotate = player.GetOrientation();
104 ori_rotate = ori_rotate +
Vector(270,0,0);
105 SetOrientation(ori_rotate);
123 void InitAttachmentsSlotsToCheck(out
array<int> AttSlots)
128 AttSlots.Insert(
InventorySlots.GetSlotIdFromString(
"weaponHandguardM4"));
129 AttSlots.Insert(
InventorySlots.GetSlotIdFromString(
"weaponHandguardAK"));
130 AttSlots.Insert(
InventorySlots.GetSlotIdFromString(
"weaponHandguardMP5"));