Skip to content

Commit

Permalink
add setting to disable disposable launchers (#1125)
Browse files Browse the repository at this point in the history
* tooltips for dropDisposable setting

* tooltips for dropDisposable setting

* add setting to disable disposable launchers

* don't disable launcher magazine slot if disposable launcher replacement is disabled

* Update Japanese translation (#1127)

* retroactive InitPost event to wait for setting to be synched in MP
  • Loading branch information
commy2 committed May 1, 2019
1 parent 557c135 commit eb7228f
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 10 deletions.
4 changes: 3 additions & 1 deletion addons/disposable/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ private _cfgMagazines = configFile >> "CfgMagazines";
};
} forEach configProperties [configFile >> "CBA_DisposableLaunchers", "isArray _x"];

["All", "InitPost", FUNC(replaceMagazineCargo)] call CBA_fnc_addClassEventHandler;
["CBA_settingsInitialized", {
["All", "InitPost", FUNC(replaceMagazineCargo), nil, nil, true] call CBA_fnc_addClassEventHandler;
}] call CBA_fnc_addEventHandler;

ADDON = true;
2 changes: 2 additions & 0 deletions addons/disposable/fnc_firedDisposable.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Author:
commy2
---------------------------------------------------------------------------- */

if (!GVAR(replaceDisposableLauncher)) exitWith {};

params ["_unit", "_launcher", "_muzzle", "", "", "", "_projectile"];

private _usedLauncher = GVAR(UsedLaunchers) getVariable _launcher;
Expand Down
3 changes: 1 addition & 2 deletions addons/disposable/fnc_initDisplayInventory.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ private _fnc_update = {
params ["_display"];
private _control = _display displayCtrl IDC_FG_SW_MAGAZINE;

private _unit = call CBA_fnc_currentUnit;
_control ctrlEnable isNil {GVAR(LoadedLaunchers) getVariable secondaryWeapon _unit};
_control ctrlEnable (!GVAR(replaceDisposableLauncher) || {isNil {GVAR(LoadedLaunchers) getVariable secondaryWeapon call CBA_fnc_currentUnit}});
};

_display displayAddEventHandler ["MouseMoving", _fnc_update];
Expand Down
2 changes: 2 additions & 0 deletions addons/disposable/fnc_replaceMagazineCargo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Author:
commy2
---------------------------------------------------------------------------- */

if (!GVAR(replaceDisposableLauncher)) exitWith {};

params ["_box"];
if (!local _box) exitWith {};
if (missionNamespace getVariable [QGVAR(disableMagazineReplacement), false]) exitWith {};
Expand Down
15 changes: 14 additions & 1 deletion addons/disposable/initSettings.sqf
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
[
QGVAR(replaceDisposableLauncher),
"CHECKBOX",
[LLSTRING(ReplaceDisposableLauncher), LLSTRING(ReplaceDisposableLauncherTooltip)],
ELSTRING(common,WeaponsCategory),
true, // default value
1 // isGlobal
] call EFUNC(settings,init);

