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;
};

View File

@@ -1,46 +0,0 @@
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;
_dirX = 0;
_dirY = 1;
_dirZ = 0;
_upX = 0;
_upY = 0;
_upZ = 1;
if (_aroundX != 0) then {
_sinaroundX = sin _aroundX;
_cosaroundX = cos _aroundX;
_dirY = _cosaroundX;
_dirZ = _sinaroundX;
_upY = -(_sinaroundX);
_upZ = _cosaroundX;
};
if (_aroundY != 0) then {
_sinaroundY = sin _aroundY;
_cosaroundY = cos _aroundY;
_dirX = _dirZ * _sinaroundY;
_dirZ = _dirZ * _cosaroundY;
_upX = _upZ * _sinaroundY;
_upZ = _upZ * _cosaroundY;
};
if (_aroundZ != 0) then {
_sinaroundZ = sin _aroundZ;
_cosaroundZ = cos _aroundZ;
_dirXTemp = _dirX;
_dirX = (_dirXTemp * _cosaroundZ) - (_dirY * _sinaroundZ);
_dirY = (_dirY * _cosaroundZ) + (_dirXTemp * _sinaroundZ);
_upXTemp = _upX;
_upX = (_upXTemp * _cosaroundZ) - (_upY * _sinaroundZ);
_upY = (_upY * _cosaroundZ) + (_upXTemp * _sinaroundZ);
};
_dir = [_dirX, _dirY, _dirZ];
_up = [_upX, _upY, _upZ];
_object setVectorDirAndUp [_dir, _up];

View File

@@ -0,0 +1,113 @@
/*-----------------------------------*/
// by strikerforce //
/*--------------------------------*/
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"];
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"">" + localize "STR_EPOCH_ACTION_VECTORS" + " %1" +"</t>",vectorActionState],"\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];
} 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"">" + localize "STR_EPOCH_VECTORS_DEGREES" + " %1" +"</t>",degreeActionState],"\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];
};
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;
_dirX = 0;
_dirY = 1;
_dirZ = 0;
_upX = 0;
_upY = 0;
_upZ = 1;
if (_aroundX != 0) then {
_sinaroundX = sin _aroundX;
_cosaroundX = cos _aroundX;
_dirY = _cosaroundX;
_dirZ = _sinaroundX;
_upY = -(_sinaroundX);
_upZ = _cosaroundX;
};
if (_aroundY != 0) then {
_sinaroundY = sin _aroundY;
_cosaroundY = cos _aroundY;
_dirX = _dirZ * _sinaroundY;
_dirZ = _dirZ * _cosaroundY;
_upX = _upZ * _sinaroundY;
_upZ = _upZ * _cosaroundY;
};
if (_aroundZ != 0) then {
_sinaroundZ = sin _aroundZ;
_cosaroundZ = cos _aroundZ;
_dirXTemp = _dirX;
_dirX = (_dirXTemp * _cosaroundZ) - (_dirY * _sinaroundZ);
_dirY = (_dirY * _cosaroundZ) + (_dirXTemp * _sinaroundZ);
_upXTemp = _upX;
_upX = (_upXTemp * _cosaroundZ) - (_upY * _sinaroundZ);
_upY = (_upY * _cosaroundZ) + (_upXTemp * _sinaroundZ);
};
_dir = [_dirX, _dirY, _dirZ];
_up = [_upX, _upY, _upZ];
_object setVectorDirAndUp [_dir, _up];
};

View File

