From b95b845b9adf5e861c8f6e1236f0b0f76270a65a Mon Sep 17 00:00:00 2001 From: He-Man Date: Sun, 9 Jul 2017 20:57:08 +0200 Subject: [PATCH 1/3] Fixed flip storages above Water --- Sources/epoch_code/compile/EPOCH_onEachFrame.sqf | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Sources/epoch_code/compile/EPOCH_onEachFrame.sqf b/Sources/epoch_code/compile/EPOCH_onEachFrame.sqf index 1a7da556..ba07f88d 100644 --- a/Sources/epoch_code/compile/EPOCH_onEachFrame.sqf +++ b/Sources/epoch_code/compile/EPOCH_onEachFrame.sqf @@ -24,9 +24,20 @@ if (EPOCH_velTransform) then { EPOCH_target setvelocitytransformation[_pos1, (EP_velocityTransformation select 0), _vel1, (EP_velocityTransformation select 1), _dir1, (EP_velocityTransformation select 2), _up1, (EP_velocityTransformation select 3), _interval]; } else { _pos2 = player modelToWorld[EPOCH_X_OFFSET, EPOCH_Y_OFFSET, EPOCH_Z_OFFSET]; + _CfgEpochClient = 'CfgEpochClient' call EPOCH_returnConfig; + _maxBuildingHeight = getNumber(_CfgEpochClient >> "maxBuildingHeight"); + if !(_maxBuildingHeight == 0) then { + if (_pos2 select 2 > _maxBuildingHeight) then { + _pos2 set[2, _maxBuildingHeight]; + }; + }; if ((_pos2 select 2) < 0) then { _pos2 set[2, 0] }; if ((_pos1 distance _pos2) > 0) then { - EPOCH_target setvelocitytransformation[_pos1, AGLtoASL _pos2, _vel1, _vel1, _dir1, _dir1, _up1, _up1, _interval]; + _newpos = AGLtoASL _pos2; + if (surfaceiswater _pos2) then { + _newpos = _pos2; + }; + EPOCH_target setvelocitytransformation[_pos1, _newpos, _vel1, _vel1, _dir1, _dir1, _up1, _up1, _interval]; }; }; } else { From 3539a437340fe7a493e5dc3d424576c74fb9c038 Mon Sep 17 00:00:00 2001 From: He-Man Date: Sun, 9 Jul 2017 21:08:00 +0200 Subject: [PATCH 2/3] Fixed flip Storages, added height-check --- .../compile/building/EPOCH_simulSwap.sqf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 { From 96b4a3367743da3a407aae0bc1a590f652b1d496 Mon Sep 17 00:00:00 2001 From: He-Man Date: Sun, 9 Jul 2017 21:34:32 +0200 Subject: [PATCH 3/3] Fixed flip storages, added height check --- Sources/epoch_code/compile/building/EPOCH_simulSwap.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/epoch_code/compile/building/EPOCH_simulSwap.sqf b/Sources/epoch_code/compile/building/EPOCH_simulSwap.sqf index 844918d9..ab136e1a 100644 --- a/Sources/epoch_code/compile/building/EPOCH_simulSwap.sqf +++ b/Sources/epoch_code/compile/building/EPOCH_simulSwap.sqf @@ -22,7 +22,7 @@ NOTHING */ //[[[cog import generate_private_arrays ]]] -private ["_allowedSnapObjects","_allowedSnapPoints","_cfgBaseBuilding","_class","_create","_currentTarget","_dir2","_direction","_disallowed","_distance","_distanceMod","_distanceNear","_energyCost","_isSnap","_lastCheckTime","_nearestObject","_nearestObjectRaw","_newObj","_objSlot","_objType","_object","_oemType","_offset","_onContactEH","_pOffset","_playerdistance","_pos2","_prevSnapDistance","_previousDistanceNear","_rejectMove","_removeParts","_return","_simulClassConfig","_snapArrayPara","_snapArrayPerp","_snapDistance","_snapObjects","_snapPointsPara","_snapPointsPerp","_snapPos","_snapPosition","_snapType","_textureSlot","_up2","_vel2","_velocityTransformation","_worldspace"]; +private ["_maxBuildingHeight","_CfgEpochClient","_maxHeight","_allowedSnapObjects","_allowedSnapPoints","_cfgBaseBuilding","_class","_create","_currentTarget","_dir2","_direction","_disallowed","_distance","_distanceMod","_distanceNear","_energyCost","_isSnap","_lastCheckTime","_nearestObject","_nearestObjectRaw","_newObj","_objSlot","_objType","_object","_oemType","_offset","_onContactEH","_pOffset","_playerdistance","_pos2","_prevSnapDistance","_previousDistanceNear","_rejectMove","_removeParts","_return","_simulClassConfig","_snapArrayPara","_snapArrayPerp","_snapDistance","_snapObjects","_snapPointsPara","_snapPointsPerp","_snapPos","_snapPosition","_snapType","_textureSlot","_up2","_vel2","_velocityTransformation","_worldspace"]; //[[[end]]] if !(isNil "EPOCH_simulSwap_Lock") exitWith{};