Skip to content

Commit

Permalink
Fixed more suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
AdlerSalbei committed Dec 13, 2018
1 parent 8fca5ad commit 3c10fe4
Show file tree
Hide file tree
Showing 10 changed files with 158 additions and 30 deletions.
19 changes: 1 addition & 18 deletions addons/trenches/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,6 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

[QGVAR(allowDigging), "CHECKBOX", [localize LSTRING(settingAllowDigging_displayName), localize LSTRING(settingAllowDigging_tooltip)], localize LSTRING(settingCategory), true] call CBA_Settings_fnc_init;
[QGVAR(allowCamouflage), "CHECKBOX", [localize LSTRING(settingAllowCamouflage_displayName), localize LSTRING(settingAllowCamouflage_tooltip)], localize LSTRING(settingCategory), true] call CBA_Settings_fnc_init;
[QGVAR(camouflageRequireEntrenchmentTool), "CHECKBOX", [localize LSTRING(settingCamouflageRequireEntrenchmentTool_displayName), localize LSTRING(settingCamouflageRequireEntrenchmentTool_tooltip)], localize LSTRING(settingCategory), false] call CBA_Settings_fnc_init;
[QGVAR(buildFatigueFactor), "SLIDER", [localize LSTRING(settingBuildFatigueFactor_displayName), localize LSTRING(settingBuildFatigueFactor_tooltip)], localize LSTRING(settingCategory), [0, 5, 1, 1]] call CBA_Settings_fnc_init;
[QGVAR(stopBuildingAtFatigueMax), "CHECKBOX", [localize LSTRING(stopBuildingAtFatigueMax_displayName), localize LSTRING(stopBuildingAtFatigueMax_tooltip)], localize LSTRING(settingCategory), true] call CBA_Settings_fnc_init;
[QGVAR(enableAutomaticFilePath), "CHECKBOX", [localize LSTRING(enableAutomaticFilePath_displayName), localize LSTRING(enableAutomaticFilePath_tooltip)], localize LSTRING(settingCategory), false] call CBA_Settings_fnc_init;

[QGVAR(allowShortEnvelope), "CHECKBOX", [localize LSTRING(allowShortEnvelope_displayName), localize LSTRING(allowShortEnvelope_tooltip)], localize LSTRING(settingCategory), true] call CBA_Settings_fnc_init;
[QGVAR(allowSmallEnvelope), "CHECKBOX", [localize LSTRING(allowSmallEnvelope_displayName), localize LSTRING(allowSmallEnvelope_tooltip)], localize LSTRING(settingCategory), true] call CBA_Settings_fnc_init;
[QGVAR(allowBigEnvelope), "CHECKBOX", [localize LSTRING(allowBigEnvelope_displayName), localize LSTRING(allowBigEnvelope_tooltip)], localize LSTRING(settingCategory), true] call CBA_Settings_fnc_init;
[QGVAR(allowLargeEnvelope), "CHECKBOX", [localize LSTRING(allowLargeEnvelope_displayName), localize LSTRING(allowLargeEnvelope_tooltip)], localize LSTRING(settingCategory), true] call CBA_Settings_fnc_init;
[QGVAR(allowVehicleEnvelope), "CHECKBOX", [localize LSTRING(allowVehicleEnvelope_displayName), localize LSTRING(allowVehicleEnvelope_tooltip)], localize LSTRING(settingCategory), true] call CBA_Settings_fnc_init;

[QGVAR(shortEnvelopeDigTime), "SLIDER", localize LSTRING(ShortEnvelopeDigTime), localize LSTRING(settingCategory), [5, 300, 20, 0]] call CBA_Settings_fnc_init;
[QGVAR(smallEnvelopeDigTime), "SLIDER", localize LSTRING(SmallEnvelopeDigTime), localize LSTRING(settingCategory), [5, 450, 30, 0]] call CBA_Settings_fnc_init;
[QGVAR(bigEnvelopeDigTime), "SLIDER", localize LSTRING(BigEnvelopeDigTime), localize LSTRING(settingCategory), [5, 600, 40, 0]] call CBA_Settings_fnc_init;
[QGVAR(largeEnvelopeDigTime), "SLIDER", localize LSTRING(LargeEnvelopeDigTime), localize LSTRING(settingCategory), [5, 900, 90, 0]] call CBA_Settings_fnc_init;
[QGVAR(vehicleEnvelopeDigTime), "SLIDER", localize LSTRING(VehicleEnvelopeDigTime), localize LSTRING(settingCategory), [5, 1200, 120, 0]] call CBA_Settings_fnc_init;
#include "initSettings.sqf"

