2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2021-10-14 15:46:43 +00:00
|
|
|
/*
|
|
|
|
* 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;
|
2022-08-17 10:59:07 +00:00
|
|
|
private _typeOf = typeOf _object;
|
|
|
|
private _cost = [_side, _typeOf] call FUNC(getCost);
|
2021-10-14 15:46:43 +00:00
|
|
|
[_side, -_cost] call FUNC(updateBudget);
|
|
|
|
|
|
|
|
private _posASL = getPosASL _object;
|
|
|
|
private _vectorUp = vectorUp _object;
|
|
|
|
private _vectorDir = vectorDir _object;
|
|
|
|
|
|
|
|
deleteVehicle _object;
|
|
|
|
|
2021-11-08 18:01:39 +00:00
|
|
|
// Create progress bar to place object
|
|
|
|
private _totalTime = _cost * GVAR(timeCostCoefficient) + GVAR(timeMin); // time = Ax + b
|
2021-10-14 15:46:43 +00:00
|
|
|
|
2021-11-08 18:01:39 +00:00
|
|
|
private _perframeCheck = {
|
|
|
|
params ["_args", "_elapsedTime", "_totalTime", "_errorCode"];
|
2022-08-17 10:59:07 +00:00
|
|
|
_args params ["_unit", "_side", "_typeOf", "_posASL", "_vectorDir", "_vectorUp", "_cost"];
|
2021-10-14 15:46:43 +00:00
|
|
|
|
2021-11-08 18:01:39 +00:00
|
|
|
// 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
|
2021-10-14 15:46:43 +00:00
|
|
|
};
|
2021-11-08 18:01:39 +00:00
|
|
|
|
|
|
|
[
|
|
|
|
_totalTime,
|
2022-08-17 10:59:07 +00:00
|
|
|
[_unit, _side, _typeOf, _posASL, _vectorDir, _vectorUp, _cost],
|
2021-11-08 18:01:39 +00:00
|
|
|
QGVAR(deployFinished),
|
|
|
|
QGVAR(deployCanceled),
|
|
|
|
LLSTRING(progressBarTitle),
|
|
|
|
_perframeCheck
|
|
|
|
] call EFUNC(common,progressBar);
|
|
|
|
|