From 2f6e0bf4c6ab5be46c890ea6f9aaeef72effe733 Mon Sep 17 00:00:00 2001 From: DirtySanchez Date: Fri, 20 Oct 2017 00:50:22 -0500 Subject: [PATCH] snapping corrections and direction lock for similar constructions Add direction lock. If direction lock it only allows 0 and 180 degrees adjustment. Will force 90 to 180 an 270 to 0 This keeps all snaps in proper order during tests --- .../compile/building/EPOCH_staticMove.sqf | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf b/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf index dd18839a..35a7491c 100644 --- a/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf +++ b/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf @@ -223,12 +223,16 @@ if (_class != "") then { _Snapdirection = EPOCH_snapDirection; EP_snapPos = [0,0,0]; _snapped = false; + _dirlock = false; { _nearestObject = _x; _isSnap = false; // Vector + Snapping _snapMemoryPoint = ""; + if( ((typeOf _nearestObject) isEqualTo _staticClass) || ((_nearestObject isKindOf "Const_floors_static_F") && (_staticClass isKindOf "Const_floors_static_F")) || ((_nearestObject isKindOf "Const_Cinder_static_F") && (_staticClass isKindOf "Const_Cinder_static_F")) || ((_nearestObject isKindOf "Const_WoodWalls_static_F") && (_staticClass isKindOf "Const_WoodWalls_static_F")) )then{ + _dirLock = true; + }; _snapPosition = [0, 0, 0]; if (!isNull _nearestObject) then { @@ -273,6 +277,11 @@ if (_class != "") then { else { _direction = 0; }; + if(_dirLock)then{ + ["Snap Direction LOCKED to 0 and 180", 5] call Epoch_message; + if(EPOCH_snapDirection isEqualTo 3)then{EPOCH_snapDirection = 0;}; + if(EPOCH_snapDirection isEqualTo 1)then{EPOCH_snapDirection = 2;}; + }; if (EPOCH_snapDirection > 0) then { _direction = _direction + (EPOCH_snapDirection * 90); }; @@ -325,7 +334,12 @@ if (_class != "") then { _currentTarget setVectorDirAndUp [_vectorDir,_vectorUP]; }; }; - + + if(_dirLock)then{ + _currentTarget setVectorDirAndUp [_dir2,_vectorUP]; + _currentTarget setposATL _snapPosition; + }; + _snapped = true; _arr_snapPoints = []; EPOCH_arr_snapPoints = [];