initial files
This commit is contained in:
40
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_apply.sqf
Normal file
40
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_apply.sqf
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
KPPLM_fnc_apply
|
||||
|
||||
File: fn_apply.sqf
|
||||
Author: Wyqer - https://github.com/KillahPotatoes
|
||||
Date: 2018-08-04
|
||||
Last Update: 2018-11-10
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Applies and saves the selected settings from the player menu dialog.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Apply current view distance and sound volume
|
||||
[] call KPPLM_fnc_getInOut;
|
||||
|
||||
// Apply terrain detail setting
|
||||
switch (KPPLM_terrain) do {
|
||||
case 0: {setTerrainGrid 50;};
|
||||
case 1: {setTerrainGrid 25;};
|
||||
case 2: {setTerrainGrid 12.5;};
|
||||
case 3: {setTerrainGrid 6.25;};
|
||||
case 4: {setTerrainGrid 3.125;};
|
||||
default {setTerrainGrid 10;};
|
||||
};
|
||||
|
||||
// Apply radio chatter setting
|
||||
switch (KPPLM_radio) do {
|
||||
case 1: {enableRadio true; 1 fadeRadio 0;};
|
||||
case 2: {enableRadio false; 1 fadeRadio 0;};
|
||||
default {enableRadio true; 1 fadeRadio 1;};
|
||||
};
|
||||
|
||||
true
|
||||
27
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_create.sqf
Normal file
27
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_create.sqf
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
KPPLM_fnc_create
|
||||
|
||||
File: fn_create.sqf
|
||||
Author: Wyqer - https://github.com/KillahPotatoes
|
||||
Date: 2018-08-05
|
||||
Last Update: 2018-11-10
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Creates a new group for the player.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
private _grp = createGroup [(side player), true];
|
||||
[player] join _grp;
|
||||
|
||||
// Refresh Dialog
|
||||
closeDialog 0;
|
||||
[{!dialog}, {call KPPLM_fnc_openDialog;}] call CBA_fnc_waitUntilAndExecute;
|
||||
|
||||
true
|
||||
48
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_getInOut.sqf
Normal file
48
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_getInOut.sqf
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
KPPLM_fnc_getInOut
|
||||
|
||||
File: fn_getInOut.sqf
|
||||
Author: Wyqer - https://github.com/KillahPotatoes
|
||||
Date: 2018-08-05
|
||||
Last Update: 2018-11-10
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Sets the view distance and the sound volume of the player depending on the current vehicle.
|
||||
Also changes the camera view, if functionality is enabled by the player.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Player on foot
|
||||
if (isNull objectParent player) then {
|
||||
setViewDistance KPPLM_viewFoot;
|
||||
setObjectViewDistance KPPLM_viewFoot;
|
||||
1 fadeSound 1;
|
||||
};
|
||||
|
||||
// Player in boat or land vehicle
|
||||
if (vehicle player isKindOf "LandVehicle" || vehicle player isKindOf "Ship") then {
|
||||
setViewDistance KPPLM_viewVeh;
|
||||
setObjectViewDistance KPPLM_viewVeh;
|
||||
1 fadeSound KPPLM_soundVeh;
|
||||
if (difficultyOption "thirdPersonView" == 1) then {
|
||||
if (KPPLM_tpv > 1) then {player switchCamera "EXTERNAL";};
|
||||
};
|
||||
};
|
||||
|
||||
// Player in air vehicle
|
||||
if (vehicle player isKindOf "Air") then {
|
||||
setViewDistance KPPLM_viewAir;
|
||||
setObjectViewDistance KPPLM_viewAir;
|
||||
1 fadeSound KPPLM_soundVeh;
|
||||
if (difficultyOption "thirdPersonView" == 1) then {
|
||||
if (KPPLM_tpv == 1 || KPPLM_tpv == 3) then {player switchCamera "EXTERNAL";};
|
||||
};
|
||||
};
|
||||
|
||||
true
|
||||
31
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_join.sqf
Normal file
31
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_join.sqf
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
KPPLM_fnc_join
|
||||
|
||||
File: fn_join.sqf
|
||||
Author: Wyqer - https://github.com/KillahPotatoes
|
||||
Date: 2018-08-05
|
||||
Last Update: 2018-11-10
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Joins the group which is currently selected in the group list.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 75803;
|
||||
private _ctrlGroupList = _dialog displayCtrl 758038;
|
||||
|
||||
private _grp = KPPLM_groups select (lbCurSel _ctrlGroupList);
|
||||
[player] join _grp;
|
||||
|
||||
// Refresh Dialog with a small delay
|
||||
[{player in units (_this select 0)}, {closeDialog 0;}, [_grp]] call CBA_fnc_waitUntilAndExecute;
|
||||
[{!dialog}, {call KPPLM_fnc_openDialog;}] call CBA_fnc_waitUntilAndExecute;
|
||||
|
||||
true
|
||||
94
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_openDialog.sqf
Normal file
94
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_openDialog.sqf
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
KPPLM_fnc_openDialog
|
||||
|
||||
File: fn_openDialog.sqf
|
||||
Author: Wyqer - https://github.com/KillahPotatoes
|
||||
Date: 2018-08-03
|
||||
Last Update: 2018-11-10
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Opens the player menu dialog.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Create player options dialog
|
||||
createDialog "KPPLM_dialog";
|
||||
disableSerialization;
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 75803;
|
||||
private _ctrlLabelRank = _dialog displayCtrl 758031;
|
||||
private _ctrlRank = _dialog displayCtrl 758032;
|
||||
private _ctrlLabelScore = _dialog displayCtrl 758033;
|
||||
private _ctrlScore = _dialog displayCtrl 758034;
|
||||
private _ctrlLabelPlaytime = _dialog displayCtrl 758035;
|
||||
private _ctrlPlaytime = _dialog displayCtrl 758036;
|
||||
private _ctrlNoRanks = _dialog displayCtrl 758037;
|
||||
private _ctrlGroupList = _dialog displayCtrl 758038;
|
||||
private _ctrlViewFoot = _dialog displayCtrl 7580310;
|
||||
private _ctrlViewVeh = _dialog displayCtrl 7580311;
|
||||
private _ctrlViewAir = _dialog displayCtrl 7580312;
|
||||
private _ctrlTerrain = _dialog displayCtrl 7580313;
|
||||
private _ctrlTpv = _dialog displayCtrl 7580314;
|
||||
private _ctrlRadio = _dialog displayCtrl 7580315;
|
||||
private _ctrlValueSound = _dialog displayCtrl 7580316;
|
||||
private _ctrlSliderSound = _dialog displayCtrl 7580317;
|
||||
|
||||
// Display KP Ranks data or hide the player menu entries for the data
|
||||
if (KPPLM_KPR) then {
|
||||
[] call KPPLM_fnc_showRankData;
|
||||
} else {
|
||||
{
|
||||
_x ctrlShow false;
|
||||
} forEach [_ctrlLabelRank, _ctrlRank, _ctrlLabelScore, _ctrlScore, _ctrlLabelPlaytime, _ctrlPlaytime];
|
||||
};
|
||||
|
||||
// Fill group list with all groups leaded by players
|
||||
{
|
||||
if (player in units _x) then {
|
||||
_ctrlGroupList lbSetCurSel (_ctrlGroupList lbAdd format [">> %1 - %2 (%3)", groupId _x, name leader _x, count units _x]);
|
||||
} else {
|
||||
_ctrlGroupList lbAdd format ["%1 - %2 (%3)", groupId _x, name leader _x, count units _x];
|
||||
};
|
||||
|
||||
} forEach KPPLM_groups;
|
||||
|
||||
// Set initial values for view distances
|
||||
_ctrlViewFoot ctrlSetText str KPPLM_viewFoot;
|
||||
_ctrlViewVeh ctrlSetText str KPPLM_viewVeh;
|
||||
_ctrlViewAir ctrlSetText str KPPLM_viewAir;
|
||||
|
||||
// Fill density, auto tpv and radio dropdowns. Also preselect the saved values
|
||||
_ctrlTerrain lbAdd localize "STR_KPPLM_TERRAINLOW"; // 50
|
||||
_ctrlTerrain lbAdd localize "STR_KPPLM_TERRAINSTANDARD"; // 25
|
||||
_ctrlTerrain lbAdd localize "STR_KPPLM_TERRAINHIGH"; // 12.5
|
||||
_ctrlTerrain lbAdd localize "STR_KPPLM_TERRAINVHIGH"; // 6.25
|
||||
_ctrlTerrain lbAdd localize "STR_KPPLM_TERRAINULTRA"; // 3.125
|
||||
_ctrlTerrain lbSetCurSel KPPLM_terrain;
|
||||
|
||||
_ctrlTpv lbAdd localize "STR_KPPLM_TPDISABLED";
|
||||
_ctrlTpv lbAdd localize "STR_KPPLM_TPVAIR";
|
||||
_ctrlTpv lbAdd localize "STR_KPPLM_TPVLAND";
|
||||
_ctrlTpv lbAdd localize "STR_KPPLM_TPVALL";
|
||||
_ctrlTpv lbSetCurSel KPPLM_tpv;
|
||||
|
||||
_ctrlRadio lbAdd localize "STR_KPPLM_RADIONO";
|
||||
_ctrlRadio lbAdd localize "STR_KPPLM_RADIOVOICE";
|
||||
_ctrlRadio lbAdd localize "STR_KPPLM_RADIOALL";
|
||||
_ctrlRadio lbSetCurSel KPPLM_radio;
|
||||
|
||||
// Initialize sound slider range, position and speed
|
||||
_ctrlSliderSound sliderSetRange [0, 100];
|
||||
_ctrlSliderSound sliderSetPosition (KPPLM_soundVeh * 100);
|
||||
_ctrlSliderSound sliderSetSpeed [1, 1];
|
||||
|
||||
// Set sound value output to initial sound slider value
|
||||
_ctrlValueSound ctrlSetText format ["%1%2", round sliderPosition _ctrlSliderSound, "%"];
|
||||
|
||||
true
|
||||
58
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_postInit.sqf
Normal file
58
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_postInit.sqf
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
KPPLM_fnc_postInit
|
||||
|
||||
File: fn_postInit.sqf
|
||||
Author: Wyqer - https://github.com/KillahPotatoes
|
||||
Date: 2017-08-31
|
||||
Last Update: 2020-04-17
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
The postInit function of a module takes care of starting/executing the modules functions or scripts.
|
||||
Basically it starts/initializes the module functionality to make all provided features usable.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Module postInit finished [BOOL]
|
||||
*/
|
||||
|
||||
if (!KPPLM_CBA) exitWith {["CBA not loaded. Aborting initialization!"] call BIS_fnc_error; false};
|
||||
|
||||
// Player section
|
||||
if (hasInterface) then {
|
||||
// Load settings, if available
|
||||
private _settings = profileNamespace getVariable ["KPPLM_Settings", []];
|
||||
if !(_settings isEqualTo []) then {
|
||||
KPPLM_viewFoot = _settings select 0;
|
||||
KPPLM_viewVeh = _settings select 1;
|
||||
KPPLM_viewAir = _settings select 2;
|
||||
KPPLM_terrain = _settings select 3;
|
||||
KPPLM_tpv = _settings select 4;
|
||||
KPPLM_radio = _settings select 5;
|
||||
KPPLM_soundVeh = _settings select 6;
|
||||
};
|
||||
|
||||
// Add event handler
|
||||
player addEventHandler ["GetInMan", {[] call KPPLM_fnc_getInOut}];
|
||||
player addEventHandler ["GetOutMan", {[] call KPPLM_fnc_getInOut}];
|
||||
|
||||
// Action to open the dialog
|
||||
private _actionArray = [
|
||||
"<t color='#FF8000'>" + localize "STR_KPPLM_ACTIONOPEN" + "</t>",
|
||||
{[] call KPPLM_fnc_openDialog;},
|
||||
nil,
|
||||
-1000,
|
||||
false,
|
||||
true,
|
||||
"",
|
||||
'_target isEqualTo _originalTarget'
|
||||
];
|
||||
[_actionArray] call CBA_fnc_addPlayerAction;
|
||||
|
||||
// Apply default/loaded values
|
||||
[] call KPPLM_fnc_apply;
|
||||
};
|
||||
|
||||
true
|
||||
47
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_preInit.sqf
Normal file
47
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_preInit.sqf
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
KPPLM_fnc_preInit
|
||||
|
||||
File: fn_preInit.sqf
|
||||
Author: Wyqer - https://github.com/KillahPotatoes
|
||||
Date: 2018-10-18
|
||||
Last Update: 2020-04-17
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
The preInit function defines global variables, adds event handlers and set some vital settings which are used in this module.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Module preInit finished [BOOL]
|
||||
*/
|
||||
|
||||
// Check if CBA is running
|
||||
KPPLM_CBA = isClass (configFile >> "CfgPatches" >> "cba_main");
|
||||
|
||||
// Check if KP Ranks is running
|
||||
KPPLM_KPR = isClass (configFile >> "CfgPatches" >> "KP_Ranks");
|
||||
|
||||
// View distance on foot
|
||||
KPPLM_viewFoot = viewDistance;
|
||||
|
||||
// View distance in land vehicle
|
||||
KPPLM_viewVeh = viewDistance;
|
||||
|
||||
// View distance in air vehicle
|
||||
KPPLM_viewAir = viewDistance;
|
||||
|
||||
// Terrain detail setting
|
||||
KPPLM_terrain = 2;
|
||||
|
||||
// Auto 3rd Person setting
|
||||
KPPLM_tpv = 0;
|
||||
|
||||
// Disable radio chatter setting
|
||||
KPPLM_radio = 0;
|
||||
|
||||
// Sound volume inside a vehicle
|
||||
KPPLM_soundVeh = soundVolume;
|
||||
|
||||
true
|
||||
38
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_rename.sqf
Normal file
38
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_rename.sqf
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
KPPLM_fnc_rename
|
||||
|
||||
File: fn_rename.sqf
|
||||
Author: Wyqer - https://github.com/KillahPotatoes
|
||||
Date: 2018-08-05
|
||||
Last Update: 2018-11-10
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Set the new name for the group which is selected in the group list.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 75803;
|
||||
private _ctrlGroupList = _dialog displayCtrl 758038;
|
||||
private _ctrlEditName = _dialog displayCtrl 758039;
|
||||
private _grp = KPPLM_groups select (lbCurSel _ctrlGroupList);
|
||||
|
||||
// Only allow change, when player is leader
|
||||
if (leader _grp == player) then {
|
||||
_grp setGroupIdGlobal [ctrlText _ctrlEditName];
|
||||
|
||||
// Refresh Dialog
|
||||
closeDialog 0;
|
||||
[{!dialog}, {call KPPLM_fnc_openDialog;}] call CBA_fnc_waitUntilAndExecute;
|
||||
} else {
|
||||
hint localize "STR_KPPLM_NOTLEADER";
|
||||
[{hintSilent "";}, [], 3] call CBA_fnc_waitAndExecute;
|
||||
};
|
||||
|
||||
true
|
||||
52
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_save.sqf
Normal file
52
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_save.sqf
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
KPPLM_fnc_save
|
||||
|
||||
File: fn_save.sqf
|
||||
Author: Wyqer - https://github.com/KillahPotatoes
|
||||
Date: 2018-08-05
|
||||
Last Update: 2018-11-10
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Saves the selected settings from the player menu dialog and calls the apply function.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 75803;
|
||||
private _ctrlViewFoot = _dialog displayCtrl 7580310;
|
||||
private _ctrlViewVeh = _dialog displayCtrl 7580311;
|
||||
private _ctrlViewAir = _dialog displayCtrl 7580312;
|
||||
private _ctrlTerrain = _dialog displayCtrl 7580313;
|
||||
private _ctrlTpv = _dialog displayCtrl 7580314;
|
||||
private _ctrlRadio = _dialog displayCtrl 7580315;
|
||||
private _ctrlSliderSound = _dialog displayCtrl 7580317;
|
||||
|
||||
// Fetch all selected values
|
||||
KPPLM_viewFoot = round (parseNumber (ctrlText _ctrlViewFoot));
|
||||
if (KPPLM_viewFoot == 0) then {KPPLM_viewFoot = 1600;};
|
||||
KPPLM_viewVeh = round (parseNumber (ctrlText _ctrlViewVeh));
|
||||
if (KPPLM_viewVeh == 0) then {KPPLM_viewVeh = 1600;};
|
||||
KPPLM_viewAir = round (parseNumber (ctrlText _ctrlViewAir));
|
||||
if (KPPLM_viewAir == 0) then {KPPLM_viewAir = 1600;};
|
||||
KPPLM_terrain = lbCurSel _ctrlTerrain;
|
||||
KPPLM_tpv = lbCurSel _ctrlTpv;
|
||||
KPPLM_radio = lbCurSel _ctrlRadio;
|
||||
KPPLM_soundVeh = (round sliderPosition _ctrlSliderSound) / 100;
|
||||
|
||||
// Save settings in user profile
|
||||
profileNamespace setVariable ["KPPLM_Settings", [KPPLM_viewFoot, KPPLM_viewVeh, KPPLM_viewAir, KPPLM_terrain, KPPLM_tpv, KPPLM_radio, KPPLM_soundVeh]];
|
||||
saveProfileNamespace;
|
||||
|
||||
// Apply settings
|
||||
[] call KPPLM_fnc_apply;
|
||||
|
||||
// Close the dialog
|
||||
closeDialog 0;
|
||||
|
||||
true
|
||||
39
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_showRankData.sqf
Normal file
39
kp_liberation.brf_sumava/KP/KPPLM/fnc/fn_showRankData.sqf
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
KPPLM_fnc_showRankData
|
||||
|
||||
File: fn_showRankData.sqf
|
||||
Author: Wyqer - https://github.com/KillahPotatoes
|
||||
Date: 2018-08-05
|
||||
Last Update: 2018-11-10
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Reads the KP Ranks data of the current player and displays it in the player menu dialog.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 75803;
|
||||
private _ctrlRank = _dialog displayCtrl 758032;
|
||||
private _ctrlScore = _dialog displayCtrl 758034;
|
||||
private _ctrlPlaytime = _dialog displayCtrl 758036;
|
||||
private _ctrlNoRanks = _dialog displayCtrl 758037;
|
||||
|
||||
// Disable no ranks hint
|
||||
_ctrlNoRanks ctrlShow false;
|
||||
|
||||
// Show data in dialog
|
||||
_ctrlRank ctrlSetText ([] call KPR_fnc_getRankName);
|
||||
if (KPR_levelSystem) then {
|
||||
_ctrlScore ctrlSetText str ([] call KPR_fnc_getScore);
|
||||
} else {
|
||||
_ctrlScore ctrlSetText (localize "STR_KPPLM_NOLVLSYSTEM");
|
||||
};
|
||||
_ctrlPlaytime ctrlSetText ([] call KPR_fnc_getPlaytime);
|
||||
|
||||
true
|
||||
Reference in New Issue
Block a user