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

Mission initialization overhaul #483

Merged
merged 11 commits into from
Aug 31, 2018
Prev Previous commit
Next Next commit
Changed initModule.sqf calling to pre-/postInit functions
Wyqer committed Aug 31, 2018

Verified

This commit was signed with the committer’s verified signature.
broonie Mark Brown
commit 6278a98707bf93299046a874eadc1c126b1c5a27
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
/*
KP LIBERATION MODULE INITIALIZATION
KPLIB_fnc_init_postInitModule

File: initModule.sqf
File: fn_init_postInitModule.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2017-10-16
Last Update: 2018-03-29
Date: 2017-08-31
Last Update: 2018-08-31
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
This module initialize basically everything that should be done before the player passes the briefing screen.
Tasks of this module are:
* Fetch parameters
* Fetch config values
* Define basic ui values
* Fetch, check and distribute preset data
* Sort sector markers to specific arrays
* Initialize the save manager
* Connect unlockable vehicles to military sectors
@@ -23,22 +18,15 @@

Dependencies:
NONE

Returns:
BOOL
*/
if(isServer) then {
DEBUG_EVENTS = [
"KPLIB_vehicle_spawned",
"KPLIB_fob_built",
"KPLIB_sector_activated",
"KPLIB_sector_captured",
"KPLIB_sector_deactivated",
"KPLIB_player_fob"
];

{
[_x, compile ("diag_log 'eventCalled " + _x + "'; diag_log _this;")] call CBA_fnc_addEventHandler;
[_x, compile ("systemChat 'eventCalled " + _x + "'; systemChat format['%1', _this];")] call CBA_fnc_addEventHandler;
} forEach DEBUG_EVENTS;
};

if (!isServer) exitWith {};

diag_log format ["[KP LIBERATION] [%1] [POSTINIT] Module initializing...", diag_tickTime];


// Read the module globals
call compile preprocessFileLineNumbers "modules\00_init\globals.sqf";
@@ -58,3 +46,7 @@ execVM "modules\00_init\scripts\server\saveTimer\timer.sqf";

// Create locked vehicle markers
call KPLIB_fnc_init_createLockedVehMarkers;

diag_log format ["[KP LIBERATION] [%1] [POSTINIT] Module initialized", diag_tickTime];

true
62 changes: 62 additions & 0 deletions Missionframework/modules/00_init/fnc/fn_init_preInitModule.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
KPLIB_fnc_init_preInitModule

File: fn_init_preInitModule.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2017-08-31
Last Update: 2018-08-31
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Tasks of this module are:
* Fetch parameters
* Fetch config values
* Define basic ui values
* Fetch, check and distribute preset data

Dependencies:
NONE

Returns:
BOOL
*/

if (!isServer) exitWith {};

diag_log format ["[KP LIBERATION] [%1] [PREINIT] Module initializing...", diag_tickTime];

// Deactivate vanilla saving
enableSaving [false, false];

// Initialize Debug Events
DEBUG_EVENTS = [
"KPLIB_vehicle_spawned",
"KPLIB_fob_built",
"KPLIB_sector_activated",
"KPLIB_sector_captured",
"KPLIB_sector_deactivated",
"KPLIB_player_fob"
];

{
[_x, compile ("diag_log 'eventCalled " + _x + "'; diag_log _this;")] call CBA_fnc_addEventHandler;
[_x, compile ("systemChat 'eventCalled " + _x + "'; systemChat format['%1', _this];")] call CBA_fnc_addEventHandler;
} forEach DEBUG_EVENTS;

// Check for ACE
KPLIB_ace_enabled = isClass (configFile >> "CfgPatches" >> "ace_main");
KPLIB_ace_medical = isClass (configfile >> "CfgPatches" >> "ace_medical");

// Check for KP Ranks
KPLIB_kpr_enabled = isClass (configFile >> "CfgPatches" >> "KP_Ranks");

// Parameter processing
KPLIB_param_source = ["LoadSaveParams", 1] call BIS_fnc_getParamValue;
call KPLIB_fnc_init_paramFetchAll;

// Read the KPLIB_config.sqf file
call compile preprocessFileLineNumbers "KPLIB_config.sqf";

diag_log format ["[KP LIBERATION] [%1] [PREINIT] Module initialized", diag_tickTime];

true
45 changes: 0 additions & 45 deletions Missionframework/modules/00_init/fnc/fn_init_setupConfig.sqf

This file was deleted.

22 changes: 14 additions & 8 deletions Missionframework/modules/00_init/functions.hpp
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
File: functions.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2017-10-16
Last Update: 2018-05-02
Last Update: 2018-08-31
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
@@ -34,6 +34,16 @@ class init {
// Filters not available classnames out of a given array of classnames
class init_filterMods {};

// Module post initialization
class init_postInitModule {
postInit = 1;
};

// Module pre initialization
class init_preInitModule {
preInit = 1;
};

// Initializes full load procedure for the saved campaign
class init_load {};

@@ -53,20 +63,16 @@ class init {
class init_paramVarCreate {};

// Client function for processing init data which was published by the server
class init_receiveInit {};
class init_receiveInit {
postInit = 1;
};

// Initializes full saves procedure for the running campaign
class init_save {};

// Saves module specific data for the save
class init_saveData {};

// Setups global variables from params
// Also initializes mission config
class init_setupConfig {
preInit = 1;
};

// Sorts sector markers and fills global sector arrays
class init_sortSectors {};

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
KP LIBERATION MODULE INITIALIZATION
KPLIB_fnc_core_initModule

File: initModule.sqf
File: fn_core_initModule.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2017-10-28
Last Update: 2018-08-26
Date: 2017-08-31
Last Update: 2018-08-31
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
@@ -19,8 +19,13 @@

Dependencies:
* 00_init

Returns:
BOOL
*/

if (isServer) then {diag_log format ["[KP LIBERATION] [%1] [CORE] Module initializing...", diag_tickTime];};

// Read the module globals
call compile preprocessFileLineNumbers "modules\01_core\globals.sqf";

@@ -50,3 +55,7 @@ if (hasInterface) then {
// Start the intro cinematic
[] spawn KPLIB_fnc_core_intro;
};

if (isServer) then {diag_log format ["[KP LIBERATION] [%1] [CORE] Module initialized", diag_tickTime];};

true
7 changes: 6 additions & 1 deletion Missionframework/modules/01_core/functions.hpp
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
File: functions.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2017-10-28
Last Update: 2018-08-26
Last Update: 2018-08-31
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
@@ -47,6 +47,11 @@ class core {
// Handle an activated sector
class core_handleSector {};

// Module initialization
class core_initModule {
postInit = 1;
};

// Start the intro cinematic
class core_intro {};

Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
/*
KP LIBERATION MODULE INITIALIZATION
KPLIB_fnc_build_initModule

File: initModule.sqf
File: fn_build_initModule.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-07-01
Last Update: 2018-07-01
Date: 2017-08-31
Last Update: 2018-08-31
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
This module provides building functionalities

Dependencies:
* 01_core

Returns:
BOOL
*/

if (isServer) then {diag_log format ["[KP LIBERATION] [%1] [BUILD] Module initializing...", diag_tickTime];};

call compile preprocessFileLineNumbers "modules\02_build\globals.sqf";

call KPLIB_fnc_build_setupPlayerActions;

if (isServer) then {diag_log format ["[KP LIBERATION] [%1] [BUILD] Module initialized", diag_tickTime];};

true
7 changes: 6 additions & 1 deletion Missionframework/modules/02_build/functions.hpp
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
File: functions.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-07-01
Last Update: 2018-07-01
Last Update: 2018-08-31
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
@@ -28,5 +28,10 @@ class build {

class build_displayScript {};

// Module initialization
class build_initModule {
postInit = 1;
};

class build_setupPlayerActions {};
};