Fix DZE_BuildHeightLimit behavior

Corrections for #1988
@BigEgg17 abs(_objHDiff) only tells you how much you have raised the
ghost from where it was when you started building. To test the actual
height above ground or sea level you need to use _position select 2.

Say DZE_BuildHeightLimit was 60m and DZE_buildMaxMoveDistance was 20m.
If the player started building at 55m and then raised the object 20m,
they would be allowed to build at 75m with your check.

Also getPosATL should not be used here. For example, I am swimming on
the surface of the water on Napf and getPosATL returns a height of 29m.

@oiad you missed zombie_wildGenerate.sqf in #1987
This commit is contained in:
ebayShopper
2017-11-14 13:09:15 -05:00
parent c1110fc61c
commit 14a6252911
4 changed files with 11 additions and 3 deletions

View File

@@ -358,7 +358,7 @@ if (_canBuild select 0) then {
deleteVehicle _objectHelper;
};
if (DZE_BuildHeightLimit > 0 && abs(_objHDiff) > DZE_BuildHeightLimit) exitWith {
if (DZE_BuildHeightLimit > 0 && {_position select 2 > DZE_BuildHeightLimit}) exitWith {
_isOk = false;
_cancel = true;
_reason = format[localize "STR_EPOCH_PLAYER_168",DZE_BuildHeightLimit];

View File

@@ -262,6 +262,14 @@ if (_canBuild select 0) then {
detach _object;
deleteVehicle _object;
};
if (DZE_BuildHeightLimit > 0 && {_position select 2 > DZE_BuildHeightLimit}) exitWith {
_isOk = false;
_cancel = true;
_reason = format[localize "STR_EPOCH_PLAYER_168",DZE_BuildHeightLimit];
detach _object;
deleteVehicle _object;
};
if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {
_isOk = false;

View File

@@ -98,7 +98,7 @@ if (!_canBuild) exitWith {
[_canBuild, _isPole];
};
if (DZE_BuildHeightLimit > 0 && ((getPosATL (vehicle player)) select 2) > DZE_BuildHeightLimit) exitWith {dayz_actionInProgress = false; format [localize "STR_EPOCH_PLAYER_168", DZE_BuildHeightLimit] call dayz_rollingMessages; [false, _isPole];};
if (DZE_BuildHeightLimit > 0 && {([player] call fnc_getPos) select 2 > DZE_BuildHeightLimit}) exitWith {dayz_actionInProgress = false; format[localize "STR_EPOCH_PLAYER_168",DZE_BuildHeightLimit] call dayz_rollingMessages; [false, _isPole];};
// Also count safes, lockboxes, vanilla buildables, tents and stashes against DZE_BuildingLimit
_buildables = DZE_maintainClasses + DZE_LockableStorage + ["DZ_buildables","DZ_storage_base"];

View File

@@ -17,7 +17,7 @@ while {_counter < _amount} do {
_method = "CAN_COLLIDE";
_position = [getMarkerPos "center",1,6500,1] call fn_selectRandomLocation;
if(_position call DZE_SafeZonePosCheck) exitWith {};
if ([_position] call DZE_SafeZonePosCheck) exitWith {};
//Create Zed
_agent = createAgent [_type, _position, [], 1, _method];
//Set Random Direction