diff --git a/core.liberation/R3F_LOG/fonctions_generales/lib_geometrie_3D.sqf b/core.liberation/R3F_LOG/fonctions_generales/lib_geometrie_3D.sqf index 25df1e2a2..4f61d00cd 100644 --- a/core.liberation/R3F_LOG/fonctions_generales/lib_geometrie_3D.sqf +++ b/core.liberation/R3F_LOG/fonctions_generales/lib_geometrie_3D.sqf @@ -544,7 +544,7 @@ R3F_LOG_FNCT_3D_tirer_position_degagee_sol = { "_rayon_degage", "_pos_centre", "_rayon_max", - ["_nb_tirages_max", 30], + ["_nb_tirages_max", 50], ["_eau_autorise", false] ]; private ["_nb_tirages", "_objets_genants", "_position_degagee", "_rayon_curr", "_angle_curr", "_intersect"]; @@ -575,9 +575,10 @@ R3F_LOG_FNCT_3D_tirer_position_degagee_sol = { } forEach ([_position_degagee, _rayon_degage] call R3F_LOG_FNCT_3D_get_objets_genants_rayon); // Verifier intersec avec building / rocks - private _maxpos = ATLtoASL (_position_degagee vectorAdd [0,0,30]); - if (lineIntersects [ATLtoASL _position_degagee, _maxpos]) then { _intersect = true }; - + private _minpos = ATLtoASL (_position_degagee vectorAdd [0,0,0.5]); + private _maxpos = (_minpos vectorAdd [0,0,30]); + if (lineIntersects [_minpos, _maxpos]) then { _intersect = true }; + if (count (nearestTerrainObjects [_position_degagee, ["ROCK", "TREE"], 20]) > 0) then { _intersect = true }; (_intersect && _nb_tirages < _nb_tirages_max) } }, diff --git a/core.liberation/scripts/shared/functions/F_fixPosUnit.sqf b/core.liberation/scripts/shared/functions/F_fixPosUnit.sqf index 35283986e..6cfdfe361 100644 --- a/core.liberation/scripts/shared/functions/F_fixPosUnit.sqf +++ b/core.liberation/scripts/shared/functions/F_fixPosUnit.sqf @@ -9,36 +9,37 @@ if (speed vehicle _unit > 1) exitWith {}; if (_unit getVariable ["GRLIB_in_building", false]) exitWith {}; private _spawnpos = getPosATL _unit; -private _curalt = _spawnpos select 2; -private _minalt = 5; -private _maxalt = 60; - -if (_curalt >= _maxalt) exitWith {}; if (surfaceIsWater _spawnpos) exitWith {}; +private _maxalt = 30; private _forest_type = ["forest", "wood"]; private _typepos = tolower (surfaceType getPosWorld _unit); private _forest = count (_forest_type select { (_typepos find _x) > -1 }); _forest = _forest + count (nearestTerrainObjects [_unit, ["Tree","Small Tree"], 6]); -if (_forest > 0) then { _minalt = 3 }; +if (_forest > 0) then { _maxalt = 3 }; private _obstacle = count (nearestTerrainObjects [_unit, ["House","Building"], 10]); -if (_obstacle > 0) then { _minalt = 2.3 }; - -private _minpos = ATLtoASL (_spawnpos vectorAdd [0,0,_minalt]); -private _maxpos = ATLtoASL (_spawnpos vectorAdd [0,0,_maxalt]); - -if (lineIntersects [ATLtoASL _spawnpos, _minpos, _unit]) then { - _unit allowDamage false; - while { (lineIntersects [ATLtoASL _spawnpos, _maxpos, _unit]) && _curalt < _maxalt } do { - _curalt = _curalt + 0.5; - _spawnpos set [2, _curalt]; - sleep 0.1; - }; - _unit setPosATL _spawnpos; - _unit switchMove "AmovPercMwlkSrasWrflDf"; - _unit playMoveNow "AmovPercMwlkSrasWrflDf"; - sleep 3; - _unit setHitPointDamage ["hitLegs", 0]; - _unit allowDamage true; +if (_obstacle > 0) then { _maxalt = 2.3 }; + +private _obstacle_rock = count (nearestTerrainObjects [_spawnpos, ["ROCK"], 20]); +if (_obstacle_rock > 0) then {_maxalt = 60 }; + +private _spawnpos = ATLtoASL (_spawnpos vectorAdd [0,0,0.5]); +private _maxpos = (_spawnpos vectorAdd [0,0,_maxalt]); +if !(lineIntersects [_spawnpos, _maxpos, _unit]) exitWith {}; + +private _curalt = _spawnpos select 2; +while { (lineIntersects [_spawnpos, _maxpos, _unit]) && _curalt < _maxalt } do { + _curalt = _curalt + 0.5; + _spawnpos set [2, _curalt]; + sleep 0.05; }; + +_unit allowDamage false; +_unit setPosASL _spawnpos; +sleep 3; +_unit switchMove "AmovPercMwlkSrasWrflDf"; +_unit playMoveNow "AmovPercMwlkSrasWrflDf"; +sleep 3; +_unit setHitPointDamage ["hitLegs", 0]; +_unit allowDamage true; diff --git a/core.liberation/scripts/shared/functions/F_forceCrew.sqf b/core.liberation/scripts/shared/functions/F_forceCrew.sqf index c83b23ece..c9a3f308f 100644 --- a/core.liberation/scripts/shared/functions/F_forceCrew.sqf +++ b/core.liberation/scripts/shared/functions/F_forceCrew.sqf @@ -72,7 +72,7 @@ private _grp = createGroup [_side, true]; sleep 0.1; } forEach _vehicle_roles; -(units _grp) joinSilent _grp; +(crew _vehicle) joinSilent _grp; (units _grp) allowGetIn true; (units _grp) orderGetIn true; (_grp) addVehicle _vehicle;