kill_manager.sqf 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. params [ "_unit", "_killer" ];
  2. private [ "_nearby_bigtown" ];
  3. if ( isServer ) then {
  4. please_recalculate = true;
  5. if ( isNil "infantry_weight" ) then { infantry_weight = 33 };
  6. if ( isNil "armor_weight" ) then { armor_weight = 33 };
  7. if ( isNil "air_weight" ) then { air_weight = 33 };
  8. if ( side _killer == GRLIB_side_friendly ) then {
  9. _nearby_bigtown = [ sectors_bigtown, { (!(_x in blufor_sectors)) && ( _unit distance (markerpos _x) < 250 ) } ] call BIS_fnc_conditionalSelect;
  10. if ( count _nearby_bigtown > 0 ) then {
  11. combat_readiness = combat_readiness + (0.5 * GRLIB_difficulty_modifier);
  12. stats_readiness_earned = stats_readiness_earned + (0.5 * GRLIB_difficulty_modifier);
  13. if ( combat_readiness > 100.0 && GRLIB_difficulty_modifier < 2 ) then { combat_readiness = 100.0 };
  14. };
  15. if ( _killer isKindOf "Man" ) then {
  16. infantry_weight = infantry_weight + 1;
  17. armor_weight = armor_weight - 0.66;
  18. air_weight = air_weight - 0.66;
  19. } else {
  20. if ( (typeof (vehicle _killer) ) in land_vehicles_classnames ) then {
  21. infantry_weight = infantry_weight - 0.66;
  22. armor_weight = armor_weight + 1;
  23. air_weight = air_weight - 0.66;
  24. };
  25. if ( (typeof (vehicle _killer) ) in air_vehicles_classnames ) then {
  26. infantry_weight = infantry_weight - 0.66;
  27. armor_weight = armor_weight - 0.66;
  28. air_weight = air_weight + 1;
  29. };
  30. };
  31. if ( infantry_weight > 100 ) then { infantry_weight = 100 };
  32. if ( armor_weight > 100 ) then { armor_weight = 100 };
  33. if ( air_weight > 100 ) then { air_weight = 100 };
  34. if ( infantry_weight < 0 ) then { infantry_weight = 0 };
  35. if ( armor_weight < 0 ) then { armor_weight = 0 };
  36. if ( air_weight < 0 ) then { air_weight = 0 };
  37. };
  38. if ( isPlayer _unit ) then {
  39. stats_player_deaths = stats_player_deaths + 1;
  40. // Disconnect UAV from player on death
  41. _unit connectTerminalToUAV objNull;
  42. if (vehicle _unit != _unit) then {moveOut _unit;};
  43. };
  44. if ( _unit isKindOf "Man" ) then {
  45. if ( side (group _unit) == GRLIB_side_civilian ) then {
  46. stats_civilians_killed = stats_civilians_killed + 1;
  47. if ( isPlayer _killer ) then {
  48. stats_civilians_killed_by_players = stats_civilians_killed_by_players + 1;
  49. };
  50. };
  51. if ( side _killer == GRLIB_side_friendly ) then {
  52. if ( side (group _unit) == GRLIB_side_enemy ) then {
  53. stats_opfor_soldiers_killed = stats_opfor_soldiers_killed + 1;
  54. if ( isplayer _killer ) then {
  55. stats_opfor_killed_by_players = stats_opfor_killed_by_players + 1;
  56. };
  57. };
  58. if ( side (group _unit) == GRLIB_side_friendly ) then {
  59. stats_blufor_teamkills = stats_blufor_teamkills + 1;
  60. };
  61. } else {
  62. if ( side (group _unit) == GRLIB_side_friendly ) then {
  63. stats_blufor_soldiers_killed = stats_blufor_soldiers_killed + 1;
  64. };
  65. };
  66. } else {
  67. if ( typeof _unit in all_hostile_classnames ) then {
  68. stats_opfor_vehicles_killed = stats_opfor_vehicles_killed + 1;
  69. if ( isplayer _killer ) then {
  70. stats_opfor_vehicles_killed_by_players = stats_opfor_vehicles_killed_by_players + 1;
  71. };
  72. } else {
  73. stats_blufor_vehicles_killed = stats_blufor_vehicles_killed + 1;
  74. };
  75. };
  76. };
  77. if( isServer && !isplayer _unit) then {
  78. if ( ((typeof _unit) == IA_liberation_ammo_crate) && ((getPosATL _unit) select 2 < 10) ) then {
  79. ( "R_80mm_HE" createVehicle (getPosATL _unit) ) setVelocity [0, 0, -200];
  80. deleteVehicle _unit;
  81. } else {
  82. sleep GRLIB_cleanup_delay;
  83. hidebody _unit;
  84. sleep 10;
  85. deleteVehicle _unit;
  86. };
  87. };