diff --git a/Sources/epoch_code/compile/building/EPOCH_simulSwap.sqf b/Sources/epoch_code/compile/building/EPOCH_simulSwap.sqf index 3dc7b58a..844918d9 100644 --- a/Sources/epoch_code/compile/building/EPOCH_simulSwap.sqf +++ b/Sources/epoch_code/compile/building/EPOCH_simulSwap.sqf @@ -56,9 +56,18 @@ if (isText(_simulClassConfig)) then { _allowedSnapObjects = ["Constructions_static_F"]; _snapObjects = _cfgBaseBuilding >> _class >> "allowedSnapObjects"; _energyCost = getNumber(_cfgBaseBuilding >> _class >> "energyCost"); + _maxHeight = getNumber(_cfgBaseBuilding >> _class >> "maxHeight"); if (_energyCost == 0) then { _energyCost = 0.1; }; + if (_maxHeight == 0) then { + _maxHeight = 500; + }; + _CfgEpochClient = 'CfgEpochClient' call EPOCH_returnConfig; + _maxBuildingHeight = getNumber(_CfgEpochClient >> "maxBuildingHeight"); + if !(_maxBuildingHeight == 0) then { + _maxHeight = _maxHeight min _maxBuildingHeight; + }; if (isArray(_snapObjects)) then { _allowedSnapObjects = getArray(_snapObjects); }; @@ -90,6 +99,9 @@ if (isText(_simulClassConfig)) then { EP_snap = objNull; _previousDistanceNear = 0; _offset = player worldToModel (getposATL _currentTarget); + if (surfaceiswater (getpos _currentTarget)) then { + _offset = player worldToModel (getposASL _currentTarget); + }; EPOCH_X_OFFSET = _offset select 0; EPOCH_Y_OFFSET = _offset select 1; EPOCH_Z_OFFSET = _offset select 2; @@ -115,6 +127,9 @@ if (isText(_simulClassConfig)) then { }; _pos2 = player modelToWorld[EPOCH_X_OFFSET, EPOCH_Y_OFFSET, EPOCH_Z_OFFSET]; + if (_pos2 select 2 > _maxHeight) then { + _pos2 set[2, _maxHeight]; + }; _distance = _pos2 distance EPOCH_target; if (EPOCH_buildMode == 1) then { if (isNull _nearestObject) then {