Advertisement
ElDubya

player_deploy.sqf

Nov 6th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 24.07 KB | None | 0 0
  1. /*
  2.     DayZ Base Building
  3.     Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
  4. */
  5. private ["_location","_dir","_classname","_item","_hasrequireditem","_missing","_hastoolweapon","_cancel","_reason","_started","_finished","_animState","_isMedic","_dis","_sfx","_hasbuilditem","_tmpbuilt","_onLadder","_isWater","_require","_text","_offset","_IsNearPlot","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_canBuildOnPlot","_friendlies","_nearestPole","_ownerID","_findNearestPoles","_findNearestPole","_distance","_classnametmp","_ghost","_isPole","_needText","_lockable","_zheightchanged","_rotate","_combination_1","_combination_2","_combination_3","_combination_4","_combination","_combination_1_Display","_combinationDisplay","_zheightdirection","_abort","_isNear","_need","_needNear","_vehicle","_inVehicle","_requireplot","_objHDiff","_isLandFireDZ","_isTankTrap"];
  6.  
  7. if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_40") , "PLAIN DOWN"]; };
  8. DZE_ActionInProgress = true;
  9.  
  10. // disallow building if too many objects are found within 30m
  11. if((count ((getPosATL player) nearObjects ["All",100])) >= DZE_BuildingLimit) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_41"), "PLAIN DOWN"];};
  12.  
  13. _onLadder =     (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
  14. _isWater =     dayz_isSwimming;
  15. _cancel = false;
  16. _reason = "";
  17. _canBuildOnPlot = false;
  18.  
  19. _vehicle = vehicle player;
  20. _inVehicle = (_vehicle != player);
  21.  
  22. DZE_Q = false;
  23. DZE_Z = false;
  24.  
  25. DZE_Q_alt = false;
  26. DZE_Z_alt = false;
  27.  
  28. DZE_Q_ctrl = false;
  29. DZE_Z_ctrl = false;
  30.  
  31. DZE_5 = false;
  32. DZE_4 = false;
  33. DZE_6 = false;
  34.  
  35. DZE_cancelBuilding = false;
  36.  
  37. call gear_ui_init;
  38. closeDialog 1;
  39.  
  40. if (_isWater) exitWith {DZE_ActionInProgress = false; cutText [localize "str_player_26", "PLAIN DOWN"];};
  41. if (_inVehicle) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_42"), "PLAIN DOWN"];};
  42. if (_onLadder) exitWith {DZE_ActionInProgress = false; cutText [localize "str_player_21", "PLAIN DOWN"];};
  43. if (player getVariable["combattimeout", 0] >= time) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_43"), "PLAIN DOWN"];};
  44.  
  45. _item = _this;
  46.  
  47. // Need Near Requirements
  48. _abort = false;
  49. _reason = "";
  50.  
  51. //### BEGIN MODIFIED CODE: player_deploy
  52. //_needNear =     getArray (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "neednearby");
  53. private["_index"];
  54. _index = _this call getDeployableIndex;
  55. _needNear = _index call getDeployableNeedNearBy;
  56. //### END MODIFIED CODE: player_deploy
  57.  
  58. {
  59.     switch(_x) do{
  60.         case "fire":
  61.         {
  62.             _distance = 3;
  63.             _isNear = {inflamed _x} count (getPosATL player nearObjects _distance);
  64.             if(_isNear == 0) then {
  65.                 _abort = true;
  66.                 _reason = "fire";
  67.             };
  68.         };
  69.         case "workshop":
  70.         {
  71.             _distance = 3;
  72.             _isNear = count (nearestObjects [player, ["Wooden_shed_DZ","WoodShack_DZ","WorkBench_DZ"], _distance]);
  73.             if(_isNear == 0) then {
  74.                 _abort = true;
  75.                 _reason = "workshop";
  76.             };
  77.         };
  78.         case "fueltank":
  79.         {
  80.             _distance = 30;
  81.             _isNear = count (nearestObjects [player, dayz_fuelsources, _distance]);
  82.             if(_isNear == 0) then {
  83.                 _abort = true;
  84.                 _reason = "fuel tank";
  85.             };
  86.         };
  87.     };
  88. } forEach _needNear;
  89.  
  90.  
  91. if(_abort) exitWith {
  92.     cutText [format[(localize "str_epoch_player_135"),_reason,_distance], "PLAIN DOWN"];
  93.     DZE_ActionInProgress = false;
  94. };
  95.  
  96. //### BEGIN MODIFIED CODE: player_deploy
  97. //_classname =    getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "create");
  98. //_classnametmp = _classname;
  99. //_require =  getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> "Build" >> "require");
  100. //_text =         getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
  101. //_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
  102. _classname      = _index call getDeployableClass;
  103. _classnametmp   = _classname;
  104. _require        = [];
  105. _text           = _index call getDeployableDisplay;
  106. _ghost          = "";
  107. //### END MODIFIED CODE: player_deploy
  108.  
  109. _lockable = 0;
  110. if(isNumber (configFile >> "CfgVehicles" >> _classname >> "lockable")) then {
  111.     _lockable = getNumber(configFile >> "CfgVehicles" >> _classname >> "lockable");
  112. };
  113.  
  114. _requireplot = 1;
  115. if(isNumber (configFile >> "CfgVehicles" >> _classname >> "requireplot")) then {
  116.     _requireplot = getNumber(configFile >> "CfgVehicles" >> _classname >> "requireplot");
  117. };
  118. //### BEGIN MODIFIED CODE: player_deploy
  119. if(_index call getDeployableRequirePlot) then {_requireplot = 1;} else {_requireplot = 0;};
  120. //### END MODIFIED CODE: player_deploy
  121.  
  122. _isAllowedUnderGround = 1;
  123. if(isNumber (configFile >> "CfgVehicles" >> _classname >> "nounderground")) then {
  124.     _isAllowedUnderGround = getNumber(configFile >> "CfgVehicles" >> _classname >> "nounderground");
  125. };
  126.  
  127. _offset =   getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
  128. if((count _offset) <= 0) then {
  129.     _offset = [0,1.5,0];
  130. };
  131. //### BEGIN MODIFIED CODE: player_deploy
  132. _offset = _index call getDeployableDistanceOffset;
  133. //### END MODIFIED CODE: player_deploy
  134.  
  135. _isPole = (_classname == "Plastic_Pole_EP1_DZ");
  136. _isLandFireDZ = (_classname == "Land_Fire_DZ");
  137.  
  138. _distance = DZE_PlotPole select 0;
  139. _needText = localize "str_epoch_player_246";
  140.  
  141. if(_isPole) then {
  142.     _distance = DZE_PlotPole select 1;
  143. };
  144.  
  145. // check for near plot
  146. _findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];
  147. _findNearestPole = [];
  148.  
  149. {
  150.     if (alive _x) then {
  151.         _findNearestPole set [(count _findNearestPole),_x];
  152.     };
  153. } count _findNearestPoles;
  154.  
  155. _IsNearPlot = count (_findNearestPole);
  156.  
  157. // If item is plot pole && another one exists within 45m
  158. if(_isPole && _IsNearPlot > 0) exitWith { DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_44") , "PLAIN DOWN"]; };
  159.  
  160. private["_exitWith"];
  161. if(_IsNearPlot == 0) then {
  162.  
  163.     // Allow building of plot
  164.     if(_requireplot == 0 || _isLandFireDZ) then {
  165.         _canBuildOnPlot = true;
  166.     } else {
  167.         _exitWith = (localize "STR_EPOCH_PLAYER_135");
  168.     };
  169.  
  170. } else {
  171.     // Since there are plots nearby we check for ownership && then for friend status
  172.  
  173.     // check nearby plots ownership && then for friend status
  174.     _nearestPole = _findNearestPole select 0;
  175.  
  176.     // Find owner
  177.     _ownerID = _nearestPole getVariable ["CharacterID","0"];
  178.  
  179.     // diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];
  180.  
  181.     // check if friendly to owner
  182.     if(dayz_characterID == _ownerID) then {  //Keep ownership
  183.         // owner can build anything within his plot except other plots
  184.         if(!_isPole) then {
  185.             _canBuildOnPlot = true;
  186.         } else {
  187.             _exitWith = "You can't build a plot within your plot!";
  188.         };
  189.  
  190.     } else {
  191. // disallow building plot
  192.     if(!_isPole) then {
  193. // ### PLOT POLE MANAGEMENT START ###
  194.         _friendlies = _nearestPole getVariable ["plotfriends",[]];
  195.         _fuid = [];
  196.     {
  197.         _friendUID = _x select 0;
  198.         _fuid = _fuid + [_friendUID];
  199.     } forEach _friendlies;
  200.         _builder = getPlayerUID player;
  201. // check if friendly to owner
  202.     if(_builder in _fuid) then {
  203.         _canBuildOnPlot = true;
  204. };
  205. // ### PLOT POLE MANAGEMENT END ###
  206. };
  207. };
  208. };
  209.  
  210. // _message
  211. if(!_canBuildOnPlot) exitWith { DZE_ActionInProgress = false; cutText [format[_exitWith,_needText,_distance] , "PLAIN DOWN"]; };
  212.  
  213. _missing = "";
  214. _hasrequireditem = true;
  215. {
  216.     _hastoolweapon = _x in weapons player;
  217.     if(!_hastoolweapon) exitWith { _hasrequireditem = false; _missing = getText (configFile >> "cfgWeapons" >> _x >> "displayName"); };
  218. } count _require;
  219. //### BEGIN MODIFIED CODE player_deploy
  220.     _hastoolweapon = (_index call getDeployableKitClass) in ((weapons player) + (magazines player));
  221.     if(!_hastoolweapon) then { _hasrequireditem = false; _missing = (_index call getDeployableKitDisplay); };
  222. //### END MODIFIED CODE: player_deploy
  223.  
  224. //### BEGIN MODIFIED CODE player_deploy
  225. //_hasbuilditem = _this in magazines player;
  226. //if (!_hasbuilditem) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_player_31"),_text,"build"] , "PLAIN DOWN"]; };
  227. _hasbuilditem = [player,_index] call getHasDeployableParts;
  228. if (!_hasbuilditem) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_player_31"),str (_index call getDeployableParts),"build"] , "PLAIN DOWN"]; };
  229. //### END MODIFIED CODE: player_deploy
  230.  
  231. if (!_hasrequireditem) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_epoch_player_137"),_missing] , "PLAIN DOWN"]; };
  232. if (_hasrequireditem) then {
  233.  
  234.     _dir = getdir player;
  235.     _dir = _dir + 20;
  236.     _location = getPos player;
  237.     _location = [(_location select 0)+8*sin(_dir),(_location select 1)+8*cos(_dir),0]; //maybe adjust the hight? [x,y,z(0)]
  238.     _isOk = true;
  239.  
  240.     // get inital players position
  241.     _location1 = getPosATL player;
  242.  
  243.     // if ghost preview available use that instead
  244.     if (_ghost != "") then {
  245.         _classname = _ghost;
  246.     };
  247.  
  248.     _object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
  249.     //### BEGIN MODIFIED CODE player_deploy
  250.     _object setVariable["ObjectUID","1",true];
  251.  
  252.     _object attachTo [player,_offset];
  253.    
  254.     _object setDir _dir;
  255.     //### END MODIFIED CODE: player_deploy
  256.  
  257.     _position = getPosATL _object;
  258.  
  259.     cutText [(localize "str_epoch_player_45"), "PLAIN DOWN"];
  260.  
  261.     _objHDiff = 0;
  262.  
  263.     while {_isOk} do {
  264.  
  265.         _zheightchanged = false;
  266.         _zheightdirection = "";
  267.         _rotate = false;
  268.  
  269.         if (DZE_Q) then {
  270.             DZE_Q = false;
  271.             _zheightdirection = "up";
  272.             _zheightchanged = true;
  273.         };
  274.         if (DZE_Z) then {
  275.             DZE_Z = false;
  276.             _zheightdirection = "down";
  277.             _zheightchanged = true;
  278.         };
  279.         if (DZE_Q_alt) then {
  280.             DZE_Q_alt = false;
  281.             _zheightdirection = "up_alt";
  282.             _zheightchanged = true;
  283.         };
  284.         if (DZE_Z_alt) then {
  285.             DZE_Z_alt = false;
  286.             _zheightdirection = "down_alt";
  287.             _zheightchanged = true;
  288.         };
  289.         if (DZE_Q_ctrl) then {
  290.             DZE_Q_ctrl = false;
  291.             _zheightdirection = "up_ctrl";
  292.             _zheightchanged = true;
  293.         };
  294.         if (DZE_Z_ctrl) then {
  295.             DZE_Z_ctrl = false;
  296.             _zheightdirection = "down_ctrl";
  297.             _zheightchanged = true;
  298.         };
  299.         if (DZE_4) then {
  300.             _rotate = true;
  301.             DZE_4 = false;
  302.             //###BEGIN MODIFIED CODE: player deploy
  303.             _dir = _dir + 30;
  304.             //###END MODIFIED CODE: player deploy
  305.         };
  306.         if (DZE_6) then {
  307.             _rotate = true;
  308.             DZE_6 = false;
  309.             //###BEGIN MODIFIED CODE: player deploy
  310.             //_dir = 180;
  311.             _dir = _dir - 30;
  312.             //###END MODIFIED CODE: player deploy
  313.         };
  314.  
  315.         if(_rotate) then {
  316.             _object setDir _dir;
  317.             _object setPosATL _position;
  318.             //diag_log format["DEBUG Rotate BUILDING POS: %1", _position];
  319.         };
  320.  
  321.         if(_zheightchanged) then {
  322.             detach _object;
  323.  
  324.             _position = getPosATL _object;
  325.  
  326.             if(_zheightdirection == "up") then {
  327.                 _position set [2,((_position select 2)+0.1)];
  328.                 _objHDiff = _objHDiff + 0.1;
  329.             };
  330.             if(_zheightdirection == "down") then {
  331.                 _position set [2,((_position select 2)-0.1)];
  332.                 _objHDiff = _objHDiff - 0.1;
  333.             };
  334.  
  335.             if(_zheightdirection == "up_alt") then {
  336.                 _position set [2,((_position select 2)+1)];
  337.                 _objHDiff = _objHDiff + 1;
  338.             };
  339.             if(_zheightdirection == "down_alt") then {
  340.                 _position set [2,((_position select 2)-1)];
  341.                 _objHDiff = _objHDiff - 1;
  342.             };
  343.  
  344.             if(_zheightdirection == "up_ctrl") then {
  345.                 _position set [2,((_position select 2)+0.01)];
  346.                 _objHDiff = _objHDiff + 0.01;
  347.             };
  348.             if(_zheightdirection == "down_ctrl") then {
  349.                 _position set [2,((_position select 2)-0.01)];
  350.                 _objHDiff = _objHDiff - 0.01;
  351.             };
  352.  
  353.             //###BEGIN MODIFIED CODE: player deploy
  354.             //_object setDir (getDir _object);
  355.             //###END MODIFIED CODE: player deploy
  356.  
  357.             if((_isAllowedUnderGround == 0) && ((_position select 2) < 0)) then {
  358.                 _position set [2,0];
  359.             };
  360.  
  361.             _object setPosATL _position;
  362.  
  363.             //diag_log format["DEBUG Change BUILDING POS: %1", _position];
  364.  
  365.             _object attachTo [player];
  366.  
  367.             //### BEGIN MODIFIED CODE player_deploy
  368.             _object setDir _dir;
  369.             //### END MODIFIED CODE: player_deploy
  370.  
  371.         };
  372.  
  373.         sleep 0.5;
  374.  
  375.         _location2 = getPosATL player;
  376.  
  377.         if(DZE_5) exitWith {
  378.             _isOk = false;
  379.             detach _object;
  380.             _dir = getDir _object;
  381.             _position = getPosATL _object;
  382.             //diag_log format["DEBUG BUILDING POS: %1", _position];
  383.             _object setPos[0,0,0];
  384.             hideObject _object;
  385.             deleteVehicle _object;
  386.         };
  387.  
  388.         if(_location1 distance _location2 > 15) exitWith {
  389.             _isOk = false;
  390.             _cancel = true;
  391.             _reason = "You've moved to far away from where you started building (within 15 meters)";
  392.             detach _object;
  393.             _object setPos[0,0,0];
  394.             hideObject _object;
  395.             deleteVehicle _object;
  396.         };
  397.  
  398.         if(abs(_objHDiff) > 15) exitWith {
  399.             _isOk = false;
  400.             _cancel = true;
  401.             _reason = "Cannot move up || down more than 15 meters";
  402.             detach _object;
  403.             _object setPos[0,0,0];
  404.             hideObject _object;
  405.             deleteVehicle _object;
  406.         };
  407.  
  408.         if (player getVariable["combattimeout", 0] >= time) exitWith {
  409.             _isOk = false;
  410.             _cancel = true;
  411.             _reason = (localize "str_epoch_player_43");
  412.             detach _object;
  413.             _object setPos[0,0,0];
  414.             hideObject _object;
  415.             deleteVehicle _object;
  416.         };
  417.  
  418.         if (DZE_cancelBuilding) exitWith {
  419.             _isOk = false;
  420.             _cancel = true;
  421.             _reason = "Cancelled building.";
  422.             detach _object;
  423.             _object setPos[0,0,0];
  424.             hideObject _object;
  425.             deleteVehicle _object;
  426.         };
  427.     };
  428.  
  429.     //### END MODIFIED CODE: road building
  430.     //No building on roads unless toggled
  431.     //if (!DZE_BuildOnRoads) then {
  432.     if (!(_index call getDeployableBuildOnRoad)) then {
  433.     //### END MODIFIED CODE: road building
  434.         if (isOnRoad [_position select 0, _position select 1, 0]) then { _cancel = true; _reason = "Cannot build on a road."; };
  435.     };
  436.  
  437.     // No building in trader zones
  438.     if(!canbuild) then { _cancel = true; _reason = "Cannot build in a city."; };
  439.  
  440.     if(!_cancel) then {
  441.  
  442.         _classname = _classnametmp;
  443.  
  444.         // Start Build
  445.         _tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
  446.  
  447.         //### BEGIN MODIFIED CODE: player deploy
  448.         if (!(_index call getDeployableSimulation)) then {
  449.             _tmpbuilt enableSimulation false;
  450.         };
  451.         _tmpbuilt setVariable ["ObjectUID", "1", true];
  452.         //### END MODIFIED CODE: player deploy
  453.  
  454.         _tmpbuilt setdir _dir;
  455.  
  456.         // Get position based on object
  457.         _location = _position;
  458.  
  459.         if((_isAllowedUnderGround == 0) && ((_location select 2) < 0)) then {
  460.             _location set [2,0];
  461.         };
  462.  
  463.         _tmpbuilt setPosATL _location;
  464.  
  465.  
  466.         cutText [format[(localize "str_epoch_player_138"),_text], "PLAIN DOWN"];
  467.  
  468.         _limit = 3;
  469.  
  470.         if (DZE_StaticConstructionCount > 0) then {
  471.             _limit = DZE_StaticConstructionCount;
  472.         }
  473.         else {
  474.             if (isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
  475.                 _limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
  476.             };
  477.         };
  478.  
  479.         _isOk = true;
  480.         _proceed = false;
  481.         _counter = 0;
  482.  
  483.         while {_isOk} do {
  484.  
  485.             [10,10] call dayz_HungerThirst;
  486.             player playActionNow "Medic";
  487.  
  488.             _dis=20;
  489.             _sfx = "repair";
  490.             [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
  491.             [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
  492.  
  493.             r_interrupt = false;
  494.             r_doLoop = true;
  495.             _started = false;
  496.             _finished = false;
  497.  
  498.             while {r_doLoop} do {
  499.                 _animState = animationState player;
  500.                 _isMedic = ["medic",_animState] call fnc_inString;
  501.                 if (_isMedic) then {
  502.                     _started = true;
  503.                 };
  504.                 if (_started && !_isMedic) then {
  505.                     r_doLoop = false;
  506.                     _finished = true;
  507.                 };
  508.                 if (r_interrupt || (player getVariable["combattimeout", 0] >= time)) then {
  509.                     r_doLoop = false;
  510.                 };
  511.                 if (DZE_cancelBuilding) exitWith {
  512.                     r_doLoop = false;
  513.                 };
  514.                 sleep 0.1;
  515.             };
  516.             r_doLoop = false;
  517.  
  518.  
  519.             if(!_finished) exitWith {
  520.                 _isOk = false;
  521.                 _proceed = false;
  522.             };
  523.  
  524.             if(_finished) then {
  525.                 _counter = _counter + 1;
  526.             };
  527.  
  528.             cutText [format[(localize "str_epoch_player_139"),_text, _counter,_limit], "PLAIN DOWN"];
  529.  
  530.             if(_counter == _limit) exitWith {
  531.                 _isOk = false;
  532.                 _proceed = true;
  533.             };
  534.  
  535.         };
  536.  
  537.         if (_proceed) then {
  538.  
  539.             //###BEGIN MODIFIED CODE
  540.             //_num_removed = ([player,_item] call BIS_fnc_invRemove);
  541.             //if(_num_removed == 1) then {
  542.             if([player,_index] call getHasDeployableParts) then {
  543.                 [player,_index] call removeDeployableParts;
  544.             //###BEGIN MODIFIED CODE
  545.  
  546.                 cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];
  547.  
  548.                 if (_isPole) then {
  549.                     [] spawn player_plotPreview;
  550.                 };
  551.  
  552.                 _tmpbuilt setVariable ["OEMPos",_location,true];
  553.  
  554.                 if(_lockable > 1) then {
  555.  
  556.                     _combinationDisplay = "";
  557.  
  558.                     switch (_lockable) do {
  559.  
  560.                         case 2: { // 2 lockbox
  561.                             _combination_1 = (floor(random 3)) + 100; // 100=red,101=green,102=blue
  562.                             _combination_2 = floor(random 10);
  563.                             _combination_3 = floor(random 10);
  564.                             _combination = format["%1%2%3",_combination_1,_combination_2,_combination_3];
  565.                             dayz_combination = _combination;
  566.                             if (_combination_1 == 100) then {
  567.                                 _combination_1_Display = "Red";
  568.                             };
  569.                             if (_combination_1 == 101) then {
  570.                                 _combination_1_Display = "Green";
  571.                             };
  572.                             if (_combination_1 == 102) then {
  573.                                 _combination_1_Display = "Blue";
  574.                             };
  575.                             _combinationDisplay = format["%1%2%3",_combination_1_Display,_combination_2,_combination_3];
  576.                         };
  577.  
  578.                         case 3: { // 3 combolock
  579.                             _combination_1 = floor(random 10);
  580.                             _combination_2 = floor(random 10);
  581.                             _combination_3 = floor(random 10);
  582.                             _combination = format["%1%2%3",_combination_1,_combination_2,_combination_3];
  583.                             dayz_combination = _combination;
  584.                             _combinationDisplay = _combination;
  585.                         };
  586.  
  587.                         case 4: { // 4 safe
  588.                             _combination_1 = floor(random 10);
  589.                             _combination_2 = floor(random 10);
  590.                             _combination_3 = floor(random 10);
  591.                             _combination_4 = floor(random 10);
  592.                             _combination = format["%1%2%3%4",_combination_1,_combination_2,_combination_3,_combination_4];
  593.                             dayz_combination = _combination;
  594.                             _combinationDisplay = _combination;
  595.                         };
  596.                     };
  597.  
  598.                     _tmpbuilt setVariable ["CharacterID",_combination,true];
  599.  
  600.  
  601.                     PVDZE_obj_Publish = [_combination,_tmpbuilt,[_dir,_location],_classname];
  602.                     publicVariableServer "PVDZE_obj_Publish";
  603.  
  604.                     cutText [format[(localize "str_epoch_player_140"),_combinationDisplay,_text], "PLAIN DOWN", 5];
  605.  
  606.  
  607.                 } else {
  608.                     //_tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
  609.                     //### BEGIN MODIFIED CODE: player deploy
  610.                     // fire?
  611.                     //if(_tmpbuilt isKindOf "Land_Fire_DZ") then {
  612.                     //    _tmpbuilt spawn player_fireMonitor;
  613.                     //} else {
  614.                     //    PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location],_classname];
  615.                     //    publicVariableServer "PVDZE_obj_Publish";
  616.                     //};
  617.                     if (_index call getPermanent) then {
  618.                         _tmpbuilt call fnc_set_temp_deployable_id;
  619.                         if(_index call getDeployableSimulation) then {
  620.                             PVDZE_veh_Publish = [_tmpbuilt,[_dir,_position],(_index call getDeployableClass),true,call fnc_perm_deployable_id];
  621.                             publicVariableServer "PVDZE_veh_Publish";
  622.                         } else {
  623.                             PVDZE_obj_Publish = [call fnc_perm_deployable_id,_tmpbuilt,[_dir,_position],(_index call getDeployableClass)];
  624.                             publicVariableServer "PVDZE_obj_Publish";
  625.                         };
  626.                     } else {
  627.                         _tmpbuilt call fnc_set_temp_deployable_id;
  628.                     };
  629.                     if(_index call getClearCargo) then {
  630.                         clearWeaponCargoGlobal _tmpbuilt;
  631.                         clearMagazineCargoGlobal _tmpbuilt;
  632.                     };
  633.                     if(_index call getDeployableClearAmmo) then {
  634.                         _tmpbuilt setVehicleAmmo 0;
  635.                     };
  636.                     player reveal _tmpbuilt;
  637.                     DZE_DEPLOYING_SUCCESSFUL = true;
  638.                     //### END MODIFIED CODE: player deploy
  639.                 };
  640.             } else {
  641.                 _tmpbuilt setPos[0,0,0];
  642.                 hideObject _tmpbuilt;
  643.                 deleteVehicle _tmpbuilt;
  644.                 cutText [(localize "str_epoch_player_46") , "PLAIN DOWN"];
  645.             };
  646.  
  647.         } else {
  648.             r_interrupt = false;
  649.             if (vehicle player == player) then {
  650.                 [objNull, player, rSwitchMove,""] call RE;
  651.                 player playActionNow "stop";
  652.             };
  653.  
  654.             _tmpbuilt setPos[0,0,0];
  655.             hideObject _tmpbuilt;
  656.             deleteVehicle _tmpbuilt;
  657.  
  658.             cutText [(localize "str_epoch_player_46") , "PLAIN DOWN"];
  659.         };
  660.  
  661.     } else {
  662.         cutText [format[(localize "str_epoch_player_47"),_text,_reason], "PLAIN DOWN"];
  663.     };
  664. };
  665.  
  666. DZE_ActionInProgress = false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement