mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-24 09:29:21 +03:00
Update snap and vector build
Mady by @Victor-the-Cleaner
This commit is contained in:
@@ -514,7 +514,7 @@ if (_proceed && _success) then {
|
||||
call {
|
||||
if (_type == 2) exitWith {_item addWeaponCargoGlobal [_itemOut, _countOut]};
|
||||
if (_type == 3) exitWith {_item addMagazineCargoGlobal [_itemOut, _countOut]};
|
||||
if (_type == 5) exitWith { //_item addBackpackCargoGlobal [_itemOut, _countOut]; // Needs to make sure object can handle Backpacks or will dump on the ground.
|
||||
if (_type == 5) exitWith {
|
||||
|
||||
for "_i" from 1 to _countOut do {
|
||||
|
||||
|
||||
@@ -1,102 +1,103 @@
|
||||
/*-----------------------------------*/
|
||||
// by Raymix //
|
||||
// July 10 2014 //
|
||||
/*--------------------------------*/
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Author: Raymix
|
||||
// Date: July 10 2014
|
||||
//
|
||||
// Updated by Victor the Cleaner
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private ["_object", "_classname", "_objectHelper", "_selectedAction", "_cfg", "_whitelist", "_points", "_radius"];
|
||||
local _p = _this select 3;
|
||||
|
||||
snapActionState = _this select 3 select 0;
|
||||
_object = _this select 3 select 1;
|
||||
_classname = _this select 3 select 2;
|
||||
_objectHelper = _this select 3 select 3;
|
||||
_selectedAction = _this select 3 select 4;
|
||||
snapActionState = _p select 0;
|
||||
local _object = _p select 1;
|
||||
local _classname = _p select 2;
|
||||
local _objectHelper = _p select 3;
|
||||
local _selectedAction = _p select 4;
|
||||
|
||||
//Snap config file
|
||||
_cfg = (configFile >> "SnapBuilding" >> _classname);
|
||||
_whitelist = getArray (_cfg >> "snapTo");
|
||||
_points = getArray (_cfg >> "points");
|
||||
_radius = getNumber (_cfg >> "radius");
|
||||
local _points = getArray (configFile >> "SnapBuilding" >> _classname >> "points");
|
||||
|
||||
_moveHelper = {
|
||||
detach _objectHelper;
|
||||
detach _object;
|
||||
|
||||
if (DZE_SnapSelIdx >= 0) then {
|
||||
_objectHelper setPosATL (getPosATL (snapGizmos select DZE_SnapSelIdx));
|
||||
} else {
|
||||
// reset helper to modelBase or modelCenter position (not necessarily the same as pivot/bottom)
|
||||
_objectHelper setPosATL (getPosATL modelSelect);
|
||||
};
|
||||
_object attachTo [_objectHelper];
|
||||
|
||||
if (!helperDetach) then {
|
||||
_objectHelper attachTo [player];
|
||||
};
|
||||
[_objectHelper, [DZE_memForBack, DZE_memLeftRight, DZE_memDir]] call fnc_SetPitchBankYaw;
|
||||
};
|
||||
|
||||
call {
|
||||
if (snapActionState == "Init") exitwith {
|
||||
["init",true] call fnc_initSnapTutorial;
|
||||
if (snapActionState == "Init") exitWith {
|
||||
snapActionState = localize "STR_EPOCH_ACTION_SNAP_OFF";
|
||||
[1,0,0,_object,_classname,_objectHelper,_points] call fnc_snapActionCleanup;
|
||||
[1,0,0, _object, _classname, _objectHelper, _points] call fnc_snapActionCleanup;
|
||||
|
||||
[_object,_classname,_objectHelper,_points] spawn {
|
||||
private ["_object", "_classname", "_objectHelper", "_points"];
|
||||
[_object, _classname, _objectHelper, _points] spawn {
|
||||
|
||||
_object = _this select 0;
|
||||
_classname = _this select 1;
|
||||
_objectHelper = _this select 2;
|
||||
_points = _this select 3;
|
||||
local _object = _this select 0;
|
||||
local _classname = _this select 1;
|
||||
local _objectHelper = _this select 2;
|
||||
local _points = _this select 3;
|
||||
|
||||
while {1==1} do {
|
||||
if (DZE_cancelBuilding || {!dayz_actionInProgress}) exitWith {
|
||||
if (DZE_cancelBuilding || !dayz_actionInProgress || DZE_nowBuilding) exitWith {
|
||||
call fnc_initSnapPointsCleanup;
|
||||
[0,0,0,_object,_classname,_objectHelper,_points] call fnc_snapActionCleanup;
|
||||
["",false] call fnc_initSnapTutorial;
|
||||
[0,0,0, _object, _classname, _objectHelper, _points] call fnc_snapActionCleanup;
|
||||
snapActionState = localize "STR_EPOCH_ACTION_SNAP_OFF";
|
||||
};
|
||||
|
||||
uiSleep 2;
|
||||
uiSleep 0.2;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (snapActionState == localize "STR_EPOCH_ACTION_SNAP_OFF") exitwith {
|
||||
["OnAuto",true] call fnc_initSnapTutorial;
|
||||
if (snapActionState == localize "STR_EPOCH_ACTION_SNAP_OFF") exitWith { // OFF to Auto
|
||||
snapActionState = localize "STR_EPOCH_ACTION_SNAP_ON";
|
||||
snapActionStateSelect = "Auto";
|
||||
[1,1,0,_object,_classname,_objectHelper,_points] call fnc_snapActionCleanup;
|
||||
[_object,_points] call fnc_initSnapPoints;
|
||||
[_object,_whitelist,_radius] call fnc_initSnapPointsNearby;
|
||||
[1,1,0, _object, _classname, _objectHelper, _points] call fnc_snapActionCleanup;
|
||||
[_object, _points] call fnc_initSnapPoints;
|
||||
[_object] call fnc_initSnapPointsNearby;
|
||||
uiSleep 0.25;
|
||||
[_object,_objectHelper] call fnc_snapDistanceCheck;
|
||||
[_object, _objectHelper] call fnc_snapDistanceCheck;
|
||||
};
|
||||
|
||||
if (snapActionState == localize "STR_EPOCH_ACTION_SNAP_ON") exitwith {
|
||||
["init",true] call fnc_initSnapTutorial;
|
||||
if (snapActionState == localize "STR_EPOCH_ACTION_SNAP_ON") exitWith { // ON to OFF
|
||||
snapActionState = localize "STR_EPOCH_ACTION_SNAP_OFF";
|
||||
[1,0,0,_object,_classname,_objectHelper,_points] call fnc_snapActionCleanup;
|
||||
DZE_SnapSelIdx = -2;
|
||||
[1,0,0, _object, _classname, _objectHelper, _points] call fnc_snapActionCleanup;
|
||||
call _moveHelper;
|
||||
call fnc_initSnapPointsCleanup;
|
||||
};
|
||||
|
||||
if (snapActionState == "Auto") exitwith {
|
||||
["manual",true] call fnc_initSnapTutorial;
|
||||
if (snapActionState == "Auto") exitWith { // Auto to Manual, but nothing selected
|
||||
snapActionState = localize "STR_EPOCH_ACTION_SNAP_ON";
|
||||
snapActionStateSelect = localize "STR_EPOCH_ACTION_SNAP_POINT_MANUAL";
|
||||
[1,1,1,_object,_classname,_objectHelper,_points] call fnc_snapActionCleanup;
|
||||
[1,1,1, _object, _classname, _objectHelper, _points] call fnc_snapActionCleanup;
|
||||
};
|
||||
|
||||
if (snapActionState == localize "STR_EPOCH_ACTION_SNAP_POINT_MANUAL") exitwith {
|
||||
["OnAuto",true] call fnc_initSnapTutorial;
|
||||
if (snapActionState == localize "STR_EPOCH_ACTION_SNAP_POINT_MANUAL") exitWith { // Manual to Auto
|
||||
snapActionState = localize "STR_EPOCH_ACTION_SNAP_ON";
|
||||
snapActionStateSelect = "Auto";
|
||||
[1,1,0,_object,_classname,_objectHelper,_points] call fnc_snapActionCleanup;
|
||||
[1,1,0, _object, _classname, _objectHelper, _points] call fnc_snapActionCleanup;
|
||||
};
|
||||
|
||||
if (snapActionState == "Selected") exitwith {
|
||||
private ["_cnt", "_newPos"];
|
||||
|
||||
_cnt = 0;
|
||||
_newPos = [];
|
||||
if (snapActionState == "Selected") exitWith { // select snapping point
|
||||
{
|
||||
_x setobjecttexture [0,"#(argb,8,8,3)color(0.04,0.84,0.92,0.3,ca)"];
|
||||
if (_cnt == _selectedAction) then {
|
||||
_newPos = [(getPosATL _x select 0),(getPosATL _x select 1),(getPosATL _x select 2)];
|
||||
detach _object;
|
||||
detach _objectHelper;
|
||||
_objectHelper setDir (getDir _object);
|
||||
_objectHelper setPosATL _newPos;
|
||||
_object attachTo [_objectHelper];
|
||||
_x setobjecttexture [0,"#(argb,8,8,3)color(0,0.92,0.06,1,ca)"];
|
||||
if (!helperDetach) then {
|
||||
_objectHelper attachTo [player];
|
||||
_objectHelper setDir ((getDir _objectHelper)-(getDir player));
|
||||
};
|
||||
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
|
||||
if (_forEachIndex == _selectedAction) then {
|
||||
DZE_SnapSelIdx = _forEachIndex; // snap selection index
|
||||
call _moveHelper;
|
||||
_x setObjectTexture DZE_SNAP_POINT_FOUND; // red
|
||||
} else {
|
||||
_x setObjectTexture DZE_SNAP_POINT_RESET; // green
|
||||
};
|
||||
_cnt = _cnt + 1;
|
||||
} count snapGizmos;
|
||||
} forEach snapGizmos;
|
||||
[1,1,1, _object, _classname, _objectHelper, _points] call fnc_snapActionCleanup;
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user