Fix DZE_BuildLimit check

NearObjects "All" counts things like local plot markers, weapon holders,
ambient life, etc. We only want to count buildables. The radius should
also start at the plot pole if available, not the player position.

Thanks to Epoch forums user jOoPs for pointing this out. I will fix this
in modular_build.sqf too.

Tested and confirmed working.
This commit is contained in:
ebaydayz
2016-03-02 17:03:47 -05:00
parent 959507bfc7
commit 78e193d7c4
2 changed files with 10 additions and 6 deletions

View File

@@ -54,6 +54,7 @@
[FIXED] Toilet paper dupe exploit when building outhouse @Markokil321 @ebaydayz #1599
[FIXED] Safes and lockboxes wiped when opening after restart and locking not being logged to RPT @ebaydayz #1413 #1503
[FIXED] Duplicate objectUIDs occasionally causing vehicles to swap classes or be deleted across restarts @ebaydayz #1504
[FIXED] DZE_BuildingLimit now counts buildables only instead of all object types. Thanks jOoPs @ebaydayz
[UPDATED] .hpp files updated in dayz_epoch_b CfgLootPos > CfgBuildingPos. @Uro1
[UPDATED] .bat files updated in Config-Examples @Raziel23x

View File

@@ -2,13 +2,11 @@
DayZ Base Building
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
*/
private ["_location","_pos","_dir","_classname","_item","_hasrequireditem","_missing","_hastoolweapon","_cancel","_reason","_started","_finished","_animState","_isMedic","_dis","_sfx","_hasbuilditem","_tmpbuilt","_onLadder","_isWater","_require","_text","_offset","_IsNearPlot","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_canBuildOnPlot","_friendlies","_nearestPole","_ownerID","_findNearestPoles","_findNearestPole","_distance","_classnametmp","_ghost","_isPole","_needText","_lockable","_zheightchanged","_rotate","_combination_1","_combination_2","_combination_3","_combination_4","_combination","_combination_1_Display","_combinationDisplay","_zheightdirection","_abort","_isNear","_need","_needNear","_vehicle","_inVehicle","_requireplot","_objHDiff","_isLandFireDZ","_isTankTrap"];
private ["_location","_pos","_dir","_classname","_item","_hasrequireditem","_missing","_hastoolweapon","_cancel","_reason","_started","_finished","_animState","_isMedic","_dis","_sfx","_hasbuilditem","_tmpbuilt","_onLadder","_isWater","_require","_text","_offset","_IsNearPlot","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_canBuildOnPlot","_friendlies","_nearestPole","_ownerID","_findNearestPoles","_findNearestPole","_distance","_classnametmp","_ghost","_isPole","_needText","_lockable","_zheightchanged","_rotate","_combination_1","_combination_2","_combination_3","_combination_4","_combination","_combination_1_Display","_combinationDisplay","_zheightdirection","_abort","_isNear","_need","_needNear","_vehicle","_inVehicle","_requireplot","_objHDiff","_isLandFireDZ","_isTankTrap","_center","_buildables"];
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_40") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;
_pos = [player] call FNC_GetPos;
// disallow building if too many objects are found within 30m
if((count (_pos nearObjects ["All",30])) >= DZE_BuildingLimit) exitWith {DZE_ActionInProgress = false; cutText [(format [localize "str_epoch_player_41", DZE_PlotPole select 0]), "PLAIN DOWN"];};
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_isWater = dayz_isSwimming;
@@ -137,7 +135,7 @@ _findNearestPole = [];
_IsNearPlot = count (_findNearestPole);
// If item is plot pole && another one exists within 45m
if(_isPole && _IsNearPlot > 0) exitWith { DZE_ActionInProgress = false; cutText [(format [localize "str_epoch_player_44", DZE_PlotPole select 1]) , "PLAIN DOWN"]; };
if(_isPole && _IsNearPlot > 0) exitWith { DZE_ActionInProgress = false; cutText [(format [localize "str_epoch_player_44",_distance]), "PLAIN DOWN"]; };
if(_IsNearPlot == 0) then {
@@ -147,9 +145,9 @@ if(_IsNearPlot == 0) then {
};
} else {
// Since there are plots nearby we check for ownership && then for friend status
// Since there are plots nearby we check for ownership and then for friend status
// check nearby plots ownership && then for friend status
// check nearby plots ownership and then for friend status
_nearestPole = _findNearestPole select 0;
// Find owner
@@ -179,6 +177,11 @@ if(_IsNearPlot == 0) then {
// _message
if(!_canBuildOnPlot) exitWith { DZE_ActionInProgress = false; cutText [format[(localize "STR_EPOCH_PLAYER_135"),_needText,_distance] , "PLAIN DOWN"]; };
_buildables = DZE_maintainClasses + DZE_LockableStorage;
_buildables set [count _buildables,"TentStorage"];
_center = if (isNil "_nearestPole") then {_pos} else {_nearestPole};
if ((count (nearestObjects [_center,_buildables,_distance])) >= DZE_BuildingLimit) exitWith {DZE_ActionInProgress = false;cutText [(format [localize "str_epoch_player_41",_distance]),"PLAIN DOWN"];};
_missing = "";
_hasrequireditem = true;
{