Guest User

Untitled

a guest
Jul 11th, 2019
71
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2. * Copyright © 2019 Skirmish_, A3LUK.
  3. * All Rights Reserved.
  4. */
  5.  
  6. #include "..\..\..\UI\macros.inc"
  7.  
  8. //--- Overrides
  9. params [
  10. [ "_unit", objNull, [objNull] ],
  11. [ "_part", "", [""] ],
  12. [ "_damage", 0, [0] ],
  13. [ "_source", objNull, [objNull] ],
  14. [ "_projectile", "", [""] ],
  15. [ "_index", 0, [0] ]
  16. ];
  17.  
  18. //--- Exit if incapacitated
  19. if ( _unit getVariable [ "Incapacitated", false ] ) exitWith {};
  20. _unit setvariable [ "A3LUK_Damage", _damage, true ];
  21.  
  22. //--- Police Tazer
  23. if ( !( isNull _source ) ) then {
  24.  
  25. if ( _source != _unit ) then {
  26.  
  27. _police_tazer_weapons = getArray ( missionConfigFile >> "A3LUK_CfgInit" >> "A3LUK_InitPolice" >> "TazerWeapons" );
  28. _police_tazer_projectile = getArray ( missionConfigFile >> "A3LUK_CfgInit" >> "A3LUK_InitPolice" >> "TazerProjectile" );
  29.  
  30. if (
  31.  
  32. currentWeapon _source in _police_tazer_weapons &&
  33. _projectile in _police_tazer_projectile
  34.  
  35. ) then {
  36.  
  37. if ( [ _source ] call A3LUK_fnc_isPolice ) then {
  38.  
  39. _damage = 0;
  40.  
  41. if (
  42.  
  43. alive _unit &&
  44. { !( _unit getVariable [ "A3LUK_restrained", false ] ) } &&
  45. { !( _unit getVariable [ "onDuty", true ] ) }
  46.  
  47. ) then {
  48.  
  49. private _distance = if ( _projectile == "B_9x21_Ball" ) then { 100 } else { 35 };
  50.  
  51. if ( _unit distance _source < _distance ) then {
  52.  
  53. //--- Target in vehicle
  54. if !( isnull objectparent _unit ) then {
  55.  
  56. _unit action [ "Eject", vehicle _unit ];
  57. [ _unit, _source ] spawn A3LUK_fnc_tazed;
  58.  
  59. } else {
  60.  
  61. [ _unit, _source ] spawn A3LUK_fnc_tazed;
  62.  
  63. };
  64.  
  65. };
  66.  
  67. };
  68.  
  69. };
  70.  
  71. };
  72.  
  73. };
  74.  
  75. };
  76.  
  77. //--- VDM
  78.  
  79. private _VDM = switch true do {
  80.  
  81. case ( vehicle _source isKindOf "Ship" && _projectile == "" ): { true };
  82. case ( vehicle _source isKindOf "Air" && _projectile == "" ): { true };
  83. case ( vehicle _source isKindOf "LandVehicle" && _projectile == "" ): { true };
  84. default { false };
  85.  
  86. };
  87.  
  88. if ( _VDM ) then {
  89.  
  90. if(_source != _unit AND {alive _unit}) then {
  91.  
  92. _unit allowDamage false;
  93.  
  94. _unit spawn {
  95.  
  96. sleep 2;
  97.  
  98. _this allowDamage true;
  99.  
  100. };
  101.  
  102. };
  103.  
  104. };
  105.  
  106.  
  107. //--- Seat Belt
  108. if ( [ vehicle _unit, "LandVehicle" ] call A3LUK_fnc_isKindOf && ( isNull _source || _source isEqualTo _unit ) ) then { _damage = if ( A3LUK_seatbelt ) then { _damage / 2 } else { _damage }; };
  109.  
  110. //--- Handle bleedout system
  111.  
  112. switch true do {
  113.  
  114. case !( _unit getVariable [ 'Incapacitated', false ] ): {
  115.  
  116. private _fallToBleedout = switch true do {
  117.  
  118. case ( ( _index isEqualTo 0 ) AND (_damage >= 0.90 ) ): { true };
  119. case ( ( _index isEqualTo 5 ) AND (_damage >= 0.90 ) ): { true };
  120. case ( ( _index isEqualTo 11 ) AND (_damage >= 0.90 ) ): { true };
  121. case ( ( _index isEqualTo -1 ) AND (_damage >= 0.90 ) ): { true };
  122. case ( count ( ( ( getAllHitPointsDamage _unit ) select 2 ) select { _x < 0.9 } ) < 11 ): { true };
  123. default { false };
  124.  
  125. };
  126.  
  127. if ( _fallToBleedout ) then { [ _unit, _source ] call A3LUK_fnc_reviveInit };
  128.  
  129. _damage = _damage min 0.90;
  130.  
  131. };
  132.  
  133. };
  134.  
  135. [] spawn A3LUK_fnc_hudUpdate;
  136. _damage;
RAW Paste Data