fnc_fired_deployable_firedHandler.sqf 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. if (_deployable == 1) then {
  9. [
  10. {
  11. params["_projectile"];
  12. private _speed = vectorMagnitude (velocity _projectile);
  13. !(isNil "_projectile") && (alive _projectile) && _speed <= 0.1
  14. },
  15. {
  16. params["_projectile", "_ammo"];
  17. private _position = getPosATL _projectile;
  18. ["rd501_fired_deployable_deployServer", [_ammo, _position]] call CBA_fnc_serverEvent;
  19. deleteVehicle _projectile;
  20. },
  21. [_projectile, _ammo, _magazine, _unit],
  22. 10,
  23. {
  24. params["", "", "_magazine", "_unit"];
  25. systemChat "Something went wrong with your order, we apologise for the inconvenience.";
  26. systemChat "Please file all complaints with Mirror at the Aux Office.";
  27. [
  28. {
  29. params["_unit", "_mag"];
  30. _unit addItem _mag;
  31. systemChat "We've attached a complementary replacement if you had any inventory space.";
  32. },
  33. [_unit, _magazine],
  34. 2
  35. ] call CBA_fnc_waitAndExecute;
  36. }
  37. ] call CBA_fnc_waitUntilAndExecute;
  38. };