From 897653f8eedd30c1bc9cd94bac9db948aeb1af73 Mon Sep 17 00:00:00 2001 From: He-Man <Nullimeyer@yahoo.de> Date: Mon, 24 Oct 2016 22:53:26 +0200 Subject: [PATCH] Update EPOCH_upgradeBUILD.sqf This was missing in my Changes for Building restrictions. With this, the Configs "maxdoors" and "maxgates" are useable. --- .../compile/building/EPOCH_upgradeBUILD.sqf | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Sources/epoch_code/compile/building/EPOCH_upgradeBUILD.sqf b/Sources/epoch_code/compile/building/EPOCH_upgradeBUILD.sqf index 4001a52b..0dd45fde 100644 --- a/Sources/epoch_code/compile/building/EPOCH_upgradeBUILD.sqf +++ b/Sources/epoch_code/compile/building/EPOCH_upgradeBUILD.sqf @@ -83,6 +83,10 @@ if (_object isKindOf "Constructions_static_F") then { // take upgrade item from player here _config = 'CfgBaseBuilding' call EPOCH_returnConfig; + _config2 = 'CfgEpochClient' call EPOCH_returnConfig; + _buildingJammerRange = getNumber(_config2 >> "buildingJammerRange"); + _maxdoors = getNumber(_config2 >> "maxdoors"); + _maxgates = getNumber(_config2 >> "maxgates"); _upgrades = getArray(_config >> (typeOf _object) >> "upgradeBuilding"); if !(_upgrades isEqualTo []) then { @@ -108,6 +112,26 @@ if (_object isKindOf "Constructions_static_F") then { }; _canUpgradePartCount = _canUpgradePartCount + _req; } forEach _upgradeParts; + + _doors = ["WoodLargeWallDoorL_EPOCH","WoodWall4_EPOCH"]; + _gates = ["CinderWallGarage_EPOCH"]; + if (_canUpgrade) then { + _upgradeto = _upgrade select 0; + if (_upgradeto in _doors) then { + _countdoors = count (nearestobjects [_nearestJammer,_doors,_buildingJammerRange]); + if (_countdoors >= _maxdoors) then { + _canUpgrade = false; + _missingParts = _missingParts + format["Can not upgrade to locked Door! Max %1 allowed per Base!", _maxdoors]; + }; + }; + if (_upgradeto in _gates) then { + _countgates = count (nearestobjects [_nearestJammer,_gates,_buildingJammerRange]); + if (_countgates >= _maxgates) then { + _canUpgrade = false; + _missingParts = _missingParts + format["Can not upgrade to Gate! Max %1 allowed per Base!", _maxgates]; + }; + }; + }; _removedPartCount = 0; if (_canUpgrade) then {