From f15db730728aa209b6dd6c19659964dc3f3173fc Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Tue, 27 Sep 2016 17:15:43 -0400 Subject: [PATCH] Update vanilla player_build Vanilla commits: https://github.com/DayZMod/DayZ/commit/f1e12509e13904a6253c3cd3a5b6b0d1ee01d0d1 https://github.com/DayZMod/DayZ/commit/ce98e0b1d5f78d871a3c7f4feecdfbcd85381f9d --- SQF/dayz_code/actions/object_build.sqf | 9 ++++++++- SQF/dayz_code/actions/player_buildVanilla.sqf | 16 +++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/SQF/dayz_code/actions/object_build.sqf b/SQF/dayz_code/actions/object_build.sqf index e753d624b..6dd827799 100644 --- a/SQF/dayz_code/actions/object_build.sqf +++ b/SQF/dayz_code/actions/object_build.sqf @@ -41,8 +41,12 @@ if (_build) then { [player,_sfx,0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] call player_alertZombies; ["Working",0,[20,40,15,0]] call dayz_NutritionSystem; // Added Nutrition-Factor for work + player playActionNow "Medic"; - uiSleep 5; + + //wait animation end + waitUntil {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "disableWeapons") == 1}; + waitUntil {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "disableWeapons") == 0}; _object setPosATL _location; player reveal _object; @@ -56,6 +60,9 @@ if (_build) then { _variables set [ count _variables, ["ownerArray", [getPlayerUID player]]]; _variables set [ count _variables, ["padlockCombination", _passcode]]; + + _object removeAllEventHandlers "HandleDamage"; + _object addeventhandler ["HandleDamage",{ diag_log (_this); if ((_this select 4) == 'PipeBomb') then { _this call fnc_Obj_FenceHandleDam; } else { false }; } ]; }; _object setVariable ["characterID",dayz_characterID, true]; diff --git a/SQF/dayz_code/actions/player_buildVanilla.sqf b/SQF/dayz_code/actions/player_buildVanilla.sqf index 2ad97f07d..c4ec31dc5 100644 --- a/SQF/dayz_code/actions/player_buildVanilla.sqf +++ b/SQF/dayz_code/actions/player_buildVanilla.sqf @@ -6,6 +6,7 @@ private ["_classType","_item","_action","_missingTools","_missingItem","_emergin "_roadCollide","_checkBeam2Magnet","_a","_beams","_best","_b","_d","_checkNotBuried","_elevation","_position","_delta","_overElevation", "_maxplanting","_safeDistance","_dir","_angleRef","_tmp","_actionCancel","_sfx","_actionBuild","_byPassChecks","_keepOnSlope","_msg", "_isCollisionBypass","_ok","_missing","_upgradeParts","_ownerID","_posReference"]; + /* Needs a full rewrite to keep up with the demand of everything we plan to add. */ @@ -188,6 +189,16 @@ _checkBuildingCollision = local _wall = _object isKindOf "DZ_buildables"; + //Make sure no one can build within 6 meters of someone elses walls. Also block placement from anyone from the model origin. + if (_wall && { + local _result = false; + { + if (_x != _object && { _x distance _object < 1.5 || { _x getVariable ["ownerArray", [""]] select 0 != getPlayerUID player } } ) exitWith + { _objColliding = _x; _result = true; }; + } foreach (nearestObjects [_object, ["DZ_buildables"], 6]); + _result + }) exitWith {}; + //Load object collision points local _points = []; _points resize _count; @@ -214,8 +225,7 @@ _checkBuildingCollision = breakTo "root"; }; }; - } - foreach lineIntersectsWith [_points select _p1, _points select _p2, _object, player]; + } foreach lineIntersectsWith [_points select _p1, _points select _p2, _object, player]; }; } foreach getArray (configFile >> "CfgVehicles" >> _ghost >> "buildCollisionPaths"); }; @@ -310,7 +320,7 @@ while {dayz_actionInProgress and Dayz_constructionContext select 4} do { _object setDir _angleRef; _tmp = player modelToWorld [0, _safeDistance,0]; - if (Dayz_constructionContext select 5 or _keepOnSlope) then { + if ((Dayz_constructionContext select 5) or (_keepOnSlope)) then { _tmp set [2, 0]; _object setVectorUp surfaceNormal _tmp; }