2015-02-08 23:35:21 +00:00
|
|
|
/*
|
2015-02-09 04:44:23 +00:00
|
|
|
* Author: PabstMirror (based on repack from commy2, esteldunedain, Ruthberg)
|
2015-02-08 23:35:21 +00:00
|
|
|
* Simulates repacking a set of magazines.
|
|
|
|
* Returns the timing and magazines counts at every stage.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Arguments [classname,lastAmmoStatus,events] <ARRAY>
|
|
|
|
* 1: Elapsed Time <NUMBER>
|
|
|
|
* 2: Total Time Repacking Will Take <NUMBER>
|
|
|
|
* 3: Error Code <NUMBER>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Nothing
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* (args from progressBar) call ace_magazinerepack_fnc_magazineRepackFinish
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-04-02 04:05:41 +00:00
|
|
|
private ["_structuredOutputText", "_picture", "_fullMags", "_partialMags", "_fullMagazineCount"];
|
|
|
|
|
2015-02-08 23:35:21 +00:00
|
|
|
PARAMS_4(_args,_elapsedTime,_totalTime,_errorCode);
|
|
|
|
EXPLODE_2_PVT(_args,_magazineClassname,_lastAmmoCount);
|
|
|
|
_fullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _magazineClassname >> "count");
|
|
|
|
|
2015-04-01 16:21:30 +00:00
|
|
|
//Don't show anything if player can't interact:
|
2015-06-13 20:08:13 +00:00
|
|
|
if (!([ACE_player, objNull, ["isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith))) exitWith {};
|
2015-02-08 23:35:21 +00:00
|
|
|
|
2015-04-01 16:21:30 +00:00
|
|
|
_structuredOutputText = if (_errorCode == 0) then {
|
2015-05-28 19:59:04 +00:00
|
|
|
format ["<t align='center'>%1</t><br/>", (localize LSTRING(RepackComplete))];
|
2015-02-08 23:35:21 +00:00
|
|
|
} else {
|
2015-05-28 19:59:04 +00:00
|
|
|
format ["<t align='center'>%1</t><br/>", (localize LSTRING(RepackInterrupted))];
|
2015-02-08 23:35:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_picture = getText (configFile >> "CfgMagazines" >> _magazineClassname >> "picture");
|
|
|
|
_structuredOutputText = _structuredOutputText + format ["<img align='center' size='1.8' color='#ffffff' image='%1'/> <br/>", _picture];
|
|
|
|
|
2015-04-01 20:09:05 +00:00
|
|
|
//EFUNC(common,displayTextStructured) doesn't have room for this, and I don't think it's nessacary, can fix in the future if wanted:
|
2015-02-08 23:35:21 +00:00
|
|
|
|
2015-04-01 20:09:05 +00:00
|
|
|
// _fullMags = 0;
|
|
|
|
// _partialMags = 0;
|
|
|
|
// {
|
|
|
|
// EXPLODE_2_PVT(_x,_xClassname,_xCount);
|
|
|
|
// if ((_xClassname == _magazineClassname) && {_xCount > 0}) then {
|
|
|
|
// if (_xCount == _fullMagazineCount) then {
|
|
|
|
// _fullMags = _fullMags + 1;
|
|
|
|
// } else {
|
|
|
|
// _partialMags = _partialMags + 1;
|
|
|
|
// };
|
|
|
|
// };
|
|
|
|
// } forEach (magazinesAmmoFull ACE_player);
|
2015-05-28 19:59:04 +00:00
|
|
|
// _structuredOutputText = _structuredOutputText + format [("<t align='center'>" + (localize LSTRING(RepackedMagazinesCount)) + "</t>"), _fullMags, _partialMags];
|
2015-02-08 23:35:21 +00:00
|
|
|
|
2015-04-24 05:46:01 +00:00
|
|
|
[parseText _structuredOutputText, 2] call EFUNC(common,displayTextStructured);
|