ADDON = true;
7 changes: 7 additions & 0 deletions addons/trenches/functions/fnc_automaticFilePath.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,34 @@
* Public: No
*/

// Check if there is a config entry for the map
if ((isText (configFile >> "CfgWorlds" >> worldName >> "surfaceTextureBasePath")) || ("surfaceTexture" in (uiNamespace getVariable ["Intercept_cba_capabilities",[]]))) exitWith {};
private _config = configfile >> "CfgWorlds" >> worldName >> "OutsideTerrain" >> "Layers" >> "Layer0" >> "texture";
if !(isText (_config)) exitWith {
LOG("GRAD Trenches: Found no OutsideTerrain texture for Map %1, automatic file path not possible!");
};

// Check if the path leads to A3 files
private _path = getText (_config);
if (_path find"A3\Map_Data\" >= -1) exitWith {
LOG("GRAD Trenches: Found OutsideTerrain texture not matching path for Map %1, automatic file path not possible!");
};

// Splitt the path and remove the texture
private _split = _path splitString "\";
private _count = ((count _split) -1);
private _texture = _split select _count;
_split deleteAt _count;
_path = _split joinString "\";


// Check the path for the right ending
private _filePrefix = ".paa";
if ((_texture find "co.paa" >= -1)|| _texture find "ca.paa" >= -1) then {
_split = _texture splitString "_";
_filePrefix = _split select ((count _split) -1);
};

// Setup the GVAR
GVAR(automaticFileSetup) = [_path, _filePrefix];
publicVariable QGVAR(automaticFileSetup);
6 changes: 3 additions & 3 deletions addons/trenches/functions/fnc_canContinueDiggingTrench.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Checks if a unit can continue digging a trench
*
* Arguments:
* 0: trench <OBJECT>
* 1: unit <OBJECT>
* 0: Trench <OBJECT>
* 1: Unit <OBJECT>
*
* Return Value:
* Can continue <BOOL>
Expand All @@ -21,7 +21,7 @@ params ["_trench", "_unit"];
if !("ACE_EntrenchingTool" in (_unit call EFUNC(common,uniqueItems))) exitWith {false};
if ((_trench getVariable [QGVAR(progress), 0]) >= 1) exitWith {false};

// Prevent removing/digging trench by more than one person
// Prevent removing/digging trench while it is beeing changed
if (_trench getVariable [QGVAR(digging), false]) exitWith {false};

true
4 changes: 2 additions & 2 deletions addons/trenches/functions/fnc_canRemoveTrench.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Checks if a unit can remove a trench
*
* Arguments:
* 0: trench <OBJECT>
* 1: unit <OBJECT>
* 0: Trench <OBJECT>
* 1: Unit <OBJECT>
*
* Return Value:
* Can remove <BOOL>
Expand Down
4 changes: 2 additions & 2 deletions addons/trenches/functions/fnc_continueDiggingTrench.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Continue process of digging trench.
*
* Arguments:
* 0: trench <OBJECT>
* 1: unit <OBJECT>
* 0: Trench <OBJECT>
* 1: Unit <OBJECT>
*
* Return Value:
* None
Expand Down
2 changes: 1 addition & 1 deletion addons/trenches/functions/fnc_initTrench3DEN.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* 0: Trench <OBJECT>
*
* Return Value:
* Surface path <STRING>
* None
*
* Example:
* [TrenchObj] call ace_trenches_fnc_initTrench3DEN
Expand Down
2 changes: 1 addition & 1 deletion addons/trenches/functions/fnc_placeConfirm.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Confirms trench dig
*
* Arguments:
* 0: unit <OBJECT>
* 0: Unit <OBJECT>
*
* Return Value:
* None
Expand Down
2 changes: 1 addition & 1 deletion addons/trenches/functions/fnc_placeTrench.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Starts the place process for trench.
*
* Arguments:
* 0: unit <OBJECT>
* 0: Unit <OBJECT>
* 1: Trench class <STRING>
*
* Return Value:
Expand Down
4 changes: 2 additions & 2 deletions addons/trenches/functions/fnc_removeTrench.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Removes trench
*
* Arguments:
* 0: trench <OBJECT>
* 1: unit <OBJECT>
* 0: Trench <OBJECT>
* 1: Unit <OBJECT>
*
* Return Value:
* None
Expand Down
138 changes: 138 additions & 0 deletions addons/trenches/initSettings.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
[
QGVAR(allowDigging),
"CHECKBOX",
[localize LSTRING(settingAllowDigging_displayName),
localize LSTRING(settingAllowDigging_tooltip)],
localize LSTRING(settingCategory),
true
] call CBA_Settings_fnc_init;

