Skip to content

Instantly share code, notes, and snippets.

@GeorgeDettmer
Created October 11, 2017 23:12
Show Gist options
  • Save GeorgeDettmer/bc179d2da73bb2a40983b6f57c8b6391 to your computer and use it in GitHub Desktop.
Save GeorgeDettmer/bc179d2da73bb2a40983b6f57c8b6391 to your computer and use it in GitHub Desktop.
See m8 I am re-writing it all AGAIN 2k20 here we cum
private _startTime = diag_tickTime;
survive_server_fnc_log = compileFinal preprocessFileLineNumbers "survive_server\functions\server\log.sqf";
"Beginning function compile..." call SURVIVE_server_fnc_log;
private _totalFunctionsDefined = 0;
{
private _functionTarget = _x;
private _totalFunctionsOfTargetDefined = 0;
format[" Defining '%1' functions:",configName _functionTarget] call SURVIVE_server_fnc_log;
{
private _function = configName _x;
private _file = format["survive_server\functions\%1\%2.sqf",configName _functionTarget,_function];
private _broadcast = getNumber(_x >> "broadcast") > 0;
if !_broadcast then {
_broadcast = getNumber(_functionTarget >> "broadcast") > 0
};
private _code = preprocessFileLineNumbers _file;
if (str _code isEqualTo "{}") then [{
_code = format["Something went wrong during function compile. Function %1(%2) not defined properly!",_function,_file];
_code call SURVIVE_server_fnc_log;
_code = format["systemChat 'SURVIVE | %1'; diag_log 'SURVIVE | %1';",_code];
},{
format[" %1 defined, broadcast: %2",_function,_broadcast] call SURVIVE_server_fnc_log;
_totalFunctionsDefined = _totalFunctionsDefined +1;
_totalFunctionsOfTargetDefined = _totalFunctionsOfTargetDefined +1;
}];
_code = format["_survive_scriptName = '%1'; _survive_broadcast = %2; ",_function,_broadcast] + _code;
missionNamespace setVariable [format["survive_%1_fnc_%2",_functionTarget,_function],compileFinal _code,_broadcast];
} forEach "true" configClasses _x;
format[" Defined %1 '%2' functions",_totalFunctionsOfTargetDefined,configName _functionTarget] call SURVIVE_server_fnc_log;
} forEach "true" configClasses (configFile >> "CfgSurviveServer" >> "CfgFunctions");
format["Function compile complete, compiled %1 functions in %2s",_totalFunctionsDefined,diag_tickTime-_startTime] call SURVIVE_server_fnc_log;
diag_tickTime call survive_server_fnc_preInit;
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment