Forráskód Böngészése

Merge pull request #163 from 501st-Aux-Mod-Team/feature-impulse-improvement

impulse improvments
Erliens 4 éve
szülő
commit
e92642976f

+ 6 - 7
addons - Copy/RD501_Main/functions/impulse/fnc_impulseApply.sqf

@@ -54,8 +54,7 @@ if (!_accelerate && !_decelerate) exitWith{};
 while {_vehicle getVariable ['impulsorStatus', 0] isEqualTo _impulse_state && alive _vehicle} do
 {
 	private _movement = velocity _vehicle;
-	private _velocity = sqrt ((_movement select 0) * (_movement select 0) + (_movement select 1) * (_movement select 1));
-	_velocity = _velocity * 3.6; // m/s -> kp/h
+	private _velocity = speed _vehicle;
 	private _diff = _target_speed - _velocity;
 	private _change = 0;
 	
@@ -76,14 +75,14 @@ while {_vehicle getVariable ['impulsorStatus', 0] isEqualTo _impulse_state && al
 		_change = 0;
 	};
 
-	//systemChat format ["%1 - %2 - %3 - %4 - %5", str _velocity, str _target_speed, str _diff, str _max_change, str _change];
+	// systemChat format ["%1 - %2 - %3 - %4 - %5", str _velocity, str _target_speed, str _diff, str _max_change, str _change];
 
 	if (_change != 0) then {
-		_direction = direction _vehicle;
+		private _direction = vectorDir _vehicle;
 		_vehicle setVelocity [
-			(_movement select 0) + (sin _direction * _change), 
-			(_movement select 1) + (cos _direction * _change), 
-			(_movement select 2)
+			(_movement select 0) + (_direction select 0) * _change, 
+			(_movement select 1) + (_direction select 1) * _change, 
+			(_movement select 2) + (_direction select 2) * _change
 			];
 	};
 	sleep 0.5;

+ 1 - 0
addons - Copy/RD501_Main/functions/impulse/fnc_impulseIncrease.sqf

@@ -3,6 +3,7 @@ _vehicle = _this;
 //systemChat "increase";
 
 private _impulse_state = _vehicle getvariable ["impulsorStatus", 0];
+if (speed _this < 10 && _impulse_state != -1) exitWith {};
 _impulse_state = _impulse_state + 1;
 if (_impulse_state > 2) then
 {

+ 2 - 2
addons - Copy/RD501_Vehicles/air/LAAT/user_action.hpp

@@ -8,7 +8,7 @@
 		radius = 20;
 		priority = 21;
 		onlyForPlayer = 1;
-		condition = "((player == driver this) AND (alive this) AND (speed this >10) )";
+		condition = "((player == driver this) AND (alive this))";
 		statement = "this execVM ""\RD501_Main\functions\impulse\fnc_impulseIncrease.sqf""";
 	};
 
@@ -31,7 +31,7 @@
 		radius = 20;
 		priority = 0;
 		onlyForPlayer = 1;
-		condition = "((player == driver this) AND (alive this) AND (speed this >10) )";
+		condition = "((player == driver this) AND (alive this))";
 		statement = "this execVM ""\RD501_Main\functions\impulse\fnc_impulseIncrease.sqf""";
 		shortcut="User19"
 	};