mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fortify - Add Progress Bar (#8585)
* 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>
This commit is contained in:
parent
62ed899ecc
commit
422c47aae6
@ -72,3 +72,32 @@ GVAR(objectRotationZ) = 0;
|
|||||||
[_object, 0, ["ACE_MainActions"], _removeAction] call EFUNC(interact_menu,addActionToObject);
|
[_object, 0, ["ACE_MainActions"], _removeAction] call EFUNC(interact_menu,addActionToObject);
|
||||||
};
|
};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
// Place object event handler
|
||||||
|
[QGVAR(deployFinished), {
|
||||||
|
params ["_args", "_elapsedTime", "_totalTime", "_errorCode"];
|
||||||
|
_args params ["_unit", "_side", "_typeOf", "_posASL", "_vectorDir", "_vectorUp"];
|
||||||
|
|
||||||
|
private _newObject = _typeOf createVehicle _posASL;
|
||||||
|
_newObject setPosASL _posASL;
|
||||||
|
_newObject setVectorDirAndUp [_vectorDir, _vectorUp];
|
||||||
|
|
||||||
|
// Server will use this event to run the jip compatible QGVAR(addActionToObject) event and create the related map marker
|
||||||
|
[QXGVAR(objectPlaced), [_unit, _side, _newObject]] call CBA_fnc_globalEvent;
|
||||||
|
|
||||||
|
if (cba_events_control) then {
|
||||||
|
// Re-run if ctrl key held
|
||||||
|
[_unit, _unit, [_side, _typeOf, [GVAR(objectRotationX), GVAR(objectRotationY), GVAR(objectRotationZ)]]] call FUNC(deployObject);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Reset animation
|
||||||
|
[_unit, "", 1] call EFUNC(common,doAnimation);
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
[QGVAR(deployCanceled), {
|
||||||
|
params ["_args", "_elapsedTime", "_totalTime", "_errorCode"];
|
||||||
|
_args params ["_unit", "_side", "_typeOf", "_posASL", "_vectorDir", "_vectorUp"];
|
||||||
|
|
||||||
|
// Reset animation
|
||||||
|
[_unit, "", 1] call EFUNC(common,doAnimation);
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -30,14 +30,29 @@ private _vectorDir = vectorDir _object;
|
|||||||
|
|
||||||
deleteVehicle _object;
|
deleteVehicle _object;
|
||||||
|
|
||||||
private _newObject = _typeOf createVehicle _posASL;
|
// Create progress bar to place object
|
||||||
_newObject setPosASL _posASL;
|
private _totalTime = _cost * GVAR(timeCostCoefficient) + GVAR(timeMin); // time = Ax + b
|
||||||
_newObject setVectorDirAndUp [_vectorDir, _vectorUp];
|
|
||||||
|
|
||||||
// Server will use this event to run the jip compatible QGVAR(addActionToObject) event and create the related map marker.
|
private _perframeCheck = {
|
||||||
[QXGVAR(objectPlaced), [_unit, _side, _newObject]] call CBA_fnc_globalEvent;
|
params ["_args", "_elapsedTime", "_totalTime", "_errorCode"];
|
||||||
|
_args params ["_unit", "_side", "_typeOf", "_posASL", "_vectorDir", "_vectorUp"];
|
||||||
|
|
||||||
if (cba_events_control) then {
|
// Animation loop (required for longer constructions)
|
||||||
// Re-run if ctrl key held
|
if (animationState _unit isNotEqualTo "AinvPknlMstpSnonWnonDnon_medic4") then {
|
||||||
[_unit, _unit, [_side, _typeOf, [GVAR(objectRotationX), GVAR(objectRotationY), GVAR(objectRotationZ)]]] call FUNC(deployObject);
|
// 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);
|
||||||
|
|
||||||
|
@ -10,6 +10,22 @@
|
|||||||
]
|
]
|
||||||
] call CBA_fnc_addSetting;
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(timeCostCoefficient),
|
||||||
|
"SLIDER",
|
||||||
|
[LLSTRING(settingHint_timeCostCoefficient), LLSTRING(settingHintDesc_timeCostCoefficient)],
|
||||||
|
LLSTRING(settingsCategory),
|
||||||
|
[0, 10, 1, 2] // Min, Max, Default, Trailing Decimals, is Percentage
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(timeMin),
|
||||||
|
"SLIDER",
|
||||||
|
[LLSTRING(settingHint_timeMin), LLSTRING(settingHintDesc_timeMin)],
|
||||||
|
LLSTRING(settingsCategory),
|
||||||
|
[0, 25, 1.5, 2] // Min, Max, Default, Trailing Decimals, is Percentage
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
[
|
[
|
||||||
QGVAR(markObjectsOnMap),
|
QGVAR(markObjectsOnMap),
|
||||||
"LIST",
|
"LIST",
|
||||||
|
@ -157,6 +157,21 @@
|
|||||||
<Russian>Показывать всегда</Russian>
|
<Russian>Показывать всегда</Russian>
|
||||||
<Turkish>Her Zaman Göster</Turkish>
|
<Turkish>Her Zaman Göster</Turkish>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Fortify_settingHint_timeCostCoefficient">
|
||||||
|
<English>Time-Cost Coefficient</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Fortify_settingHintDesc_timeCostCoefficient">
|
||||||
|
<English>Coefficient used to determine time to build structure.<br/>A in Ax + b where x is cost of object</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Fortify_settingHint_timeMin">
|
||||||
|
<English>Minimum Build Time</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Fortify_settingHintDesc_timeMin">
|
||||||
|
<English>Minimum time to build any structure.<br/>b in Ax + b where x is cost of object</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Fortify_progressBarTitle">
|
||||||
|
<English>Building</English>
|
||||||
|
</Key>
|
||||||
<Key ID="STR_ACE_Fortify_markObjectsOnMap">
|
<Key ID="STR_ACE_Fortify_markObjectsOnMap">
|
||||||
<English>Create map markers</English>
|
<English>Create map markers</English>
|
||||||
</Key>
|
</Key>
|
||||||
|
@ -15,7 +15,7 @@ redirect_from: "/wiki/featurex/fortify.html"
|
|||||||
|
|
||||||
## 1. Overview
|
## 1. Overview
|
||||||
|
|
||||||
Enable players to place down fortifications. Budget enables mission makers / admin to restrict the amount of resources available.
|
Enable players to place down fortifications. Budget enables mission makers / admin to restrict the amount of resources available and how long it will take to construct the fortifications.
|
||||||
|
|
||||||
## 2. Usage
|
## 2. Usage
|
||||||
|
|
||||||
|
@ -92,3 +92,5 @@ Event Name | Passed Parameter(s) | Locality | Description
|
|||||||
`acex_fortify_objectPlaced` | [player, side, objectPlaced] | Global | Foritfy object placed
|
`acex_fortify_objectPlaced` | [player, side, objectPlaced] | Global | Foritfy object placed
|
||||||
`acex_fortify_objectDeleted` | [player, side, objectDeleted] | Global | Foritfy object deleted
|
`acex_fortify_objectDeleted` | [player, side, objectDeleted] | Global | Foritfy object deleted
|
||||||
`acex_fortify_onDeployStart` | [player, object, cost] | Local | Player starts placing object
|
`acex_fortify_onDeployStart` | [player, object, cost] | Local | Player starts placing object
|
||||||
|
`ace_fortify_deployFinished` | [player, side, configName, posASL, vectorDir, vectorUp] | Local | Player successfully finishes building object
|
||||||
|
`ace_fortify_deployCanceled` | [player, side, configName, posASL, vectorDir, vectorUp] | Local | Player cancels building object
|
||||||
|
Loading…
Reference in New Issue
Block a user