SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "..\..\script_macros.hpp"
  2. /*
  3.     File: fn_vInteractionMenu.sqf
  4.     Author: Bryan "Tonic" Boardwine
  5.  
  6.     Description:
  7.     Replaces the mass add actions for various vehicle actions.
  8. */
  9. #define Btn1 37450
  10. #define Btn2 37451
  11. #define Btn3 37452
  12. #define Btn4 37453
  13. #define Btn5 37454
  14. #define Btn6 37455
  15. #define Btn7 37456
  16. #define Title 37401
  17. private ["_display","_curTarget","_Btn1","_Btn2","_Btn3","_Btn4","_Btn5","_Btn6","_id"];
  18. if (!dialog) then {
  19.     createDialog "vInteraction_Menu";
  20. };
  21. disableSerialization;
  22.  
  23. _curTarget = param [0,objNull,[objNull]];
  24. if (isNull _curTarget) exitWith {closeDialog 0;}; //Bad target
  25. _isVehicle = if ((_curTarget isKindOf "landVehicle") || (_curTarget isKindOf "Ship") || (_curTarget isKindOf "Air")) then {true} else {false};
  26. if (!_isVehicle) exitWith {closeDialog 0;};
  27.  
  28. _display = findDisplay 37400;
  29. _Btn1 = _display displayCtrl Btn1;
  30. _Btn2 = _display displayCtrl Btn2;
  31. _Btn3 = _display displayCtrl Btn3;
  32. _Btn4 = _display displayCtrl Btn4;
  33. _Btn5 = _display displayCtrl Btn5;
  34. _Btn6 = _display displayCtrl Btn6;
  35. _Btn7 = _display displayCtrl Btn7;
  36. life_vInact_curTarget = _curTarget;
  37. _id = getObjectDLC _curTarget;
  38.  
  39. //Set Repair Action
  40. _Btn1 ctrlSetText localize "STR_vInAct_Repair";
  41. _Btn1 buttonSetAction "[life_vInact_curTarget] spawn life_fnc_repairTruck; closeDialog 0;";
  42.  
  43. if ((life_inv_toolkit >= 1) && {alive life_vInact_curTarget} && {([life_vInact_curTarget] call life_fnc_isDamaged)}) then {_Btn1 ctrlEnable true;} else {_Btn1 ctrlEnable false;};
  44.  
  45. if (playerSide isEqualTo west) then {
  46.     _Btn2 ctrlSetText localize "STR_vInAct_Registration";
  47.     _Btn2 buttonSetAction "[life_vInact_curTarget] spawn life_fnc_searchVehAction; closeDialog 0;";
  48.  
  49.     _Btn3 ctrlSetText localize "STR_vInAct_SearchVehicle";
  50.     _Btn3 buttonSetAction "[life_vInact_curTarget] spawn life_fnc_vehInvSearch; closeDialog 0;";
  51.  
  52.     _Btn7 ctrlSetText "Contravention";
  53.     _Btn7 buttonSetAction "closeDialog 0; createDialog ""max_contravention"";";
  54.  
  55.     _Btn4 ctrlSetText localize "STR_vInAct_PullOut";
  56.     _Btn4 buttonSetAction "[life_vInact_curTarget] spawn life_fnc_pulloutAction; closeDialog 0;";
  57.     if (crew _curTarget isEqualTo []) then {_Btn4 ctrlEnable false;};
  58.  
  59.     _Btn5 ctrlSetText localize "STR_vInAct_Impound";
  60.     _Btn5 buttonSetAction "[life_vInact_curTarget] spawn life_fnc_impoundAction; closeDialog 0;";
  61.  
  62.     if (_curTarget isKindOf "Ship") then {
  63.         _Btn6 ctrlSetText localize "STR_vInAct_PushBoat";
  64.         _Btn6 buttonSetAction "[] spawn life_fnc_pushObject; closeDialog 0;";
  65.         if (_curTarget isKindOf "Ship" && {local _curTarget} && {crew _curTarget isEqualTo []}) then { _Btn6 ctrlEnable true;} else {_Btn6 ctrlEnable false};
  66.     } else {
  67.         if (!isNil "_id") then {
  68.             if !(_id in getDLCs 1) then {
  69.                 _Btn6 ctrlSetText localize "STR_vInAct_GetInVehicle";
  70.                 _Btn6 buttonSetAction "player moveInDriver life_vInact_curTarget; closeDialog 0;";
  71.                 if (crew _curTarget isEqualTo [] && {canMove _curTarget} && {locked _curTarget isEqualTo 0}) then {_Btn6 ctrlEnable true;} else {_Btn6 ctrlEnable false};
  72.             };
  73.         } else {
  74.             _Btn6 ctrlSetText localize "STR_vInAct_Unflip";
  75.             _Btn6 buttonSetAction "life_vInact_curTarget setPos [getPos life_vInact_curTarget select 0, getPos life_vInact_curTarget select 1, (getPos life_vInact_curTarget select 2)+0.5]; closeDialog 0;";
  76.             if (alive _curTarget && {crew _curTarget isEqualTo []} && {canMove _curTarget}) then { _Btn6 ctrlEnable false;} else {_Btn6 ctrlEnable true;};
  77.         };
  78.     };
  79.  
  80. } else {
  81.  
  82.     if (_curTarget isKindOf "Ship") then {
  83.         _Btn2 ctrlSetText localize "STR_vInAct_PushBoat";
  84.         _Btn2 buttonSetAction "[] spawn life_fnc_pushObject; closeDialog 0;";
  85.         if (alive _curTarget && {_curTarget isKindOf "Ship"} && {local _curTarget} && {crew _curTarget isEqualTo []}) then { _Btn2 ctrlEnable true;} else {_Btn2 ctrlEnable false};
  86.     } else {
  87.         if (!isNil "_id") then {
  88.             if !(_id in getDLCs 1) then {
  89.                 _Btn2 ctrlSetText localize "STR_vInAct_GetInVehicle";
  90.                 _Btn2 buttonSetAction "player moveInDriver life_vInact_curTarget; closeDialog 0;";
  91.                 if (crew _curTarget isEqualTo [] && {canMove _curTarget} && {locked _curTarget isEqualTo 0}) then {_Btn2 ctrlEnable true;} else {_Btn2 ctrlEnable false};
  92.             };
  93.         } else {
  94.             _Btn2 ctrlSetText localize "STR_vInAct_Unflip";
  95.             _Btn2 buttonSetAction "life_vInact_curTarget setPos [getPos life_vInact_curTarget select 0, getPos life_vInact_curTarget select 1, (getPos life_vInact_curTarget select 2)+0.5]; closeDialog 0;";
  96.             if (alive _curTarget && {crew _curTarget isEqualTo []} && {canMove _curTarget}) then { _Btn2 ctrlEnable false;} else {_Btn2 ctrlEnable true;};
  97.         };
  98.     };
  99.     if (typeOf _curTarget == "O_Truck_03_device_F") then {
  100.         _Btn3 ctrlSetText localize "STR_vInAct_DeviceMine";
  101.         _Btn3 buttonSetAction "[life_vInact_curTarget] spawn life_fnc_deviceMine";
  102.         if (!isNil {(_curTarget getVariable "mining")} || !local _curTarget && {_curTarget in life_vehicles}) then {
  103.             _Btn3 ctrlEnable false;
  104.         } else {
  105.             _Btn3 ctrlEnable true;
  106.         };
  107.     } else {
  108.         _Btn3 ctrlShow false;
  109.         if (typeOf (_curTarget) in ["C_Van_01_fuel_F","I_Truck_02_fuel_F","B_Truck_01_fuel_F"] && _curTarget in life_vehicles) then {
  110.             if (!isNil {_curTarget getVariable "fuelTankWork"}) then {
  111.                 _Btn3 ctrlSetText localize "STR_FuelTank_Stop";
  112.                 _Btn3 buttonSetAction "life_vInact_curTarget setVariable [""fuelTankWork"",nil,true]; closeDialog 0;";
  113.                 _Btn3 ctrlShow true;
  114.             } else {
  115.                 if (count (nearestObjects [_curTarget, ["Land_FuelStation_Feed_F","Land_fs_feed_F"], 15]) > 0) then {
  116.                     _Btn3 ctrlSetText localize "STR_FuelTank_Supply";
  117.                     _Btn3 buttonSetAction "[life_vInact_curTarget] spawn life_fnc_fuelSupply";
  118.                     _Btn3 ctrlShow true;
  119.                 }else{
  120.                     {
  121.                         if (player distance (getMarkerPos _x) < 20) exitWith {
  122.                             _Btn3 ctrlSetText localize "STR_FuelTank_Store";
  123.                             _Btn3 buttonSetAction "[life_vInact_curTarget] spawn life_fnc_fuelStore";
  124.                             _Btn3 ctrlShow true;
  125.                         };
  126.                     } forEach ["fuel_storage_1","fuel_storage_2"];
  127.                 };
  128.             };
  129.         };
  130.     };
  131.  
  132.     _Btn4 ctrlShow false;
  133.     _Btn5 ctrlShow false;
  134.     _Btn6 ctrlShow false;
  135.     _Btn7 ctrlShow false;
  136. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top