From 2889d8f010e2373821c1d799a9675405809bcf65 Mon Sep 17 00:00:00 2001 From: icomrade Date: Wed, 18 May 2016 11:01:38 -0400 Subject: [PATCH] Should fix building issues with player sliding The change in module_build will only fix items that d ono have an offset set in the config. BoundingBox can be a bit generous but the player should be able to work with any overestimation in size. --- SQF/dayz_code/Configs/CfgVehicles/DZE/Prop_Defs.hpp | 2 +- SQF/dayz_code/actions/modular_build.sqf | 7 ++++--- SQF/dayz_code/actions/player_build.sqf | 7 ++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/SQF/dayz_code/Configs/CfgVehicles/DZE/Prop_Defs.hpp b/SQF/dayz_code/Configs/CfgVehicles/DZE/Prop_Defs.hpp index 3909563c6..d55de8cf1 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/DZE/Prop_Defs.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/DZE/Prop_Defs.hpp @@ -624,7 +624,7 @@ class Wooden_shed_DZ: Land_Shed_wooden scope = public; destrType = "DestructBuilding"; //cost = 100; - offset[] = {0,2.5,1}; + offset[] = {0,3,1}; armor = 800; displayName = "Wooden Shed"; vehicleClass = "Fortifications"; diff --git a/SQF/dayz_code/actions/modular_build.sqf b/SQF/dayz_code/actions/modular_build.sqf index 0ad1e0531..207abf03a 100644 --- a/SQF/dayz_code/actions/modular_build.sqf +++ b/SQF/dayz_code/actions/modular_build.sqf @@ -106,9 +106,6 @@ if (_canBuild select 0) then { }; _offset = getArray (configFile >> "CfgVehicles" >> _classname >> "offset"); //check default distance offset, define if does not exist - if((count _offset) <= 0) then { - _offset = [0,1.5,0]; - }; _objectHelper = objNull; _isOk = true; @@ -122,6 +119,10 @@ if (_canBuild select 0) then { _object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"]; //object preview, not an actual object that will be built + if((count _offset) <= 0) then { + _offset = [0,(abs(((boundingBox _object)select 0) select 1)),0]; + }; + _objectHelper = "Sign_sphere10cm_EP1" createVehicle [0,0,0]; _helperColor = "#(argb,8,8,3)color(0,0,0,0,ca)"; _objectHelper setobjecttexture [0,_helperColor]; diff --git a/SQF/dayz_code/actions/player_build.sqf b/SQF/dayz_code/actions/player_build.sqf index 53246dfce..9952e80bf 100644 --- a/SQF/dayz_code/actions/player_build.sqf +++ b/SQF/dayz_code/actions/player_build.sqf @@ -108,9 +108,6 @@ if (_canBuild select 0) then { }; _offset = getArray (configFile >> "CfgVehicles" >> _classname >> "offset"); - if((count _offset) <= 0) then { - _offset = [0,1.5,0]; - }; _location = [0,0,0]; _isOk = true; @@ -124,6 +121,10 @@ if (_canBuild select 0) then { _object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"]; + if((count _offset) <= 0) then { + _offset = [0,(abs(((boundingBox _object)select 0) select 1)),0]; + }; + _object attachTo [player,_offset]; _position = getPosATL _object;