mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
code optimization, bugs, improvements
This commit is contained in:
@@ -33,7 +33,7 @@ DZE_buildItem = _this; //This is a magazine! It's global to allow access to it f
|
|||||||
//Check illegal player states. Returns [_isFine] string
|
//Check illegal player states. Returns [_isFine] string
|
||||||
[] call player_build_states;
|
[] call player_build_states;
|
||||||
|
|
||||||
//check for nearby requirements (campfire, workshop, fueltank). Returns [_reason] string
|
//check for nearby requirements (campfire, workshop, fueltank).
|
||||||
[] call player_build_needNearby;
|
[] call player_build_needNearby;
|
||||||
|
|
||||||
//check config files and gather info about item (if using custom buildables, make your own similar function instead).
|
//check config files and gather info about item (if using custom buildables, make your own similar function instead).
|
||||||
@@ -71,10 +71,9 @@ _hasrequireditem = _hasRequired select 0; //bool
|
|||||||
//define items collected from function
|
//define items collected from function
|
||||||
_location1 = _buildObject select 0; //array
|
_location1 = _buildObject select 0; //array
|
||||||
_object = _buildObject select 1; //Obj
|
_object = _buildObject select 1; //Obj
|
||||||
_position = _buildObject select 2; // array
|
_objectHelper = _buildObject select 2; //Obj
|
||||||
_objectHelper = _buildObject select 3; //Obj
|
|
||||||
|
|
||||||
_controls = [_object, _isAllowedUnderGround, _location1, _position, _objectHelper] call player_build_controls;
|
_controls = [_object, _isAllowedUnderGround, _location1, _objectHelper] call player_build_controls;
|
||||||
|
|
||||||
//define items collected from function
|
//define items collected from function
|
||||||
_cancel = _controls select 0; //bool
|
_cancel = _controls select 0; //bool
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ private ["_canDo","_passArray","_objHDiff","_isOk","_zheightchanged","_zheightdi
|
|||||||
_object = _this select 0;
|
_object = _this select 0;
|
||||||
_isAllowedUnderGround = _this select 1;
|
_isAllowedUnderGround = _this select 1;
|
||||||
_location1 = _this select 2;
|
_location1 = _this select 2;
|
||||||
_position = _this select 3;
|
_objectHelper = _this select 3;
|
||||||
_objectHelper = _this select 4;
|
|
||||||
|
|
||||||
_passArray = [];
|
_passArray = [];
|
||||||
|
|
||||||
@@ -15,6 +14,7 @@ _reason = "";
|
|||||||
_dir = getDir player; //required to pass direction when building
|
_dir = getDir player; //required to pass direction when building
|
||||||
helperDetach = false;
|
helperDetach = false;
|
||||||
_canDo = (!r_drag_sqf and !r_player_unconscious);
|
_canDo = (!r_drag_sqf and !r_player_unconscious);
|
||||||
|
_position = [_objectHelper] call FNC_GetPos;
|
||||||
|
|
||||||
while {_isOk} do {
|
while {_isOk} do {
|
||||||
|
|
||||||
@@ -55,35 +55,26 @@ while {_isOk} do {
|
|||||||
if (DZE_4) then {
|
if (DZE_4) then {
|
||||||
_rotate = true;
|
_rotate = true;
|
||||||
DZE_4 = false;
|
DZE_4 = false;
|
||||||
if (helperDetach) then {
|
_dir = -45;
|
||||||
_dir = -45;
|
|
||||||
} else {
|
|
||||||
_dir = 180;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
if (DZE_6) then {
|
if (DZE_6) then {
|
||||||
_rotate = true;
|
_rotate = true;
|
||||||
DZE_6 = false;
|
DZE_6 = false;
|
||||||
if (helperDetach) then {
|
_dir = 45;
|
||||||
_dir = 45;
|
|
||||||
} else {
|
|
||||||
_dir = 0;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (DZE_F and _canDo) then {
|
if (DZE_F and _canDo) then {
|
||||||
if (helperDetach) then {
|
if (helperDetach) then {
|
||||||
_objectHelperDir = getDir _objectHelper;
|
_objectHelperDir = getDir _objectHelper;
|
||||||
_objectHelper attachTo [player];
|
_objectHelper attachTo [player];
|
||||||
_objectHelper setDir _objectHelperDir-(getDir player);
|
_objectHelper setDir _objectHelperDir-(getDir player);
|
||||||
helperDetach = false;
|
helperDetach = false;
|
||||||
} else {
|
} else {
|
||||||
_objectHelperPos = getPosATL _objectHelper;
|
_objectHelperDir = getDir _objectHelper;
|
||||||
detach _objectHelper;
|
detach _objectHelper;
|
||||||
_objectHelper setPosATL _objectHelperPos;
|
[_objectHelper] call FNC_GetSetPos;
|
||||||
_objectHelperDir = getDir _objectHelper;
|
_objectHelper setVelocity [0,0,0]; //fix sliding glitch
|
||||||
_objectHelper setVelocity [0,0,0]; //fix sliding glitch
|
helperDetach = true;
|
||||||
helperDetach = true;
|
|
||||||
};
|
};
|
||||||
DZE_F = false;
|
DZE_F = false;
|
||||||
};
|
};
|
||||||
@@ -91,21 +82,26 @@ while {_isOk} do {
|
|||||||
if(_rotate) then {
|
if(_rotate) then {
|
||||||
if (helperDetach) then {
|
if (helperDetach) then {
|
||||||
_objectHelperDir = getDir _objectHelper;
|
_objectHelperDir = getDir _objectHelper;
|
||||||
_objectHelperPos = getPosATL _objectHelper;
|
|
||||||
_objectHelper setDir _objectHelperDir+_dir;
|
_objectHelper setDir _objectHelperDir+_dir;
|
||||||
_objectHelper setPosATL _objectHelperPos;
|
[_objectHelper] call FNC_GetSetPos;
|
||||||
} else {
|
} else {
|
||||||
_objectHelper setDir _dir;
|
detach _objectHelper;
|
||||||
_objectHelper setPosATL _position;
|
_objectHelperDir = getDir _objectHelper;
|
||||||
|
_objectHelper setDir _objectHelperDir+_dir;
|
||||||
|
[_objectHelper] call FNC_GetSetPos;
|
||||||
|
_objectHelperDir = getDir _objectHelper;
|
||||||
|
_objectHelper attachTo [player];
|
||||||
|
_objectHelper setDir _objectHelperDir-(getDir player);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if(_zheightchanged) then {
|
if(_zheightchanged) then {
|
||||||
if (!helperDetach) then {
|
if (!helperDetach) then {
|
||||||
detach _objectHelper;
|
detach _objectHelper;
|
||||||
|
_objectHelperDir = getDir _objectHelper;
|
||||||
};
|
};
|
||||||
|
|
||||||
_position = getPosATL _objectHelper;
|
_position = [_objectHelper] call FNC_GetPos;
|
||||||
|
|
||||||
if(_zheightdirection == "up") then {
|
if(_zheightdirection == "up") then {
|
||||||
_position set [2,((_position select 2)+0.1)];
|
_position set [2,((_position select 2)+0.1)];
|
||||||
@@ -134,30 +130,32 @@ while {_isOk} do {
|
|||||||
_objHDiff = _objHDiff - 0.01;
|
_objHDiff = _objHDiff - 0.01;
|
||||||
};
|
};
|
||||||
|
|
||||||
_objectHelper setDir (getDir _objectHelper);
|
|
||||||
|
|
||||||
if((_isAllowedUnderGround == 0) && ((_position select 2) < 0)) then {
|
if((_isAllowedUnderGround == 0) && ((_position select 2) < 0)) then {
|
||||||
_position set [2,0];
|
_position set [2,0];
|
||||||
};
|
};
|
||||||
|
|
||||||
_objectHelper setPosATL _position;
|
if (surfaceIsWater _position) then {
|
||||||
|
_objectHelper setPosASL _position;
|
||||||
|
} else {
|
||||||
|
_objectHelper setPosATL _position;
|
||||||
|
};
|
||||||
|
|
||||||
if (!helperDetach) then {
|
if (!helperDetach) then {
|
||||||
_objectHelper attachTo [player];
|
_objectHelper attachTo [player];
|
||||||
|
_objectHelper setDir _objectHelperDir-(getDir player);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sleep 0.5;
|
sleep 0.5;
|
||||||
|
|
||||||
_location2 = getPosATL player;
|
_location2 = [player] call FNC_GetPos;
|
||||||
_objectHelperPos = getPosATL _objectHelper;
|
_objectHelperPos = [_objectHelper] call FNC_GetPos;
|
||||||
|
|
||||||
if(DZE_5) exitWith {
|
if(DZE_5) exitWith {
|
||||||
_isOk = false;
|
_isOk = false;
|
||||||
|
_position = [_object] call FNC_GetPos;
|
||||||
detach _object;
|
detach _object;
|
||||||
_position = getPosATL _object;
|
|
||||||
_dir = getDir _object;
|
_dir = getDir _object;
|
||||||
|
|
||||||
deleteVehicle _object;
|
deleteVehicle _object;
|
||||||
detach _objectHelper;
|
detach _objectHelper;
|
||||||
deleteVehicle _objectHelper;
|
deleteVehicle _objectHelper;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
// disallow building if too many objects are found within 30m (by default)
|
// disallow building if too many objects are found within 30m (by default)
|
||||||
private ["_cnt"];
|
private ["_cnt","_pos"];
|
||||||
|
|
||||||
_cnt = count ((getPosATL player) nearObjects ["All",DZE_checkNearbyRadius]);
|
_pos = [player] call FNC_GetPos;
|
||||||
|
_cnt = count (_pos nearObjects ["All",DZE_checkNearbyRadius]);
|
||||||
if (_cnt >= DZE_BuildingLimit) exitWith { //end script if too many objects nearby
|
if (_cnt >= DZE_BuildingLimit) exitWith { //end script if too many objects nearby
|
||||||
DZE_ActionInProgress = false;
|
DZE_ActionInProgress = false;
|
||||||
cutText [(localize "str_epoch_player_41"), "PLAIN DOWN"];
|
cutText [(localize "str_epoch_player_41"), "PLAIN DOWN"];
|
||||||
};
|
};
|
||||||
|
|
||||||
_cnt //returns amount of total objects found nearby
|
_cnt //returns amount of total objects found nearby
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//create an object for default build system style
|
//create an object for default build system style
|
||||||
private ["_passArray","_classname","_enableGhost","_ghost","_location","_location1","_dir","_object","_position","_objectHelper","_helperColor"];
|
private ["_passArray","_classname","_enableGhost","_ghost","_location1","_dir","_object","_objectHelper","_helperColor"];
|
||||||
|
|
||||||
_classname = _this select 0;
|
_classname = _this select 0;
|
||||||
_ghost = _this select 1;
|
_ghost = _this select 1;
|
||||||
@@ -7,11 +7,10 @@ _offset = _this select 2;
|
|||||||
_enableGhost = _this select 3; //pass false trough args if not using ghost preview
|
_enableGhost = _this select 3; //pass false trough args if not using ghost preview
|
||||||
|
|
||||||
_passArray = [];
|
_passArray = [];
|
||||||
_location = [0,0,0]; //create object in debug zone first
|
|
||||||
_objectHelper = objNull;
|
_objectHelper = objNull;
|
||||||
|
|
||||||
// get inital players position
|
// get inital players position
|
||||||
_location1 = getPosATL player;
|
_location1 = [player] call FNC_GetPos;
|
||||||
|
|
||||||
// if enabled, use ghost preview where available
|
// if enabled, use ghost preview where available
|
||||||
if (_enableGhost) then {
|
if (_enableGhost) then {
|
||||||
@@ -20,19 +19,19 @@ if (_enableGhost) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"]; //object preview, not an actual object that will be built
|
_object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"]; //object preview, not an actual object that will be built
|
||||||
|
|
||||||
_objectHelper = "Sign_sphere10cm_EP1" createVehicle _location;
|
_objectHelper = "Sign_sphere10cm_EP1" createVehicle [0,0,0];
|
||||||
_helperColor = "#(argb,8,8,3)color(0,0,0,0,ca)";
|
_helperColor = "#(argb,8,8,3)color(0,0,0,0,ca)";
|
||||||
_objectHelper setobjecttexture [0,_helperColor];
|
_objectHelper setobjecttexture [0,_helperColor];
|
||||||
_objectHelper attachTo [player,_offset];
|
_objectHelper attachTo [player,_offset];
|
||||||
_object attachTo [_objectHelper,[0,0,0]];
|
_object attachTo [_objectHelper,[0,0,0]];
|
||||||
_position = getPosATL _objectHelper;
|
|
||||||
|
|
||||||
if (isClass (configFile >> "SnapBuilding" >> _classname)) then {
|
if (isClass (configFile >> "SnapBuilding" >> _classname)) then {
|
||||||
["","","",["Init",_object,_classname,_objectHelper]] spawn snap_build;
|
["","","",["Init",_object,_classname,_objectHelper]] spawn snap_build;
|
||||||
};
|
};
|
||||||
|
|
||||||
_passArray = [_location1,_object,_position,_objectHelper];
|
_passArray = [_location1,_object,_objectHelper];
|
||||||
_passArray //[array,obj,array]
|
_passArray //[array,obj,array]
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
if(!DZE_ActionInProgress) exitWith {};
|
if(!DZE_ActionInProgress) exitWith {};
|
||||||
//disallow building if required items (defined in config) are not found nearby
|
//disallow building if required items (defined in config) are not found nearby
|
||||||
private ["_abort","_reason","_distance","_needNear","_isNear"];
|
private ["_abort","_reason","_distance","_needNear","_isNear","_pos"];
|
||||||
|
|
||||||
_abort = false; //do not abort by default
|
_abort = false; //do not abort by default
|
||||||
_reason = ""; // define to avoid RPT errors
|
_reason = ""; // define to avoid RPT errors
|
||||||
_needNear = getArray (configFile >> "CfgMagazines" >> DZE_buildItem >> "ItemActions" >> "Build" >> "neednearby");
|
_needNear = getArray (configFile >> "CfgMagazines" >> DZE_buildItem >> "ItemActions" >> "Build" >> "neednearby");
|
||||||
|
_pos = [player] call FNC_GetPos;
|
||||||
{
|
{
|
||||||
switch(_x) do{
|
switch(_x) do{
|
||||||
case "fire":
|
case "fire":
|
||||||
{
|
{
|
||||||
_distance = 3;
|
_distance = 3;
|
||||||
_isNear = {inflamed _x} count (getPosATL player nearObjects _distance);
|
_isNear = {inflamed _x} count (_pos nearObjects _distance);
|
||||||
if(_isNear == 0) then {
|
if(_isNear == 0) then {
|
||||||
_abort = true;
|
_abort = true;
|
||||||
_reason = "fire";
|
_reason = "fire";
|
||||||
@@ -20,7 +20,7 @@ _needNear = getArray (configFile >> "CfgMagazines" >> DZE_buildItem >> "ItemActi
|
|||||||
case "workshop":
|
case "workshop":
|
||||||
{
|
{
|
||||||
_distance = 3;
|
_distance = 3;
|
||||||
_isNear = count (nearestObjects [player, ["Wooden_shed_DZ","WoodShack_DZ","WorkBench_DZ"], _distance]);
|
_isNear = count (nearestObjects [_pos, ["Wooden_shed_DZ","WoodShack_DZ","WorkBench_DZ"], _distance]);
|
||||||
if(_isNear == 0) then {
|
if(_isNear == 0) then {
|
||||||
_abort = true;
|
_abort = true;
|
||||||
_reason = "workshop";
|
_reason = "workshop";
|
||||||
@@ -29,7 +29,7 @@ _needNear = getArray (configFile >> "CfgMagazines" >> DZE_buildItem >> "ItemActi
|
|||||||
case "fueltank":
|
case "fueltank":
|
||||||
{
|
{
|
||||||
_distance = 30;
|
_distance = 30;
|
||||||
_isNear = count (nearestObjects [player, dayz_fuelsources, _distance]);
|
_isNear = count (nearestObjects [_pos, dayz_fuelsources, _distance]);
|
||||||
if(_isNear == 0) then {
|
if(_isNear == 0) then {
|
||||||
_abort = true;
|
_abort = true;
|
||||||
_reason = "fuel tank";
|
_reason = "fuel tank";
|
||||||
@@ -41,4 +41,4 @@ _needNear = getArray (configFile >> "CfgMagazines" >> DZE_buildItem >> "ItemActi
|
|||||||
if (_abort) exitWith {
|
if (_abort) exitWith {
|
||||||
cutText [format[(localize "str_epoch_player_135"),_reason,_distance], "PLAIN DOWN"];
|
cutText [format[(localize "str_epoch_player_135"),_reason,_distance], "PLAIN DOWN"];
|
||||||
DZE_ActionInProgress = false;
|
DZE_ActionInProgress = false;
|
||||||
};
|
};
|
||||||
@@ -48,8 +48,11 @@ if(!_cancel) then {
|
|||||||
_location set [2,0]; //reset Z axis to zero (above terrain)
|
_location set [2,0]; //reset Z axis to zero (above terrain)
|
||||||
};
|
};
|
||||||
|
|
||||||
_tmpbuilt setPosATL _location; //update position passed from args or previous if statement
|
if (surfaceIsWater _location) then {
|
||||||
|
_tmpbuilt setPosASL _location;
|
||||||
|
} else {
|
||||||
|
_tmpbuilt setPosATL _location;
|
||||||
|
};
|
||||||
|
|
||||||
cutText [format[(localize "str_epoch_player_138"),_text], "PLAIN DOWN"];
|
cutText [format[(localize "str_epoch_player_138"),_text], "PLAIN DOWN"];
|
||||||
|
|
||||||
|
|||||||
@@ -57,26 +57,18 @@ fnc_initSnapPoints = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fnc_initSnapPointsNearby = {
|
fnc_initSnapPointsNearby = {
|
||||||
_pos = getPosATL _object;
|
_pos = [_object] call FNC_GetPos;
|
||||||
_findWhitelisted = []; _pointsNearby = []; _waterBase = 0;
|
_findWhitelisted = []; _pointsNearby = [];
|
||||||
_onWater = surfaceIsWater position player;
|
_findWhitelisted = nearestObjects [_pos,_whitelist,(_radius + DZE_snapExtraRange)]-[_object];
|
||||||
if (_onWater) then { _waterBase = (getPosATL player select 2);};
|
|
||||||
_findWhitelisted = nearestObjects [_pos,_whitelist,(_radius + DZE_snapExtraRange + _waterBase)]-[_object];
|
|
||||||
snapGizmosNearby = [];
|
snapGizmosNearby = [];
|
||||||
{
|
{
|
||||||
_nearbyObject = _x;
|
_nearbyObject = _x;
|
||||||
_pointsNearby = getArray (configFile >> "SnapBuilding" >> (typeOf _x) >> "points");
|
_pointsNearby = getArray (configFile >> "SnapBuilding" >> (typeOf _x) >> "points");
|
||||||
{
|
{
|
||||||
_onWater = surfaceIsWater position _nearbyObject;
|
|
||||||
_objectSnapGizmo = "Sign_sphere10cm_EP1" createVehicleLocal [0,0,0];
|
_objectSnapGizmo = "Sign_sphere10cm_EP1" createVehicleLocal [0,0,0];
|
||||||
_objectSnapGizmo setobjecttexture [0,_objColorInactive];
|
_objectSnapGizmo setobjecttexture [0,_objColorInactive];
|
||||||
_posNearby = _nearbyObject modelToWorld [_x select 0,_x select 1,_x select 2];
|
_objectSnapGizmo setDir ((getDir _nearbyObject)-45);
|
||||||
if (_onWater) then {
|
_objectSnapGizmo attachTo [_nearbyObject,[_x select 0,_x select 1,_x select 2]];
|
||||||
_objectSnapGizmo setPosASL [(_posNearby) select 0,(_posNearby) select 1,(getPosASL _nearbyObject select 2) + (_x select 2)];
|
|
||||||
} else {
|
|
||||||
_objectSnapGizmo setPosATL _posNearby;
|
|
||||||
};
|
|
||||||
_objectSnapGizmo setDir (getDir _nearbyObject);
|
|
||||||
snapGizmosNearby set [count snapGizmosNearby,_objectSnapGizmo];
|
snapGizmosNearby set [count snapGizmosNearby,_objectSnapGizmo];
|
||||||
} count _pointsNearby;
|
} count _pointsNearby;
|
||||||
} forEach _findWhitelisted;
|
} forEach _findWhitelisted;
|
||||||
@@ -84,7 +76,7 @@ fnc_initSnapPointsNearby = {
|
|||||||
|
|
||||||
fnc_initSnapPointsCleanup = {
|
fnc_initSnapPointsCleanup = {
|
||||||
{detach _x;deleteVehicle _x;}count snapGizmos;snapGizmos=[];
|
{detach _x;deleteVehicle _x;}count snapGizmos;snapGizmos=[];
|
||||||
{deleteVehicle _x;}count snapGizmosNearby;snapGizmosNearby=[];
|
{detach _x;deleteVehicle _x;}count snapGizmosNearby;snapGizmosNearby=[];
|
||||||
snapActionState = "OFF";
|
snapActionState = "OFF";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -94,12 +86,7 @@ fnc_snapDistanceCheck = {
|
|||||||
_distClosestPointFound = objNull; _distCheck = 0; _distClosest = 10; _distClosestPoint = objNull; _testXPos = []; _distClosestPointFoundPos =[]; _distClosestPointFoundDir = 0;
|
_distClosestPointFound = objNull; _distCheck = 0; _distClosest = 10; _distClosestPoint = objNull; _testXPos = []; _distClosestPointFoundPos =[]; _distClosestPointFoundDir = 0;
|
||||||
{
|
{
|
||||||
if (_x !=_distClosestPointFound) then {_x setobjecttexture [0,_objColorInactive];};
|
if (_x !=_distClosestPointFound) then {_x setobjecttexture [0,_objColorInactive];};
|
||||||
_onWater = surfaceIsWater position _x;
|
_testXPos = [_x] call FNC_GetPos;
|
||||||
if (_onWater) then {
|
|
||||||
_testXPos = [(getPosASL _x select 0),(getPosASL _x select 1),(getPosASL _x select 2)];
|
|
||||||
} else {
|
|
||||||
_testXPos = [(getPosATL _x select 0),(getPosATL _x select 1),(getPosATL _x select 2)];
|
|
||||||
};
|
|
||||||
_distCheck = _objectHelper distance _testXPos;
|
_distCheck = _objectHelper distance _testXPos;
|
||||||
_distClosestPoint = _x;
|
_distClosestPoint = _x;
|
||||||
if (_distCheck < _distClosest) then {
|
if (_distCheck < _distClosest) then {
|
||||||
@@ -121,7 +108,7 @@ fnc_snapDistanceCheck = {
|
|||||||
} else {
|
} else {
|
||||||
_distClosestPointFoundPos = getPosATL _distClosestPointFound;
|
_distClosestPointFoundPos = getPosATL _distClosestPointFound;
|
||||||
_objectHelper setPosATL _distClosestPointFoundPos;
|
_objectHelper setPosATL _distClosestPointFoundPos;
|
||||||
};
|
};
|
||||||
_objectHelper setDir _distClosestPointFoundDir;
|
_objectHelper setDir _distClosestPointFoundDir;
|
||||||
waitUntil {sleep 0.1; !helperDetach};
|
waitUntil {sleep 0.1; !helperDetach};
|
||||||
};
|
};
|
||||||
@@ -129,12 +116,7 @@ fnc_snapDistanceCheck = {
|
|||||||
_distClosestAttached = objNull; _distCheckAttached = 0; _distClosest = 10; _distClosestAttachedFoundPos = [];
|
_distClosestAttached = objNull; _distCheckAttached = 0; _distClosest = 10; _distClosestAttachedFoundPos = [];
|
||||||
{
|
{
|
||||||
if (_x !=_distClosestAttached) then {_x setobjecttexture [0,_objColorInactive];};
|
if (_x !=_distClosestAttached) then {_x setobjecttexture [0,_objColorInactive];};
|
||||||
_onWater = surfaceIsWater position _x;
|
_testXPos = [_x] call FNC_GetPos;
|
||||||
if (_onWater) then {
|
|
||||||
_testXPos = [(getPosASL _x select 0),(getPosASL _x select 1),(getPosASL _x select 2)];
|
|
||||||
} else {
|
|
||||||
_testXPos = [(getPosATL _x select 0),(getPosATL _x select 1),(getPosATL _x select 2)];
|
|
||||||
};
|
|
||||||
_distCheckAttached = _distClosestPointFound distance _testXPos;
|
_distCheckAttached = _distClosestPointFound distance _testXPos;
|
||||||
_distClosestPoint = _x;
|
_distClosestPoint = _x;
|
||||||
if (_distCheckAttached < _distClosest) then {
|
if (_distCheckAttached < _distClosest) then {
|
||||||
@@ -285,10 +267,11 @@ switch (snapActionState) do {
|
|||||||
_newPos = [(getPosATL _x select 0),(getPosATL _x select 1),(getPosATL _x select 2)];
|
_newPos = [(getPosATL _x select 0),(getPosATL _x select 1),(getPosATL _x select 2)];
|
||||||
detach _object;
|
detach _object;
|
||||||
detach _objectHelper;
|
detach _objectHelper;
|
||||||
|
_objectHelper setDir (getDir _object);
|
||||||
_objectHelper setPosATL _newPos;
|
_objectHelper setPosATL _newPos;
|
||||||
_object attachTo [_objectHelper];
|
_object attachTo [_objectHelper];
|
||||||
_x setobjecttexture [0,_objColorActive];
|
_x setobjecttexture [0,_objColorActive];
|
||||||
if (!helperDetach) then {_objectHelper attachTo [player];};
|
if (!helperDetach) then {_objectHelper attachTo [player]; _objectHelper setDir ((getDir _objectHelper)-(getDir player));};
|
||||||
};
|
};
|
||||||
_cnt = _cnt+1;
|
_cnt = _cnt+1;
|
||||||
}count snapGizmos;
|
}count snapGizmos;
|
||||||
|
|||||||
Reference in New Issue
Block a user