[
QGVAR(dropUsedLauncher),
"LIST",
LLSTRING(DropUsedLauncher),
ELSTRING(common,WeaponsCategory),
[
[0,1,2],
[LLSTRING(DropNever), LLSTRING(DropAIOnly), LLSTRING(DropSelectedAnotherWeapon)],
[
[LLSTRING(DropNever), LLSTRING(DropNeverTooltip)],
[LLSTRING(DropAIOnly), LLSTRING(DropAIOnlyTooltip)],
[LLSTRING(DropSelectedAnotherWeapon), LLSTRING(DropSelectedAnotherWeaponTooltip)]
],
2
],
0 // isGlobal
Expand Down
25 changes: 25 additions & 0 deletions addons/disposable/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,40 @@
<German>Niemals</German>
<Japanese>行わない</Japanese>
</Key>
<Key ID="STR_CBA_disposable_DropNeverTooltip">
<English>Don't automatically drop the used disposable launcher.</English>
<German>Benutzten Einwegwerfer nicht automatisch ablegen.</German>
<Japanese>使った使い捨てランチャーを自動的に落とさないようにします。</Japanese>
</Key>
<Key ID="STR_CBA_disposable_DropAIOnly">
<English>AI Only</English>
<German>Nur KI</German>
<Japanese>AI のみ</Japanese>
</Key>
<Key ID="STR_CBA_disposable_DropAIOnlyTooltip">
<English>Only AI drops the used disposable launcher.</English>
<German>Nur KI legt den benutzten Einwegwerfer ab.</German>
<Japanese>AI のみ使った使い捨てランチャーを落とすようにします。</Japanese>
</Key>
<Key ID="STR_CBA_disposable_DropSelectedAnotherWeapon">
<English>Selected Another Weapon</English>
<German>Andere Waffe ausgewählt</German>
<Japanese>別の武器が選択後</Japanese>
</Key>
<Key ID="STR_CBA_disposable_DropSelectedAnotherWeaponTooltip">
<English>Automatically drop the used disposable launcher as soon as another weapon is selected.</English>
<German>Benutzten Einwegwerfer automatisch ablegen, sobald eine andere Waffe ausgewählt wurde.</German>
<Japanese>他の武器を選択すると即時に使った使い捨てランチャーを自動的に落とすようにします。</Japanese>
</Key>
<Key ID="STR_CBA_disposable_ReplaceDisposableLauncher">
<English>Replace Disposable Launcher</English>
<German>Einwegwerfer ersetzten</German>
<Japanese>使い捨てランチャーを置換</Japanese>
</Key>
<Key ID="STR_CBA_disposable_ReplaceDisposableLauncherTooltip">
<English>If enabled, disposable launchers can only be used once. Ammunition for disposable launchers in containers and vehicles will be replaced with loaded disposable launchers. If disabled, disposable launchers can be reloaded after use.</English>
<German>Wenn aktiviert, dann können Einwegwerfer nur einmal benutzt werden. Munition für Einwegwerfer in Kisten und Fahrzeugen wird durch geladene Einwegwerfer ersetzt. Wenn deaktiviert, dann können Einwegwerfer nach der Benutzung nachgeladen werden.</German>
<Japanese>有効化すると、使い捨てランチャーは一度のみ使用できます。コンテナ内にある使い捨てランチャーは装填された使い捨てランチャーに置き換えられます。無効化すると、使用後に使い捨てランチャーをリロードできます。</Japanese>
</Key>
</Package>
</Project>
16 changes: 10 additions & 6 deletions addons/events/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
"LIST",
[LLSTRING(RepetitionMode), LLSTRING(RepetitionModeTooltip)],
ELSTRING(common,WeaponsCategory),
[[0, 1, 2], [
[LLSTRING(RepetitionModeOptic), LLSTRING(RepetitionModeOpticTooltip)], // Exit optic view
[LLSTRING(RepetitionModeTriggerRelease), LLSTRING(RepetitionModeTriggerReleaseTooltip)], // Stop holding trigger
[LLSTRING(RepetitionModeTriggerPress), LLSTRING(RepetitionModeTriggerPressTooltip)] // Click trigger again
], 1],
2
[
[0, 1, 2],
[
[LLSTRING(RepetitionModeOptic), LLSTRING(RepetitionModeOpticTooltip)], // Exit optic view
[LLSTRING(RepetitionModeTriggerRelease), LLSTRING(RepetitionModeTriggerReleaseTooltip)], // Stop holding trigger
[LLSTRING(RepetitionModeTriggerPress), LLSTRING(RepetitionModeTriggerPressTooltip)] // Click trigger again
],
1
],
2 // client setting
] call CBA_fnc_addSetting;

0 comments on commit eb7228f

Please sign in to comment.