1
0

fnc_fired_deployable_firedHandler.sqf 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. params["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"];
  2. if(!local _unit) exitWith { diag_log "Fired Deployable not local" };
  3. if (isNull _projectile) then {
  4. _projectile = nearestObject [_unit, _ammo];
  5. };
  6. private _config = configFile >> "CfgAmmo" >> _ammo;
  7. private _deployable = getNumber (_config >> "rd501_fired_deployable");
  8. private _personal = getNumber (_config >> "rd501_fired_deployable_personal");
  9. private _direction = direction _unit;
  10. if (_deployable == 1) then {
  11. if(_personal == 1) exitWith {
  12. ["rd501_fired_deployable_personalShieldDeployServer", [_unit, _ammo]] call CBA_fnc_serverEvent;
  13. deleteVehicle _projectile;
  14. };
  15. [
  16. {
  17. params["_projectile"];
  18. private _speed = vectorMagnitude (velocity _projectile);
  19. !(isNil "_projectile") && (alive _projectile) && _speed <= 0.1
  20. },
  21. {
  22. params["_projectile", "_ammo", "", "", "_direction"];
  23. private _position = getPosATL _projectile;
  24. ["rd501_fired_deployable_deployServer", [_ammo, _position, _direction]] call CBA_fnc_serverEvent;
  25. deleteVehicle _projectile;
  26. },
  27. [_projectile, _ammo, _magazine, _unit, _direction],
  28. 10,
  29. {
  30. params["", "", "_magazine", "_unit"];
  31. systemChat "Something went wrong with your order, we apologise for the inconvenience.";
  32. systemChat "Please file all complaints with Mirror at the Aux Office.";
  33. [
  34. {
  35. params["_unit", "_mag"];
  36. _unit addItem _mag;
  37. systemChat "We've attached a complementary replacement if you had any inventory space.";
  38. },
  39. [_unit, _magazine],
  40. 2
  41. ] call CBA_fnc_waitAndExecute;
  42. }
  43. ] call CBA_fnc_waitUntilAndExecute;
  44. };