dze_BuildChecks changes

This changes the reasons to be more understandable about why you can't
build somewhere.
Some localization fixes to be more englishy.
This commit is contained in:
oiad
2016-10-08 12:53:25 +13:00
parent 5bc36166a7
commit 78fac87333
2 changed files with 26 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
//Checks if item is near a plot, if the player is plot owner or friendly, if there are too many items, and if the player has required tools
private ["_requireplot","_distance","_canBuild","_friendlies","_nearestPole","_ownerID","_pos","_item","_classname","_isPole","_isLandFireDZ","_needText","_findNearestPoles","_findNearestPole","_IsNearPlot","_buildables","_center"];
private ["_requireplot","_distance","_canBuild","_friendlies","_nearestPole","_ownerID","_pos","_item","_classname","_isPole","_isLandFireDZ","_findNearestPoles","_findNearestPole","_IsNearPlot","_buildables","_center","_toolCheck","_plotcheck","_buildcheck","_isfriendly","_isowner","_require"];
_pos = _this select 0;
_item = _this select 1;
@@ -9,33 +9,31 @@ _requireplot = DZE_requireplot;
// "Unable to build trader nearby."
if (!canbuild) exitWith {dayz_actionInProgress = false; format[localize "STR_EPOCH_PLAYER_136",localize "STR_EPOCH_TRADER"] call dayz_rollingMessages; [false, false];};
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "requireplot")) then {
if (isNumber (configFile >> "CfgVehicles" >> _classname >> "requireplot")) then {
_requireplot = getNumber(configFile >> "CfgVehicles" >> _classname >> "requireplot");
};
_isPole = (_classname == "Plastic_Pole_EP1_DZ");
_isLandFireDZ = (_classname == "Land_Fire_DZ");
_needText = localize "str_epoch_player_246";
_distance = if (_isPole) then {DZE_PlotPole select 1} else {DZE_PlotPole select 0};
_canBuild = false;
_nearestPole = objNull;
_ownerID = 0;
_friendlies = [];
_needText = localize "str_epoch_player_246";
_plotcheck = [player, false] call FNC_find_plots;
_IsNearPlot = _plotcheck select 1;
_nearestPole = _plotcheck select 2;
if(_isPole && {_IsNearPlot > 0}) exitWith {dayz_actionInProgress = false; format[localize "str_epoch_player_44",_distance] call dayz_rollingMessages; [_canBuild, _isPole];};
if (_isPole && {_IsNearPlot > 0}) exitWith {dayz_actionInProgress = false; format[localize "str_epoch_player_44",_distance] call dayz_rollingMessages; [_canBuild, _isPole];};
if(_IsNearPlot == 0) then {
if (_IsNearPlot == 0) then {
if (_requireplot == 0 || {_isLandFireDZ}) then {
_canBuild = true;
};
} else {
_ownerID = _nearestPole getVariable["CharacterID","0"];
if(dayz_characterID == _ownerID) then {
if (dayz_characterID == _ownerID) then {
_canBuild = true;
} else {
if (DZE_permanentPlot) then {
@@ -54,7 +52,16 @@ if(_IsNearPlot == 0) then {
};
};
if(!_canBuild) exitWith { dayz_actionInProgress = false; format[localize "STR_EPOCH_PLAYER_135",_needText,_distance] call dayz_rollingMessages; [_canBuild, _isPole];};
if (!_canBuild) exitWith {
dayz_actionInProgress = false;
if (_isNearPlot == 0) then {
format[localize "STR_EPOCH_PLAYER_135",localize "str_epoch_player_246",_distance] call dayz_rollingMessages;
} else {
localize "STR_EPOCH_PLAYER_134" call dayz_rollingMessages;
};
[_canBuild, _isPole];
};
// Also count safes, lockboxes, vanilla buildables, tents and stashes against DZE_BuildingLimit
_buildables = DZE_maintainClasses + DZE_LockableStorage + ["DZ_buildables","DZ_storage_base"];
_center = if (isNull _nearestPole) then {_pos} else {_nearestPole};
@@ -67,4 +74,4 @@ if (_toolCheck) then {
};
//When calling this function in another script use a silent exitWith, unless you have something special to say. i.e. if (!(_canBuild select 0)) exitWith{};
[_canBuild, _isPole];
[_canBuild, _isPole];