Lou Montana/Sandbox – User

From Bohemia Interactive Community
< User:Lou Montana
Revision as of 00:01, 2 October 2019 by Lou Montana (talk | contribs) (Add Vehicles Speed and Fuel Stats prototype)
Jump to navigation Jump to search


Vehicles Speed and Fuel Stats

Class Name Full tank consumption time Speed
Idle slow speed medium speed max speed slow speed medium speed max speed
B_Truck_01_mover_F HEMTT 05:18:00 03:15:00 03:38:00 03:18:00 026,83 km/h 070,94 km/h 082,85 km/h
B_MRAP_01_F Hunter (unarmed) 04:33:00 02:47:00 01:56:00 01:44:00 037,13 km/h 099,81 km/h 116,45 km/h
B_LSV_01_unarmed_F Prowler (unarmed) 04:09:00 01:38:00 01:50:00 01:38:00 053,96 km/h 147,06 km/h 172,47 km/h
B_Quadbike_01_F Quad 01:54:00 01:09:00 01:12:00 01:06:00 027,14 km/h 070,77 km/h 082,20 km/h
B_APC_Tracked_01_AA_F IFV-6a Cheetah 03:11:00 02:07:00 02:14:00 01:56:00 023,31 km/h 046,31 km/h 061,07 km/h
B_APC_Wheeled_01_cannon_F AMV-7 Marshall 04:55:00 02:58:00 02:58:00 02:34:00 036,20 km/h 060,41 km/h 113,00 km/h
B_APC_Tracked_01_CRV_F CRV-6e Bobcat 03:11:00 02:05:00 02:13:00 01:55:00 023,31 km/h 046,31 km/h 061,07 km/h

Code used:

veh = vehicle player;
wantedDelta = 3;

previousPos = [0,0,0];
currentPos = [0,0,0];
previousFuel = 0;
currentFuel = 0;
t = 0;

onEachFrame {
	isNil {
		vehSpeed = speed veh;

		if (t <= time) then {
			previousPos = currentPos;
			currentPos = getPosATL veh;
			distanceDelta = currentPos distance previousPos;
			previousFuel = currentFuel;
			currentFuel = fuel veh;

			fuelLossPerMinute = (previousFuel - currentFuel) * (60 / (wantedDelta + (time - t)));

			remainingTime = if (fuelLossPerMinute > 0) then {
				 [(currentFuel / fuelLossPerMinute) * 60, "HH:MM:SS"] call BIS_fnc_secondsToString;
			} else { -1 };

			timeToEmpty = if (fuelLossPerMinute > 0) then {
				 [(1 / fuelLossPerMinute) * 60, "HH:MM:SS"] call BIS_fnc_secondsToString;
			} else { -1 };

			t = time + wantedDelta;
		};

		hintSilent format [
			"Speed: %1\nFuel loss: %2\n\nRemaining time: %3\nTime to empty: %4",
			vehSpeed,
			fuelLossPerMinute,
			remainingTime,
			timeToEmpty];

		copyToClipboard format ["[%1, %2, %3]", typeOf veh, timeToEmpty, vehSpeed];
	};
};
↑ Back to spoiler's top