From 3c10fe40d68f74486f2fcfb957e175f3afbaae84 Mon Sep 17 00:00:00 2001 From: Salbei Date: Thu, 13 Dec 2018 15:16:43 +0100 Subject: [PATCH] Fixed more suggestions --- addons/trenches/XEH_preInit.sqf | 19 +-- .../functions/fnc_automaticFilePath.sqf | 7 + .../fnc_canContinueDiggingTrench.sqf | 6 +- .../functions/fnc_canRemoveTrench.sqf | 4 +- .../functions/fnc_continueDiggingTrench.sqf | 4 +- .../trenches/functions/fnc_initTrench3DEN.sqf | 2 +- .../trenches/functions/fnc_placeConfirm.sqf | 2 +- addons/trenches/functions/fnc_placeTrench.sqf | 2 +- .../trenches/functions/fnc_removeTrench.sqf | 4 +- addons/trenches/initSettings.sqf | 138 ++++++++++++++++++ 10 files changed, 158 insertions(+), 30 deletions(-) create mode 100644 addons/trenches/initSettings.sqf diff --git a/addons/trenches/XEH_preInit.sqf b/addons/trenches/XEH_preInit.sqf index c44d600b0a5..9361d05015e 100644 --- a/addons/trenches/XEH_preInit.sqf +++ b/addons/trenches/XEH_preInit.sqf @@ -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; diff --git a/addons/trenches/functions/fnc_automaticFilePath.sqf b/addons/trenches/functions/fnc_automaticFilePath.sqf index c1d7504056d..76513b1015e 100644 --- a/addons/trenches/functions/fnc_automaticFilePath.sqf +++ b/addons/trenches/functions/fnc_automaticFilePath.sqf @@ -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); diff --git a/addons/trenches/functions/fnc_canContinueDiggingTrench.sqf b/addons/trenches/functions/fnc_canContinueDiggingTrench.sqf index 97fee957b07..912b5155426 100644 --- a/addons/trenches/functions/fnc_canContinueDiggingTrench.sqf +++ b/addons/trenches/functions/fnc_canContinueDiggingTrench.sqf @@ -4,8 +4,8 @@ * Checks if a unit can continue digging a trench * * Arguments: - * 0: trench - * 1: unit + * 0: Trench + * 1: Unit * * Return Value: * Can continue @@ -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 diff --git a/addons/trenches/functions/fnc_canRemoveTrench.sqf b/addons/trenches/functions/fnc_canRemoveTrench.sqf index 23347fc310e..93b421de045 100644 --- a/addons/trenches/functions/fnc_canRemoveTrench.sqf +++ b/addons/trenches/functions/fnc_canRemoveTrench.sqf @@ -4,8 +4,8 @@ * Checks if a unit can remove a trench * * Arguments: - * 0: trench - * 1: unit + * 0: Trench + * 1: Unit * * Return Value: * Can remove diff --git a/addons/trenches/functions/fnc_continueDiggingTrench.sqf b/addons/trenches/functions/fnc_continueDiggingTrench.sqf index e4551d1ed8d..bb564874da2 100644 --- a/addons/trenches/functions/fnc_continueDiggingTrench.sqf +++ b/addons/trenches/functions/fnc_continueDiggingTrench.sqf @@ -4,8 +4,8 @@ * Continue process of digging trench. * * Arguments: - * 0: trench - * 1: unit + * 0: Trench + * 1: Unit * * Return Value: * None diff --git a/addons/trenches/functions/fnc_initTrench3DEN.sqf b/addons/trenches/functions/fnc_initTrench3DEN.sqf index 9692847dbbf..2a2586b894c 100644 --- a/addons/trenches/functions/fnc_initTrench3DEN.sqf +++ b/addons/trenches/functions/fnc_initTrench3DEN.sqf @@ -7,7 +7,7 @@ * 0: Trench * * Return Value: - * Surface path + * None * * Example: * [TrenchObj] call ace_trenches_fnc_initTrench3DEN diff --git a/addons/trenches/functions/fnc_placeConfirm.sqf b/addons/trenches/functions/fnc_placeConfirm.sqf index ad17cea98fd..0708d76ed17 100644 --- a/addons/trenches/functions/fnc_placeConfirm.sqf +++ b/addons/trenches/functions/fnc_placeConfirm.sqf @@ -4,7 +4,7 @@ * Confirms trench dig * * Arguments: - * 0: unit + * 0: Unit * * Return Value: * None diff --git a/addons/trenches/functions/fnc_placeTrench.sqf b/addons/trenches/functions/fnc_placeTrench.sqf index 24d4b62656d..c886199f155 100644 --- a/addons/trenches/functions/fnc_placeTrench.sqf +++ b/addons/trenches/functions/fnc_placeTrench.sqf @@ -4,7 +4,7 @@ * Starts the place process for trench. * * Arguments: - * 0: unit + * 0: Unit * 1: Trench class * * Return Value: diff --git a/addons/trenches/functions/fnc_removeTrench.sqf b/addons/trenches/functions/fnc_removeTrench.sqf index 88625b2cbf5..8c8866878e6 100644 --- a/addons/trenches/functions/fnc_removeTrench.sqf +++ b/addons/trenches/functions/fnc_removeTrench.sqf @@ -4,8 +4,8 @@ * Removes trench * * Arguments: - * 0: trench - * 1: unit + * 0: Trench + * 1: Unit * * Return Value: * None diff --git a/addons/trenches/initSettings.sqf b/addons/trenches/initSettings.sqf new file mode 100644 index 00000000000..b9184943de7 --- /dev/null +++ b/addons/trenches/initSettings.sqf @@ -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;