Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Paradrop Time Coefficient Setting #5116

Merged
merged 8 commits into from
May 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions addons/cargo/ACE_Settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@ class ACE_Settings {
value = 1;
category = ECSTRING(OptionsMenu,CategoryLogistics);
};
class GVAR(paradropTimeCoefficent) {
displayName = CSTRING(paradropTimeCoefficent);
description = CSTRING(paradropTimeCoefficent_description);
typeName = "SCALAR";
value = 2.5;
category = ECSTRING(OptionsMenu,CategoryLogistics);
};
};
6 changes: 6 additions & 0 deletions addons/cargo/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ class CfgVehicles {
typeName = "BOOL";
defaultValue = 1;
};
class paradropTimeCoefficent {
displayName = CSTRING(paradropTimeCoefficent);
description = CSTRING(paradropTimeCoefficent_description);
typeName = "SCALAR";
defaultValue = 2.5;
};
};

class ModuleDescription {
Expand Down
1 change: 1 addition & 0 deletions addons/cargo/functions/fnc_moduleSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ params ["_logic", "", "_activated"];
if (!_activated) exitWith {};

[_logic, QGVAR(enable), "enable"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(paradropTimeCoefficent), "paradropTimeCoefficent"] call EFUNC(common,readSettingFromModule);

INFO("Cargo Module Initialized.");
8 changes: 7 additions & 1 deletion addons/cargo/functions/fnc_onMenuOpen.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ if (GVAR(interactionParadrop)) then {
lbClear _ctrl;
{
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
} count _loaded;

Expand Down
9 changes: 9 additions & 0 deletions addons/cargo/functions/fnc_paradropItem.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ _itemObject setVelocity ((velocity _vehicle) vectorAdd ((vectorNormalized (vecto

}, 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
["ace_cargoUnloaded", [_item, _vehicle, "paradrop"]] call CBA_fnc_globalEvent;

Expand Down
9 changes: 7 additions & 2 deletions addons/cargo/functions/fnc_startUnload.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@ private _ctrl = _display displayCtrl 100;
private _selected = (lbCurSel _ctrl) max 0;

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 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
private _size = [_item] call FUNC(getSizeItem);
[
2.5 * _size,
GVAR(paradropTimeCoefficent) * _size,
[_item, GVAR(interactionVehicle), ACE_player],
{
(_this select 0) params ["_item", "_target", "_player"];
Expand Down
6 changes: 6 additions & 0 deletions addons/cargo/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,11 @@
<Polish>Nierówny lot</Polish>
<Korean>기체가 수평이 아닙니다</Korean>
</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>
</Project>