5 const static int SOUNDS_COLLISION_COUNT = 4;
6 const static int SOUNDS_SHOCK_COUNT = 4;
7 const static string m_SoundsCollision[SOUNDS_COLLISION_COUNT] = {
"barbedFenceCollision1",
"barbedFenceCollision2",
"barbedFenceCollision3",
"barbedFenceCollision4"};
8 const static string m_SoundsShock[SOUNDS_SHOCK_COUNT] = {
"electricFenceShock1",
"electricFenceShock2",
"electricFenceShock3",
"electricFenceShock4"};
11 override void OnEnter(
Object obj )
15 if ( m_ParentBarbedWire )
20 string cfg =
"CfgVehicles BarbedWire barbedWireShockEnergyConsumption";
21 float needed_energy =
GetGame().ConfigGetFloat(cfg);
22 bool energy_consumed = m_ParentBarbedWire.GetCompEM().ConsumeEnergy(needed_energy);
25 if ( energy_consumed )
32 player.MessageImportant(
"*SCRATCH and ELECTROCUTION*" );
44 player.MessageImportant(
"*SCRATCH*" );
56 AI_unit.SetHealth(
"",
"", 0);
64 void SetParentObject(
ItemBase wire )
68 m_ParentBarbedWire = wire;
73 void SoundElectricShock()
75 int random_index =
Math.RandomInt(0, SOUNDS_SHOCK_COUNT);
76 string sound_type = m_SoundsShock[random_index];
83 int random_index =
Math.RandomInt(0, SOUNDS_COLLISION_COUNT);
84 string sound_type = m_SoundsCollision[random_index];