mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
422c47aae6
* Fortify - Add Progress Bar * Misc Fixes * Add animation loop * Adjust default values to make larger objects take longer to build * Fix merge conflict additional Co-authored-by: jonpas <jonpas33@gmail.com>
59 lines
1.4 KiB
Plaintext
59 lines
1.4 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: Kingsley
|
|
* Confirms the deployment.
|
|
*
|
|
* Arguments:
|
|
* 0: Player <OBJECT>
|
|
* 1: Fortify Object <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [player, wall] call ace_fortify_fnc_deployConfirm
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_unit", "_object"];
|
|
TRACE_2("deployConfirm",_unit,_object);
|
|
|
|
private _side = side group _unit;
|
|
private _cost = [_side, typeOf _object] call FUNC(getCost);
|
|
[_side, -_cost] call FUNC(updateBudget);
|
|
|
|
private _typeOf = typeOf _object;
|
|
private _posASL = getPosASL _object;
|
|
private _vectorUp = vectorUp _object;
|
|
private _vectorDir = vectorDir _object;
|
|
|
|
deleteVehicle _object;
|
|
|
|
// Create progress bar to place object
|
|
private _totalTime = _cost * GVAR(timeCostCoefficient) + GVAR(timeMin); // time = Ax + b
|
|
|
|
private _perframeCheck = {
|
|
params ["_args", "_elapsedTime", "_totalTime", "_errorCode"];
|
|
_args params ["_unit", "_side", "_typeOf", "_posASL", "_vectorDir", "_vectorUp"];
|
|
|
|
// Animation loop (required for longer constructions)
|
|
if (animationState _unit isNotEqualTo "AinvPknlMstpSnonWnonDnon_medic4") then {
|
|
// Perform animation
|
|
[_unit, "AinvPknlMstpSnonWnonDnon_medic4"] call EFUNC(common,doAnimation);
|
|
};
|
|
|
|
// Return true always
|
|
true
|
|
};
|
|
|
|
[
|
|
_totalTime,
|
|
[_unit, _side, _typeOf, _posASL, _vectorDir, _vectorUp],
|
|
QGVAR(deployFinished),
|
|
QGVAR(deployCanceled),
|
|
LLSTRING(progressBarTitle),
|
|
_perframeCheck
|
|
] call EFUNC(common,progressBar);
|
|
|