Add Paradrop Time Coefficient Setting (#5116)

* Add coef

* Show cargo paradrop time in menu

* Unary command, not a function call

* If drop time is 0 don't show a progress bar

* Add the setting to cargo's editor module

* Swap values

* Remove extra comma

* Move unload message to paradrop event

This way the message will show up on all paradrops, not just immidiate
ones.
This commit is contained in:
Ozan Eğitmen 2017-05-05 23:02:59 +04:00 committed by PabstMirror
parent c001be5b09
commit ea4a159cd2
7 changed files with 43 additions and 3 deletions

View File

@ -6,4 +6,11 @@ class ACE_Settings {
value = 1; value = 1;
category = ECSTRING(OptionsMenu,CategoryLogistics); category = ECSTRING(OptionsMenu,CategoryLogistics);
}; };
class GVAR(paradropTimeCoefficent) {
displayName = CSTRING(paradropTimeCoefficent);
description = CSTRING(paradropTimeCoefficent_description);
typeName = "SCALAR";
value = 2.5;
category = ECSTRING(OptionsMenu,CategoryLogistics);
};
}; };

View File

@ -26,6 +26,12 @@ class CfgVehicles {
typeName = "BOOL"; typeName = "BOOL";
defaultValue = 1; defaultValue = 1;
}; };
class paradropTimeCoefficent {
displayName = CSTRING(paradropTimeCoefficent);
description = CSTRING(paradropTimeCoefficent_description);
typeName = "SCALAR";
defaultValue = 2.5;
};
}; };
class ModuleDescription { class ModuleDescription {

View File

@ -24,5 +24,6 @@ params ["_logic", "", "_activated"];
if (!_activated) exitWith {}; if (!_activated) exitWith {};
[_logic, QGVAR(enable), "enable"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(enable), "enable"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(paradropTimeCoefficent), "paradropTimeCoefficent"] call EFUNC(common,readSettingFromModule);
INFO("Cargo Module Initialized."); INFO("Cargo Module Initialized.");

View File

@ -44,7 +44,13 @@ if (GVAR(interactionParadrop)) then {
lbClear _ctrl; lbClear _ctrl;
{ {
private _class = if (_x isEqualType "") then {_x} else {typeOf _x}; private _class = if (_x isEqualType "") then {_x} else {typeOf _x};
_ctrl lbAdd (getText(configfile >> "CfgVehicles" >> _class >> "displayName")); private _displayName = getText (configfile >> "CfgVehicles" >> _class >> "displayName");
if (GVAR(interactionParadrop)) then {
_ctrl lbAdd format ["%1 (%2s)", _displayName, GVAR(paradropTimeCoefficent) * ([_class] call FUNC(getSizeItem))];
} else {
_ctrl lbAdd _displayName;
};
true true
} count _loaded; } count _loaded;

View File

@ -90,6 +90,15 @@ _itemObject setVelocity ((velocity _vehicle) vectorAdd ((vectorNormalized (vecto
}, 1, [_itemObject]] call CBA_fnc_addPerFrameHandler; }, 1, [_itemObject]] call CBA_fnc_addPerFrameHandler;
[
[
LSTRING(UnloadedItem),
getText (configFile >> "CfgVehicles" >> typeOf _itemObject >> "displayName"),
getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName")
],
3
] call EFUNC(common,displayTextStructured);
// Invoke listenable event // Invoke listenable event
["ace_cargoUnloaded", [_item, _vehicle, "paradrop"]] call CBA_fnc_globalEvent; ["ace_cargoUnloaded", [_item, _vehicle, "paradrop"]] call CBA_fnc_globalEvent;

View File

@ -28,13 +28,18 @@ private _ctrl = _display displayCtrl 100;
private _selected = (lbCurSel _ctrl) max 0; private _selected = (lbCurSel _ctrl) max 0;
if (count _loaded <= _selected) exitWith {}; if (count _loaded <= _selected) exitWith {};
private _item = _loaded select _selected; //This can be an object or a classname string private _item = _loaded select _selected; // This can be an object or a classname string
if (GVAR(interactionParadrop)) exitWith { if (GVAR(interactionParadrop)) exitWith {
// If drop time is 0 don't show a progress bar
if (GVAR(paradropTimeCoefficent) == 0) exitWith {
[QGVAR(paradropItem), [_item, GVAR(interactionVehicle)]] call CBA_fnc_localEvent;
};
// Start progress bar - paradrop // Start progress bar - paradrop
private _size = [_item] call FUNC(getSizeItem); private _size = [_item] call FUNC(getSizeItem);
[ [
2.5 * _size, GVAR(paradropTimeCoefficent) * _size,
[_item, GVAR(interactionVehicle), ACE_player], [_item, GVAR(interactionVehicle), ACE_player],
{ {
(_this select 0) params ["_item", "_target", "_player"]; (_this select 0) params ["_item", "_target", "_player"];

View File

@ -253,5 +253,11 @@
<Korean>기체가 수평이 아닙니다</Korean> <Korean>기체가 수평이 아닙니다</Korean>
<French>Rétablir l'assiette</French> <French>Rétablir l'assiette</French>
</Key> </Key>
<Key ID="STR_ACE_Cargo_paradropTimeCoefficent">
<English>Paradrop Time Coffecient</English>
</Key>
<Key ID="STR_ACE_Cargo_paradropTimeCoefficent_description">
<English>Modifier for how long it takes to paradrop a cargo item.</English>
</Key>
</Package> </Package>
</Project> </Project>