mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-20 15:12:56 +03:00
Update snap and vector build
Mady by @Victor-the-Cleaner
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
/*-----------------------------------*/
|
||||
// by strikerforce //
|
||||
/*--------------------------------*/
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Author: strikerforce
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private ["_todo", "_selected"];
|
||||
|
||||
_todo = _this select 3 select 2;
|
||||
local _todo = _this select 3 select 2;
|
||||
|
||||
if (_todo == 0) then {
|
||||
vectorActionState = _this select 3 select 0;
|
||||
@@ -17,59 +17,59 @@ if (_todo == 0) then {
|
||||
};
|
||||
};
|
||||
|
||||
_selected = _this select 3 select 3;
|
||||
local _selected = _this select 3 select 3;
|
||||
|
||||
if (_todo == 1 || {_todo == 0}) then {
|
||||
if ((_todo == 1) || (_todo == 0)) then {
|
||||
call {
|
||||
if (vectorActionState == "Init") exitwith {
|
||||
if (vectorActionState == "Init") exitWith {
|
||||
vectorActionState = localize "STR_EPOCH_VECTORS_OPEN";
|
||||
[1,0] call fnc_vectorActionCleanup;
|
||||
|
||||
[] spawn {
|
||||
while {1==1} do {
|
||||
if (DZE_cancelBuilding || {!dayz_actionInProgress}) exitWith {
|
||||
if (DZE_cancelBuilding || !dayz_actionInProgress || DZE_nowBuilding) exitWith {
|
||||
[0,0] call fnc_vectorActionCleanup;
|
||||
vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE";
|
||||
};
|
||||
|
||||
uisleep 2;
|
||||
uiSleep 0.5;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (vectorActionState == localize "STR_EPOCH_VECTORS_OPEN") exitwith {
|
||||
if (vectorActionState == localize "STR_EPOCH_VECTORS_OPEN") exitWith {
|
||||
vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE";
|
||||
[1,1] call fnc_vectorActionCleanup;
|
||||
};
|
||||
|
||||
if (vectorActionState == localize "STR_EPOCH_VECTORS_CLOSE") exitwith {
|
||||
if (vectorActionState == localize "STR_EPOCH_VECTORS_CLOSE") exitWith {
|
||||
vectorActionState = localize "STR_EPOCH_VECTORS_OPEN";
|
||||
[1,0] call fnc_vectorActionCleanup;
|
||||
};
|
||||
if (vectorActionState == localize "STR_EPOCH_VECTORS_PITCH_FORWARD") exitwith {
|
||||
if (vectorActionState == localize "STR_EPOCH_VECTORS_PITCH_FORWARD") exitWith {
|
||||
vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE";
|
||||
[1,1] call fnc_vectorActionCleanup;
|
||||
DZE_updateVec = true;
|
||||
DZE_memForBack = DZE_memForBack + (DZE_curDegree * -1);
|
||||
DZE_memForBack = DZE_memForBack - DZE_curDegree;
|
||||
};
|
||||
if (vectorActionState == localize "STR_EPOCH_VECTORS_PITCH_BACK") exitwith {
|
||||
if (vectorActionState == localize "STR_EPOCH_VECTORS_PITCH_BACK") exitWith {
|
||||
vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE";
|
||||
[1,1] call fnc_vectorActionCleanup;
|
||||
DZE_updateVec = true;
|
||||
DZE_memForBack = DZE_memForBack + DZE_curDegree;
|
||||
};
|
||||
if (vectorActionState == localize "STR_EPOCH_VECTORS_BANK_LEFT") exitwith {
|
||||
if (vectorActionState == localize "STR_EPOCH_VECTORS_BANK_LEFT") exitWith {
|
||||
vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE";
|
||||
[1,1] call fnc_vectorActionCleanup;
|
||||
DZE_updateVec = true;
|
||||
DZE_memLeftRight = DZE_memLeftRight + (DZE_curDegree * -1);
|
||||
DZE_memLeftRight = DZE_memLeftRight - DZE_curDegree;
|
||||
};
|
||||
if (vectorActionState == localize "STR_EPOCH_VECTORS_BANK_RIGHT") exitwith {
|
||||
if (vectorActionState == localize "STR_EPOCH_VECTORS_BANK_RIGHT") exitWith {
|
||||
vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE";
|
||||
[1,1] call fnc_vectorActionCleanup;
|
||||
DZE_updateVec = true;
|
||||
DZE_memLeftRight = DZE_memLeftRight + DZE_curDegree;
|
||||
};
|
||||
if (vectorActionState == localize "STR_EPOCH_VECTORS_RESET") exitwith {
|
||||
if (vectorActionState == localize "STR_EPOCH_VECTORS_RESET") exitWith {
|
||||
vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE";
|
||||
[1,1] call fnc_vectorActionCleanup;
|
||||
DZE_memForBack = 0;
|
||||
@@ -80,32 +80,32 @@ if (_todo == 1 || {_todo == 0}) then {
|
||||
};
|
||||
};
|
||||
|
||||
if (_todo == 2 || {_todo == 0}) then{
|
||||
if ((_todo == 2) || (_todo == 0)) then{
|
||||
call {
|
||||
if (degreeActionState == "Init") exitwith {
|
||||
if (degreeActionState == "Init") exitWith {
|
||||
degreeActionState = localize "STR_EPOCH_VECTORS_OPEN";
|
||||
[1,0] call fnc_degreeActionCleanup;
|
||||
[] spawn {
|
||||
while {1==1} do {
|
||||
if (DZE_cancelBuilding || {!dayz_actionInProgress}) exitWith {
|
||||
if (DZE_cancelBuilding || !dayz_actionInProgress || DZE_nowBuilding) exitWith {
|
||||
[0,0] call fnc_degreeActionCleanup;
|
||||
degreeActionState = localize "STR_EPOCH_VECTORS_CLOSE";
|
||||
};
|
||||
|
||||
uisleep 2;
|
||||
uiSleep 0.5;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (degreeActionState == localize "STR_EPOCH_VECTORS_OPEN") exitwith {
|
||||
if (degreeActionState == localize "STR_EPOCH_VECTORS_OPEN") exitWith {
|
||||
degreeActionState = localize "STR_EPOCH_VECTORS_CLOSE";
|
||||
[1,1] call fnc_degreeActionCleanup;
|
||||
};
|
||||
|
||||
if (degreeActionState == localize "STR_EPOCH_VECTORS_CLOSE") exitwith {
|
||||
if (degreeActionState == localize "STR_EPOCH_VECTORS_CLOSE") exitWith {
|
||||
degreeActionState = localize "STR_EPOCH_VECTORS_OPEN";
|
||||
[1,0] call fnc_degreeActionCleanup;
|
||||
};
|
||||
if (degreeActionState == "SELECT") exitwith {
|
||||
if (degreeActionState == "SELECT") exitWith {
|
||||
degreeActionState = localize "STR_EPOCH_VECTORS_CLOSE";
|
||||
DZE_curDegree = _selected;
|
||||
[1,1] call fnc_degreeActionCleanup;
|
||||
|
||||
@@ -1,95 +1,115 @@
|
||||
/*-----------------------------------*/
|
||||
// by strikerforce //
|
||||
/*--------------------------------*/
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Author: strikerforce
|
||||
//
|
||||
// Updated by Victor the Cleaner
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
fnc_vectorActionCleanup = {
|
||||
private ["_s1","_s2","_staticRotate","_vector"];
|
||||
|
||||
_s1 = _this select 0;
|
||||
_s2 = _this select 1;
|
||||
_staticRotate = ["STR_EPOCH_VECTORS_PITCH_FORWARD","STR_EPOCH_VECTORS_PITCH_BACK","STR_EPOCH_VECTORS_BANK_LEFT","STR_EPOCH_VECTORS_BANK_RIGHT","STR_EPOCH_VECTORS_RESET"];
|
||||
local _ORA = "<t color='#ff8800'>"; // orange
|
||||
local _WHT = "<t color='#ffffff'>"; // white
|
||||
local _TAB = " ";
|
||||
local _END = "</t>";
|
||||
local _VEC = localize "STR_EPOCH_ACTION_VECTORS";
|
||||
local _txt = "";
|
||||
|
||||
local _s1 = _this select 0;
|
||||
local _s2 = _this select 1;
|
||||
|
||||
local _staticRotate = ["STR_EPOCH_VECTORS_PITCH_FORWARD","STR_EPOCH_VECTORS_PITCH_BACK","STR_EPOCH_VECTORS_BANK_LEFT","STR_EPOCH_VECTORS_BANK_RIGHT","STR_EPOCH_VECTORS_RESET"];
|
||||
|
||||
player removeAction s_player_toggleVector;
|
||||
s_player_toggleVector = -1;
|
||||
|
||||
if (count s_player_toggleVectors != 0) then {
|
||||
{player removeAction _x;} count s_player_toggleVectors;
|
||||
s_player_toggleVectors = [];
|
||||
vectorActions = -1;
|
||||
};
|
||||
{player removeAction _x;} count s_player_toggleVectors;
|
||||
vectorActions = -1;
|
||||
|
||||
if (_s1 > 0) then {
|
||||
s_player_toggleVector = player addaction [format["<t color=""#ff8800"">" + localize "STR_EPOCH_ACTION_VECTORS" + " %1" +"</t>",vectorActionState],"\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf",[vectorActionState,degreeActionState,1],7,false,false];
|
||||
_txt = format[_ORA + _VEC + " %1" + _END, vectorActionState];
|
||||
s_player_toggleVector = player addAction [_txt, "\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf",[vectorActionState,degreeActionState,1],7,false,false];
|
||||
};
|
||||
if (_s2 > 0) then {
|
||||
s_player_toggleVectors = [];
|
||||
{
|
||||
_vector = localize _x;
|
||||
vectorActions = player addaction [format["<t color=""#ffffff"">" + " %1" +"</t>",_vector],"\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf",[_vector,degreeActionState,1],6,false,false];
|
||||
s_player_toggleVectors set [count s_player_toggleVectors,vectorActions];
|
||||
local _vector = localize _x;
|
||||
|
||||
_txt = format[_WHT + _TAB + "%1" + _END, _vector];
|
||||
vectorActions = player addAction [_txt, "\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf",[_vector,degreeActionState,1],6,false,false];
|
||||
|
||||
s_player_toggleVectors set [count s_player_toggleVectors, vectorActions];
|
||||
} count _staticRotate;
|
||||
};
|
||||
};
|
||||
|
||||
fnc_degreeActionCleanup = {
|
||||
private ["_s1","_s2"];
|
||||
|
||||
_s1 = _this select 0;
|
||||
_s2 = _this select 1;
|
||||
local _ORA = "<t color='#ff8800'>"; // orange
|
||||
local _RED = "<t color='#ff0000'>"; // red
|
||||
local _WHT = "<t color='#ffffff'>"; // white
|
||||
local _GRN = "<t color='#20E020'>"; // green
|
||||
local _DEG = localize "STR_EPOCH_VECTORS_DEGREES";
|
||||
local _SEL = localize "STR_EPOCH_ACTION_SNAP_SELECT";
|
||||
local _TAB = " ";
|
||||
local _END = "</t>";
|
||||
local _txt = "";
|
||||
|
||||
local _s1 = _this select 0;
|
||||
local _s2 = _this select 1;
|
||||
|
||||
player removeAction s_player_toggleDegree;
|
||||
s_player_toggleDegree = -1;
|
||||
|
||||
if (count s_player_toggleDegrees != 0) then {
|
||||
{player removeAction _x;} count s_player_toggleDegrees;
|
||||
s_player_toggleDegrees = [];
|
||||
degreeActions = -1;
|
||||
};
|
||||
{player removeAction _x;} count s_player_toggleDegrees;
|
||||
degreeActions = -1;
|
||||
|
||||
if (_s1 > 0) then {
|
||||
s_player_toggleDegree = player addaction [format["<t color=""#ff8800"">" + localize "STR_EPOCH_VECTORS_DEGREES" + " %1" +"</t>",degreeActionState],"\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf",[vectorActionState,degreeActionState,2],5,false,false];
|
||||
_txt = format[_ORA + _DEG + " %1" + _END, degreeActionState];
|
||||
s_player_toggleDegree = player addAction [_txt, "\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf",[vectorActionState,degreeActionState,2],5,false,false];
|
||||
};
|
||||
if (_s2 > 0) then {
|
||||
s_player_toggleDegrees = [];
|
||||
{
|
||||
if (DZE_curDegree == _x) then {
|
||||
degreeActions = player addaction [format["<t color=""#ff0000"">" + " " + localize "STR_EPOCH_ACTION_SNAP_SELECT" + " %1" +"</t>",_x],"\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf",[vectorActionState,"SELECT",2,_x],4,false,false];
|
||||
} else {
|
||||
degreeActions = player addaction [format["<t color=""#ffffff"">" + " " + localize "STR_EPOCH_ACTION_SNAP_SELECT" + " %1" +"</t>",_x],"\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf",[vectorActionState,"SELECT",2,_x],4,false,false];
|
||||
};
|
||||
local _COL = _WHT;
|
||||
if (DZE_curDegree == _x) then {_COL = _RED;};
|
||||
|
||||
s_player_toggleDegrees set [count s_player_toggleDegrees,degreeActions];
|
||||
_txt = format[_TAB + _COL + _SEL + " %1" + _END, _x];
|
||||
degreeActions = player addAction [_txt, "\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf",[vectorActionState,"SELECT",2,_x],4,false,false];
|
||||
|
||||
s_player_toggleDegrees set [count s_player_toggleDegrees, degreeActions];
|
||||
} count DZE_vectorDegrees;
|
||||
};
|
||||
};
|
||||
|
||||
fnc_SetPitchBankYaw = {
|
||||
private ["_sinaroundX","_cosaroundX","_dirY","_dirZ","_upY","_upZ","_sinaroundY","_cosaroundY","_dirX","_upX","_sinaroundZ","_cosaroundZ","_dirXTemp","_upXTemp","_object","_rotations","_aroundX","_aroundY","_aroundZ","_dir","_up"];
|
||||
|
||||
_object = _this select 0;
|
||||
_rotations = _this select 1;
|
||||
_aroundX = _rotations select 0;
|
||||
_aroundY = _rotations select 1;
|
||||
_aroundZ = (360 - (_rotations select 2)) - 360;
|
||||
local _object = _this select 0;
|
||||
local _rotations= _this select 1;
|
||||
|
||||
_dirX = 0;
|
||||
_dirY = 1;
|
||||
_dirZ = 0;
|
||||
_upX = 0;
|
||||
_upY = 0;
|
||||
_upZ = 1;
|
||||
local _aroundX = _rotations select 0;
|
||||
local _aroundY = _rotations select 1;
|
||||
local _aroundZ = -(_rotations select 2);
|
||||
|
||||
local _dirX = 0;
|
||||
local _dirY = 1;
|
||||
local _dirZ = 0;
|
||||
local _upX = 0;
|
||||
local _upY = 0;
|
||||
local _upZ = 1;
|
||||
|
||||
if (_aroundX != 0) then {
|
||||
_sinaroundX = sin _aroundX;
|
||||
_cosaroundX = cos _aroundX;
|
||||
local _sinaroundX = sin _aroundX;
|
||||
local _cosaroundX = cos _aroundX;
|
||||
_dirY = _cosaroundX;
|
||||
_dirZ = _sinaroundX;
|
||||
_upY = -(_sinaroundX);
|
||||
_upY = -_sinaroundX;
|
||||
_upZ = _cosaroundX;
|
||||
};
|
||||
|
||||
if (_aroundY != 0) then {
|
||||
_sinaroundY = sin _aroundY;
|
||||
_cosaroundY = cos _aroundY;
|
||||
local _sinaroundY = sin _aroundY;
|
||||
local _cosaroundY = cos _aroundY;
|
||||
_dirX = _dirZ * _sinaroundY;
|
||||
_dirZ = _dirZ * _cosaroundY;
|
||||
_upX = _upZ * _sinaroundY;
|
||||
@@ -97,17 +117,17 @@ fnc_SetPitchBankYaw = {
|
||||
};
|
||||
|
||||
if (_aroundZ != 0) then {
|
||||
_sinaroundZ = sin _aroundZ;
|
||||
_cosaroundZ = cos _aroundZ;
|
||||
_dirXTemp = _dirX;
|
||||
local _sinaroundZ = sin _aroundZ;
|
||||
local _cosaroundZ = cos _aroundZ;
|
||||
local _dirXTemp = _dirX;
|
||||
_dirX = (_dirXTemp * _cosaroundZ) - (_dirY * _sinaroundZ);
|
||||
_dirY = (_dirY * _cosaroundZ) + (_dirXTemp * _sinaroundZ);
|
||||
_upXTemp = _upX;
|
||||
local _upXTemp = _upX;
|
||||
_upX = (_upXTemp * _cosaroundZ) - (_upY * _sinaroundZ);
|
||||
_upY = (_upY * _cosaroundZ) + (_upXTemp * _sinaroundZ);
|
||||
};
|
||||
|
||||
_dir = [_dirX, _dirY, _dirZ];
|
||||
_up = [_upX, _upY, _upZ];
|
||||
local _dir = [_dirX, _dirY, _dirZ];
|
||||
local _up = [_upX, _upY, _upZ];
|
||||
_object setVectorDirAndUp [_dir, _up];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user