Update Snap and Vector build

- pre compile all snap and vector functions, it was only pre compiled if got started from modular_build before but not if it got called from the action menu
- localize snap and vector building
- clean up the code
- remove old Cinderwall vector fix, it looks like it is not needed anymore
- Update modular_build and player_build
This commit is contained in:
A Man
2020-03-08 14:08:45 +01:00
parent 267136beae
commit fe1d7fb48d
11 changed files with 880 additions and 700 deletions

View File

@@ -1,111 +1,76 @@
/*-----------------------------------*/
// by Raymix //
// July 10 2014 //
// by strikerforce //
/*--------------------------------*/
private ["_object","_objectSnapGizmo","_objColorActive","_objColorInactive","_classname","_whitelist","_radius","_cfg","_cnt","_pos","_findWhitelisted","_nearbyObject","_posNearby","_selectedAction","_newPos","_pointsNearby","_onWater","_waterBase"];
//Args
private ["_todo", "_selected"];
_todo = _this select 3 select 2;
if(_todo == 0) then{
if (_todo == 0) then {
vectorActionState = _this select 3 select 0;
degreeActionState = _this select 3 select 1;
}else{
if(_todo == 1) then{
} else {
if (_todo == 1) then {
vectorActionState = _this select 3 select 0;
}else{
} else {
degreeActionState = _this select 3 select 1;
};
};
_selected = _this select 3 select 3;
_staticRotate = ["Pitch Forward","Pitch Back","Bank Left","Bank Right","Reset"];
fnc_vectorActionCleanup = {
private ["_s1","_s2"];
_s1 = _this select 0;
_s2 = _this select 1;
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;};
if (_s1 > 0) then {
s_player_toggleVector = player addaction [format[("<t color=""#ff8800"">" + ("Vectors: %1") +"</t>"),vectorActionState],DZE_build_vector_file,[vectorActionState,degreeActionState,1],7,false,false];
};
if (_s2 > 0) then {
s_player_toggleVectors=[];
{
vectorActions = player addaction [format[("<t color=""#ffffff"">" + (" %1") +"</t>"),_x],DZE_build_vector_file,[_x,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;
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;};
if (_s1 > 0) then {
s_player_toggleDegree = player addaction [format[("<t color=""#ff8800"">" + ("Degrees: %1") +"</t>"),degreeActionState],DZE_build_vector_file,[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"">" + (" Select: %1") +"</t>"),_x],DZE_build_vector_file,[vectorActionState,"SELECT",2,_x],4,false,false];
}else{
degreeActions = player addaction [format[("<t color=""#ffffff"">" + (" Select: %1") +"</t>"),_x],DZE_build_vector_file,[vectorActionState,"SELECT",2,_x],4,false,false];
};
s_player_toggleDegrees set [count s_player_toggleDegrees,degreeActions];
}count DZE_vectorDegrees;
};
};
if(_todo == 1 || _todo == 0) then{
switch (vectorActionState) do {
case "Init": {
vectorActionState = "OPEN";
if (_todo == 1 || {_todo == 0}) then {
call {
if (vectorActionState == "Init") exitwith {
vectorActionState = localize "STR_EPOCH_VECTORS_OPEN";
[1,0] call fnc_vectorActionCleanup;
[] spawn {
while {true} do {
if(!dayz_actionInProgress || DZE_cancelBuilding) exitWith {[0,0] call fnc_vectorActionCleanup; vectorActionState = "CLOSE";};
sleep 2;
while {1==1} do {
if (DZE_cancelBuilding || {!dayz_actionInProgress}) exitWith {
[0,0] call fnc_vectorActionCleanup;
vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE";
};
uisleep 2;
};
};
};
case "OPEN": {
vectorActionState = "CLOSE";
if (vectorActionState == localize "STR_EPOCH_VECTORS_OPEN") exitwith {
vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE";
[1,1] call fnc_vectorActionCleanup;
};
case "CLOSE":{
vectorActionState = "OPEN";
if (vectorActionState == localize "STR_EPOCH_VECTORS_CLOSE") exitwith {
vectorActionState = localize "STR_EPOCH_VECTORS_OPEN";
[1,0] call fnc_vectorActionCleanup;
};
case "Pitch Forward":{
vectorActionState = "CLOSE";
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);
};
case "Pitch Back":{
vectorActionState = "CLOSE";
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;
};
case "Bank Left":{
vectorActionState = "CLOSE";
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);
};
case "Bank Right":{
vectorActionState = "CLOSE";
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;
};
case "Reset":{
vectorActionState = "CLOSE";
if (vectorActionState == localize "STR_EPOCH_VECTORS_RESET") exitwith {
vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE";
[1,1] call fnc_vectorActionCleanup;
DZE_memForBack = 0;
DZE_memLeftRight = 0;
@@ -115,29 +80,33 @@ if(_todo == 1 || _todo == 0) then{
};
};
if(_todo == 2 || _todo == 0) then{
switch (degreeActionState) do {
case "Init": {
degreeActionState = "OPEN";
if (_todo == 2 || {_todo == 0}) then{
call {
if (degreeActionState == "Init") exitwith {
degreeActionState = localize "STR_EPOCH_VECTORS_OPEN";
[1,0] call fnc_degreeActionCleanup;
[] spawn {
while {true} do {
if(!dayz_actionInProgress || DZE_cancelBuilding) exitWith {[0,0] call fnc_degreeActionCleanup; degreeActionState = "CLOSE";};
sleep 2;
while {1==1} do {
if (DZE_cancelBuilding || {!dayz_actionInProgress}) exitWith {
[0,0] call fnc_degreeActionCleanup;
degreeActionState = localize "STR_EPOCH_VECTORS_CLOSE";
};
uisleep 2;
};
};
};
case "OPEN": {
degreeActionState = "CLOSE";
if (degreeActionState == localize "STR_EPOCH_VECTORS_OPEN") exitwith {
degreeActionState = localize "STR_EPOCH_VECTORS_CLOSE";
[1,1] call fnc_degreeActionCleanup;
};
case "CLOSE":{
degreeActionState = "OPEN";
if (degreeActionState == localize "STR_EPOCH_VECTORS_CLOSE") exitwith {
degreeActionState = localize "STR_EPOCH_VECTORS_OPEN";
[1,0] call fnc_degreeActionCleanup;
};
case "SELECT":{
degreeActionState = "CLOSE";
if (degreeActionState == "SELECT") exitwith {
degreeActionState = localize "STR_EPOCH_VECTORS_CLOSE";
DZE_curDegree = _selected;
[1,1] call fnc_degreeActionCleanup;
};