Merge pull request #777 from Ignatz-HeMan/patch-6

Fixed flip storage, added building height check
This commit is contained in:
vbawol 2017-07-12 09:25:28 -05:00 committed by GitHub
commit 078014cd72
2 changed files with 28 additions and 2 deletions

View File

@ -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 {

View File

@ -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{};
@ -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 {