[
QGVAR(allowCamouflage),
"CHECKBOX",
[localize LSTRING(settingAllowCamouflage_displayName),
localize LSTRING(settingAllowCamouflage_tooltip)],
localize LSTRING(settingCategory),
true
] call CBA_Settings_fnc_init;

[
QGVAR(camouflageRequireEntrenchmentTool),
"CHECKBOX", [localize LSTRING(settingCamouflageRequireEntrenchmentTool_displayName),
localize LSTRING(settingCamouflageRequireEntrenchmentTool_tooltip)],
localize LSTRING(settingCategory),
false
] call CBA_Settings_fnc_init;

[
QGVAR(buildFatigueFactor),
"SLIDER",
[localize LSTRING(settingBuildFatigueFactor_displayName),
localize LSTRING(settingBuildFatigueFactor_tooltip)],
localize LSTRING(settingCategory),
[0, 5, 1, 1]
] call CBA_Settings_fnc_init;

[
QGVAR(stopBuildingAtFatigueMax),
"CHECKBOX",
[localize LSTRING(stopBuildingAtFatigueMax_displayName),
localize LSTRING(stopBuildingAtFatigueMax_tooltip)],
localize LSTRING(settingCategory),
true
] call CBA_Settings_fnc_init;

[
QGVAR(enableAutomaticFilePath),
"CHECKBOX",
[localize LSTRING(enableAutomaticFilePath_displayName),
localize LSTRING(enableAutomaticFilePath_tooltip)],
localize LSTRING(settingCategory),
false
] call CBA_Settings_fnc_init;

[
QGVAR(allowShortEnvelope),
"CHECKBOX",
[localize LSTRING(allowShortEnvelope_displayName),
localize LSTRING(allowShortEnvelope_tooltip)],
localize LSTRING(settingCategory),
true
] call CBA_Settings_fnc_init;

[
QGVAR(allowSmallEnvelope),
"CHECKBOX",
[localize LSTRING(allowSmallEnvelope_displayName),
localize LSTRING(allowSmallEnvelope_tooltip)],
localize LSTRING(settingCategory),
true
] call CBA_Settings_fnc_init;

[
QGVAR(allowBigEnvelope),
"CHECKBOX",
[localize LSTRING(allowBigEnvelope_displayName),
localize LSTRING(allowBigEnvelope_tooltip)],
localize LSTRING(settingCategory),
true
] call CBA_Settings_fnc_init;

[
QGVAR(allowLargeEnvelope),
"CHECKBOX",
[localize LSTRING(allowLargeEnvelope_displayName),
localize LSTRING(allowLargeEnvelope_tooltip)],
localize LSTRING(settingCategory),
true
] call CBA_Settings_fnc_init;

[
QGVAR(allowVehicleEnvelope),
"CHECKBOX",
[
localize LSTRING(allowVehicleEnvelope_displayName),
localize LSTRING(allowVehicleEnvelope_tooltip)
],
localize LSTRING(settingCategory),
true
] call CBA_Settings_fnc_init;

[
QGVAR(shortEnvelopeDigTime),
"SLIDER",
localize LSTRING(ShortEnvelopeDigTime),
localize LSTRING(settingCategory),
[5, 300, 20, 0]
] call CBA_Settings_fnc_init;

[
QGVAR(smallEnvelopeDigTime),
"SLIDER",
localize LSTRING(SmallEnvelopeDigTime),
localize LSTRING(settingCategory),
[5, 450, 30, 0]
] call CBA_Settings_fnc_init;
[
QGVAR(bigEnvelopeDigTime),
"SLIDER",
localize LSTRING(BigEnvelopeDigTime),
localize LSTRING(settingCategory),
[5, 600, 40, 0]
] call CBA_Settings_fnc_init;

[
QGVAR(largeEnvelopeDigTime),
"SLIDER",
localize LSTRING(LargeEnvelopeDigTime),
localize LSTRING(settingCategory),
[5, 900, 90, 0]
] call CBA_Settings_fnc_init;

[
QGVAR(vehicleEnvelopeDigTime),
"SLIDER",
localize LSTRING(VehicleEnvelopeDigTime),
localize LSTRING(settingCategory),
[5, 1200, 120, 0]
] call CBA_Settings_fnc_init;

0 comments on commit 3c10fe4

Please sign in to comment.