@@ -0,0 +1,255 @@
/*-----------------------------------*/
// by Raymix //
// July 10 2014 //
/*--------------------------------*/
fnc_snapActionCleanup = {
private ["_s1","_s2","_s3","_cnt","_object","_classname","_objectHelper","_points"];
_s1 = _this select 0;
_s2 = _this select 1;
_s3 = _this select 2;
_object = _this select 3;
_classname = _this select 4;
_objectHelper = _this select 5;
_points = _this select 6;
player removeAction s_player_toggleSnap;
s_player_toggleSnap = -1;
player removeAction s_player_toggleSnapSelect;
s_player_toggleSnapSelect = -1;
if (count s_player_toggleSnapSelectPoint != 0) then {
{
player removeAction _x;
} count s_player_toggleSnapSelectPoint;
s_player_toggleSnapSelectPoint = [];
snapActions = -1;
};
if (_s1 > 0) then {
s_player_toggleSnap = player addaction [format["<t color=""#ffffff"">" + "Snap: %1" +"</t>",snapActionState],"\z\addons\dayz_code\actions\snap_build.sqf",[snapActionState,_object,_classname,_objectHelper,0],10,false,true];
};
if (_s2 > 0) then {
s_player_toggleSnapSelect = player addaction [format["<t color=""#ffffff"">" + localize "STR_EPOCH_ACTION_SNAP_POINT" + " %1" +"</t>",snapActionStateSelect],"\z\addons\dayz_code\actions\snap_build.sqf",[snapActionStateSelect,_object,_classname,_objectHelper,0],9,false,true];
};
if (_s3 > 0) then {
s_player_toggleSnapSelectPoint = [];
_cnt = 0;
{
snapActions = player addaction [format["<t color=""#ffffff"">" + " %1. " + localize "STR_EPOCH_ACTION_SNAP_SELECT" + " %2" + "</t>",_cnt+1,_x select 3],"\z\addons\dayz_code\actions\snap_build.sqf",["Selected",_object,_classname,_objectHelper,_cnt],8,false,false];
s_player_toggleSnapSelectPoint set [count s_player_toggleSnapSelectPoint,snapActions];
_cnt = _cnt + 1;
} count _points;
};
};
fnc_initSnapPoints = {
private ["_objectSnapGizmo","_object","_points"];
_object = _this select 0;
_points = _this select 1;
snapGizmos = [];
{
_objectSnapGizmo = "Sign_sphere10cm_EP1" createVehicleLocal [0,0,0];
_objectSnapGizmo setobjecttexture [0,"#(argb,8,8,3)color(0.04,0.84,0.92,0.3,ca)"];
_objectSnapGizmo attachTo [_object,[_x select 0,_x select 1,_x select 2]];
snapGizmos set [count snapGizmos,_objectSnapGizmo];
} count _points;
};
fnc_initSnapPointsNearby = {
private ["_pos","_findWhitelisted","_pointsNearby","_nearbyObject","_objectSnapGizmo","_posNearby","_object","_whitelist","_radius"];
_object = _this select 0;
_whitelist = _this select 1;
_radius = _this select 2;
_pos = [_object] call FNC_GetPos;
_findWhitelisted = [];
_pointsNearby = [];
_findWhitelisted = nearestObjects [_pos,_whitelist,(_radius + DZE_snapExtraRange)]-[_object];
snapGizmosNearby = [];
{
_nearbyObject = _x;
_pointsNearby = getArray (configFile >> "SnapBuilding" >> (typeOf _x) >> "points");
{
_objectSnapGizmo = "Sign_sphere10cm_EP1" createVehicleLocal [0,0,0];
_objectSnapGizmo setobjecttexture [0,"#(argb,8,8,3)color(0.04,0.84,0.92,0.3,ca)"];
_objectSnapGizmo setDir (_nearbyObject getVariable["memDir",0]);
_posNearby = _nearbyObject modelToWorld [_x select 0,_x select 1,_x select 2];
if (surfaceIsWater _posNearby) then {
_objectSnapGizmo setPosASL [(_posNearby) select 0,(_posNearby) select 1,(getPosASL _nearbyObject select 2) + (_x select 2)];
} else {
_objectSnapGizmo setPosATL _posNearby;
};
snapGizmosNearby set [count snapGizmosNearby,_objectSnapGizmo];
} count _pointsNearby;
} forEach _findWhitelisted;
};
fnc_initSnapPointsCleanup = {
{detach _x; deleteVehicle _x;} count snapGizmos;
snapGizmos = [];
{detach _x; deleteVehicle _x;} count snapGizmosNearby;
snapGizmosNearby = [];
snapActionState = localize "STR_EPOCH_ACTION_SNAP_OFF";
};
fnc_snapDistanceCheck = {
private ["_distClosestPointFound","_distCheck","_distClosest","_testXPos","_distClosestPointFoundPos","_distClosestPointFoundDir","_distClosestAttached","_distCheckAttached","_distClosestAttachedFoundPos","_onWater","_objectHelper","_object"];
_object = _this select 0;
_objectHelper = _this select 1;
while {snapActionState != localize "STR_EPOCH_ACTION_SNAP_OFF"} do {
_distClosestPointFound = objNull;
_distCheck = 0;
_distClosest = 10;
_testXPos = [];
_distClosestPointFoundPos =[];
_distClosestPointFoundDir = 0;
{
if (_x !=_distClosestPointFound) then {_x setobjecttexture [0,"#(argb,8,8,3)color(0.04,0.84,0.92,0.3,ca)"];};
_testXPos = [_x] call FNC_GetPos;
_distCheck = _objectHelper distance _testXPos;
if (_distCheck < _distClosest) then {
_distClosest = _distCheck;
_distClosestPointFound setobjecttexture [0,"#(argb,8,8,3)color(0.04,0.84,0.92,0.3,ca)"];
_distClosestPointFound = _x;
_distClosestPointFound setobjecttexture [0,"#(argb,8,8,3)color(0,0.92,0.06,1,ca)"];
};
} count snapGizmosNearby;
if (!isNull _distClosestPointFound) then {
if (snapActionStateSelect == localize "STR_EPOCH_ACTION_SNAP_POINT_MANUAL") then {
if (helperDetach) then {
_onWater = surfaceIsWater position _distClosestPointFound;
_distClosestPointFoundDir = getDir _distClosestPointFound;
if (_onWater) then {
_distClosestPointFoundPos = getPosASL _distClosestPointFound;
_objectHelper setPosASL _distClosestPointFoundPos;
} else {
_distClosestPointFoundPos = getPosATL _distClosestPointFound;
_objectHelper setPosATL _distClosestPointFoundPos;
};
//_objectHelper setDir _distClosestPointFoundDir;
DZE_memDir = _distClosestPointFoundDir;
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
waitUntil {uiSleep 0.1; !helperDetach};
};
} else {
_distClosestAttached = objNull;
_distCheckAttached = 0;
_distClosest = 10;
_distClosestAttachedFoundPos = [];
{
if (_x !=_distClosestAttached) then {_x setobjecttexture [0,"#(argb,8,8,3)color(0.04,0.84,0.92,0.3,ca)"];};
_testXPos = [_x] call FNC_GetPos;
_distCheckAttached = _distClosestPointFound distance _testXPos;
if (_distCheckAttached < _distClosest) then {
_distClosest = _distCheckAttached;
_distClosestAttached setobjecttexture [0,"#(argb,8,8,3)color(0.04,0.84,0.92,0.3,ca)"];
_distClosestAttached = _x;
_distClosestAttached setobjecttexture [0,"#(argb,8,8,3)color(0,0.92,0.06,1,ca)"];
};
} count snapGizmos;
if (helperDetach) then {
_distClosestPointFoundDir = getDir _distClosestPointFound;
_onWater = surfaceIsWater position _distClosestPointFound;
if (_onWater) then {
_distClosestPointFoundPos = getPosASL _distClosestPointFound;
_distClosestAttachedFoundPos = getPosASL _distClosestAttached;
detach _object;
_objectHelper setPosASL _distClosestAttachedFoundPos;
_object attachTo [_objectHelper];
_objectHelper setPosASL _distClosestPointFoundPos;
} else {
_distClosestPointFoundPos = getPosATL _distClosestPointFound;
_distClosestAttachedFoundPos = getPosATL _distClosestAttached;
detach _object;
_objectHelper setPosATL _distClosestAttachedFoundPos;
_object attachTo [_objectHelper];
_objectHelper setPosATL _distClosestPointFoundPos;
};
//_objectHelper setDir _distClosestPointFoundDir;
DZE_memDir = _distClosestPointFoundDir;
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
waitUntil {uiSleep 0.1; !helperDetach};
};
};
};
uiSleep 0.1;
};
};
fnc_initSnapTutorial = {
/*
Shows help dialog for player ONCE per log in, explaining controls.
Add snapTutorial = false; to your init.sqf to disable this tutorial completely.
You can also add this bool to the end of this function to only show tutorial once per player login (not recommended)
*/
private ["_bldTxtSwitch","_bldTxtEnable","_bldTxtClrO","_bldTxtClrW","_bldTxtClrR","_bldTxtClrG","_bldTxtSz","_bldTxtSzT","_bldTxtShdw","_bldTxtAlgnL","_bldTxtUndrln","_bldTxtBold","_bldTxtFinal","_bldTxtStringTitle","_bldTxtStringSD","_bldTxtStringSE","_bldTxtStringSA","_bldTxtStringSM","_bldTxtStringPG","_bldTxtStringAPG","_bldTxtStringCPG","_bldTxtStringQE","_bldTxtStringQEF","_bldTxtStringFD","_bldTxtStringFS"];
if (isNil "snapTutorial") then {
_bldTxtSwitch = _this select 0;
_bldTxtEnable = _this select 1;
_bldTxtClrO = "color='#ff8800'"; //orange
_bldTxtClrW = "color='#ffffff'"; //white
_bldTxtClrR = "color='#fd0a05'"; //red
_bldTxtClrG = "color='#11ef00'"; //green
_bldTxtSz = "size='0.76'"; //Title font size
_bldTxtSzT = "size='0.4'"; //Text font size
_bldTxtShdw = "shadow='1'"; //Font shadow
_bldTxtAlgnL = "align='left'"; //Text align left
_bldTxtUndrln = "underline='true'";
_bldTxtBold = "font='Zeppelin33'"; //Bold text
_bldTxtFinal = "";
//Delete on init
800 cutRsc ["Default", "PLAIN"];
uiSleep 0.1;
//Init Tutorial text
if (_bldTxtEnable) then {
_bldTxtStringTitle = format ["<t %1%2%3%4%6>Epoch<t %5%7> Snap Building</t></t><br />",_bldTxtClrW,_bldTxtSz,_bldTxtShdw,_bldTxtAlgnL,_bldTxtClrO,_bldTxtUndrln,_bldTxtBold];
_bldTxtStringSD = format["<t %1%4%5%6>[Snap]<t %2> %7</t> <t %3>%8</t></t><br /><br />",_bldTxtClrO,_bldTxtClrR,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_DISABLE",localize "STR_EPOCH_SNAP_TUTORIAL_DISABLE_MSG"];
_bldTxtStringSE = format["<t %1%4%5%6>[Snap]<t %2> %7</t> <t %3>%8</t></t><br /><br />",_bldTxtClrO,_bldTxtClrG,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_ENABLE",localize "STR_EPOCH_SNAP_TUTORIAL_ENABLE_MSG"];
_bldTxtStringSA = format["<t %1%3%4%5>[Auto]<t %2>: %6</t></t><br /><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_AUTO_DETECT"];
_bldTxtStringSM = format["<t %1%3%4%5>[%6]<t %2>: %7</t></t><br /><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_ACTION_SNAP_POINT_MANUAL",localize "STR_EPOCH_SNAP_TUTORIAL_MANUAL_DETECT"];
_bldTxtStringPG = format["<t %1%3%4%5>%6<t %2>: %7</t></t><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_PGUPPGDOWN",localize "STR_EPOCH_SNAP_TUTORIAL_PGUPPGDOWN_MSG"];
_bldTxtStringAPG = format["<t %1%3%4%5>%6<t %2>: %7</t></t><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_ALT_PGUPPGDOWN",localize "STR_EPOCH_SNAP_TUTORIAL_ALT_PGUPPGDOWN_MSG"];
_bldTxtStringCPG = format["<t %1%3%4%5>%6<t %2>: %7</t></t><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_CTRL_PGUPPGDOWN",localize "STR_EPOCH_SNAP_TUTORIAL_CTRL_PGUPPGDOWN_MSG"];
_bldTxtStringQE = format["<t %1%3%4%5>[Q / E]<t %2>: %6</t></t><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_ROTATE180_MSG"];
_bldTxtStringQEF = format["<t %1%3%4%5>[Q / E]<t %2>: %6</t></t><br /><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_ROTATE45_MSG"];
_bldTxtStringFD = format["<t %1%3%4%5>[F]<t %2>: %6</t></t><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_F_DROP_MSG"];
_bldTxtStringFS = format["<t %1%3%4%5>[F]<t %2>: %6</t></t><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_F_SNAP_MSG"];
switch (_bldTxtSwitch) do {
case "init": {
_bldTxtFinal = _bldTxtStringTitle + _bldTxtStringSD + _bldTxtStringPG + _bldTxtStringAPG + _bldTxtStringCPG + _bldTxtStringQE + _bldTxtStringQEF + _bldTxtStringFD;
};
case "OnAuto": {
_bldTxtFinal = _bldTxtStringTitle + _bldTxtStringSE + _bldTxtStringSA + _bldTxtStringPG + _bldTxtStringAPG + _bldTxtStringCPG + _bldTxtStringQE + _bldTxtStringQEF + _bldTxtStringFS;
};
case "manual": {
_bldTxtFinal = _bldTxtStringTitle + _bldTxtStringSE + _bldTxtStringSM + _bldTxtStringPG + _bldTxtStringAPG + _bldTxtStringCPG + _bldTxtStringQE + _bldTxtStringQEF + _bldTxtStringFS;
};
};
[
_bldTxtFinal, //structured text
0.73 * safezoneW + safezoneX, //number - x
0.65 * safezoneH + safezoneY, //number - y
30, //number - duration
1, // number - fade in time
0, // number - delta y
800 //number - layer ID
] spawn bis_fnc_dynamicText;
};
};
};