From a297cfea637559ab45c8d694e112db6bc01038c0 Mon Sep 17 00:00:00 2001 From: raymix Date: Wed, 16 Jul 2014 06:38:27 +0100 Subject: [PATCH 1/3] snap building plotpole / infinite drag fix --- SQF/dayz_code/Configs/CfgExtra/snappoints.hpp | 2 ++ SQF/dayz_code/actions/player_build2.sqf | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp b/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp index d21cd2665..03486271b 100644 --- a/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp +++ b/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp @@ -183,6 +183,7 @@ class SnapBuilding { {-1.73926,0.05,0,"Bottom"} }; }; + class WoodStairs_DZ: Stairs_DZE {}; class WoodStairs_Preview_DZ: Stairs_DZE {}; class WoodStairsSans_Preview_DZ: Stairs_DZE {}; class WoodStairsSans_DZ: Stairs_DZE {}; @@ -203,6 +204,7 @@ class SnapBuilding { class WoodSmallWallWin_DZ: WoodSmall_DZE {}; class Land_DZE_WoodDoor: WoodSmall_DZE {}; class Land_DZE_WoodDoorLocked: WoodSmall_DZE {}; + class WoodDoor_Preview_DZ: WoodSmall_DZE{}; class WoodLarge_DZE: FloorsWallsStairs { //Large wood walls points[] = { diff --git a/SQF/dayz_code/actions/player_build2.sqf b/SQF/dayz_code/actions/player_build2.sqf index d7f554b29..c71a3f22f 100644 --- a/SQF/dayz_code/actions/player_build2.sqf +++ b/SQF/dayz_code/actions/player_build2.sqf @@ -385,6 +385,32 @@ if (isClass (configFile >> "SnapBuilding" >> _classname)) then { detach _objectHelper; deleteVehicle _objectHelper; }; + + if(_IsNearPlot == 0) then { + _findNearestPoles = nearestObjects [_objectHelper, ["Plastic_Pole_EP1_DZ"], 30]; + _nearestPole = _findNearestPoles select 0; + _objectHelperPos = getPosATL _objectHelper; + if (_objectHelperPos distance _nearestPole < 30) exitWith { + _isOk = false; + _cancel = true; + _reason = "You cannot enter plot pole area while building is in progress"; + detach _object; + deleteVehicle _object; + detach _objectHelper; + deleteVehicle _objectHelper; + }; + }; + + + if(_location1 distance _objectHelperPos > 10) exitWith { + _isOk = false; + _cancel = true; + _reason = "Object is placed to far away from where you started building (within 10 meters)"; + detach _object; + deleteVehicle _object; + detach _objectHelper; + deleteVehicle _objectHelper; + }; if(abs(_objHDiff) > 10) exitWith { _isOk = false; From 077da122718284596c9b13683ca06601155e06b8 Mon Sep 17 00:00:00 2001 From: raymix Date: Wed, 16 Jul 2014 07:32:13 +0100 Subject: [PATCH 2/3] plotpole fix for new update --- SQF/dayz_code/actions/player_build2.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SQF/dayz_code/actions/player_build2.sqf b/SQF/dayz_code/actions/player_build2.sqf index c71a3f22f..47cdd33c9 100644 --- a/SQF/dayz_code/actions/player_build2.sqf +++ b/SQF/dayz_code/actions/player_build2.sqf @@ -386,7 +386,7 @@ if (isClass (configFile >> "SnapBuilding" >> _classname)) then { deleteVehicle _objectHelper; }; - if(_IsNearPlot == 0) then { + if(_IsNearPlot == 0 && !_isPole) then { _findNearestPoles = nearestObjects [_objectHelper, ["Plastic_Pole_EP1_DZ"], 30]; _nearestPole = _findNearestPoles select 0; _objectHelperPos = getPosATL _objectHelper; From 95077f35f845b01a5d2fae86aafaecb6b1327989 Mon Sep 17 00:00:00 2001 From: raymix Date: Thu, 17 Jul 2014 20:00:26 +0100 Subject: [PATCH 3/3] snap optimization for large bases --- SQF/dayz_code/Configs/CfgExtra/snappoints.hpp | 14 ++++++++++++++ SQF/dayz_code/actions/snap_build.sqf | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp b/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp index 03486271b..0cc12c0ca 100644 --- a/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp +++ b/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp @@ -14,6 +14,7 @@ class SnapBuilding { "BagFenceRound_DZ", "Fort_RazorWire" }; + radius = 5; }; //snap points class Land_HBarrier5Preview: Barrier{ //fix for broken offsets in ghost @@ -122,6 +123,7 @@ class SnapBuilding { "CinderWallDoorSmall_DZ", "MetalFloor_DZ" }; + radius = 5; }; class WoodFloorQuarter_Preview_DZ: FloorsWallsStairs { //fix for broken offsets in ghost @@ -171,6 +173,7 @@ class SnapBuilding { {-2.45,0,0.130,"Left"}, {2.45,0,0.130,"Right"} }; + radius = 10; }; class WoodFloor_DZ: WoodFloor_Preview_DZ{}; @@ -243,6 +246,7 @@ class SnapBuilding { {2.752, 0, 1.5,"Right"}, {0, 0, 3.37042,"Top"} }; + radius = 5; }; class CinderWall_Preview_DZ: Cinder_DZE {}; class CinderWallDoorway_Preview_DZ: Cinder_DZE {}; @@ -279,6 +283,7 @@ class SnapBuilding { {-2.64, 0, 0.009,"Left"}, {2.64, 0, 0.009,"Right"} }; + radius = 10; }; class MetalFloor_DZ: FloorsWallsStairs{ points[] = { @@ -288,6 +293,7 @@ class SnapBuilding { {-2.64, 0, 0.15,"Left"}, {2.64, 0, 0.15,"Right"} }; + radius = 10; }; @@ -296,6 +302,7 @@ class SnapBuilding { snapTo[] = { "WoodCrate_DZ" }; + radius = 5; points[] = { {0,0,0,"Pivot"}, {0,-0.47,0,"Back"}, @@ -310,6 +317,7 @@ class SnapBuilding { snapTo[] = { "MetalPanel_DZ" }; + radius = 5; points[] = { {0,0,0,"Pivot"}, {-1.5,0,0,"Left"}, @@ -321,6 +329,7 @@ class SnapBuilding { snapTo[] = { "MetalGate_DZ" }; + radius = 5; points[] = { {0,0,0,"Pivot"}, {-4.1,0,0,"Left"} @@ -331,6 +340,7 @@ class SnapBuilding { snapTo[] = { "StickFence_DZ" }; + radius = 5; points[] = { {0,0,0,"Pivot"}, {-2.95,0,0.3,"Left"}, @@ -342,6 +352,7 @@ class SnapBuilding { snapTo[] = { "Fence_corrugated_DZ" }; + radius = 5; points[] = { {0,0,0,"Pivot"}, {-1.95,0,0.88,"Left"}, @@ -353,6 +364,7 @@ class SnapBuilding { snapTo[] = { "WoodRamp_DZ" }; + radius = 5; points[] = { {0,0,0,"Pivot"}, {0.65,-1.7,1.2,"Back"}, @@ -366,6 +378,7 @@ class SnapBuilding { snapTo[] = { "WoodLadder_DZ" }; + radius = 5; points[] = { {0,0,0,"Pivot"}, {-0.4,0,1.725,"Left"}, @@ -379,6 +392,7 @@ class SnapBuilding { "VaultStorageLocked", "VaultStorage" }; + radius = 5; points[] = { {0,0,0,"Pivot"}, {0,0.284,0.615,"Back"}, diff --git a/SQF/dayz_code/actions/snap_build.sqf b/SQF/dayz_code/actions/snap_build.sqf index 0f961b65c..88a2f32ba 100644 --- a/SQF/dayz_code/actions/snap_build.sqf +++ b/SQF/dayz_code/actions/snap_build.sqf @@ -3,7 +3,7 @@ // July 10 2014 // /*--------------------------------*/ -private ["_object","_objectSnapGizmo","_objColorActive","_objColorInactive","_classname","_whitelist","_points","_cfg","_cnt","_pos","_findWhitelisted","_nearbyObject","_posNearby","_selectedAction","_newPos","_pointsNearby","_onWater"]; +private ["_object","_objectSnapGizmo","_objColorActive","_objColorInactive","_classname","_whitelist","_points","_radius","_cfg","_cnt","_pos","_findWhitelisted","_nearbyObject","_posNearby","_selectedAction","_newPos","_pointsNearby","_onWater"]; //Args snapActionState = _this select 3 select 0; _object = _this select 3 select 1; @@ -15,6 +15,7 @@ _selectedAction = _this select 3 select 4; _cfg = (configFile >> "SnapBuilding" >> _classname); _whitelist = getArray (_cfg >> "snapTo"); _points = getArray (_cfg >> "points"); +_radius = getNumber (_cfg >> "radius"); //colors _objColorActive = "#(argb,8,8,3)color(0,0.92,0.06,1,ca)"; @@ -58,7 +59,7 @@ fnc_initSnapPoints = { fnc_initSnapPointsNearby = { _pos = getPosATL _object; _findWhitelisted = []; _pointsNearby = []; - _findWhitelisted = nearestObjects [_pos,_whitelist,10]-[_object]; + _findWhitelisted = nearestObjects [_pos,_whitelist,_radius]-[_object]; snapGizmosNearby = []; { _nearbyObject = _x;