Zepheris
230ea2b038
ExileServer_system_rcon_thread_check.sqf added debug line to track server uptime and server restart countdown
1 line
11 KiB
JSON
1 line
11 KiB
JSON
[{"name":"MAR2D_fnc_getAllDeadA2","code":"private[\"_v\"];\r\n\r\n_v = [];\r\n{\r\n\t_v set [count _v, [typeOf _x,getPos _x]];\r\n} foreach(allDead);\r\n_v\r\n"},{"name":"MAR2D_fnc_getAllDeadA3","code":"private _v = [];\r\n{\r\n\t_v pushBack [typeOf _x,getPos _x];\r\n} foreach(allDead);\r\n_v\r\n"},{"name":"MAR2D_fnc_getAllLootA2","code":"private[\"_m\"];\r\n\r\n_m = [];\r\n{\r\n\t_m set [count _m, [typeOf _x, getPos _x]];\r\n} forEach ((allMissionObjects \"groundWeaponHolder\") + (entities \"WeaponHolderSimulated\"));\r\n_m\r\n"},{"name":"MAR2D_fnc_getAllLootA3","code":"private _m = [];\r\n{\r\n\t_m pushBack [typeOf _x, getPos _x];\r\n} forEach ((allMissionObjects \"groundWeaponHolder\") + (allMissionObjects \"LootWeaponHolder\") + (entities \"WeaponHolderSimulated\"));\r\n_m\r\n"},{"name":"MAR2D_fnc_getAllVehiclesA2","code":"private[\"_v\"];\r\n_v=[];\r\n\r\n{\r\n\tif ((count(crew _x))==0) then {\r\n\t\t_v set [count _v, [getText(configFile>>\"CfgVehicles\">>(typeOf _x)>>\"displayName\"),getPos _x]];\r\n\t};\r\n} foreach ([0,0,0] nearEntities[\"AllVehicles\",1000000]);\r\n_v\r\n"},{"name":"MAR2D_fnc_getAllVehiclesA3","code":"private _v = [];\r\n{\r\n\tif((count(crew _x))==0) then\r\n\t{\r\n\t\t_v pushBack [getText(configFile>>\"CfgVehicles\">>(typeOf _x)>>\"displayName\"),getPos _x];\r\n\t};\r\n} foreach ([0,0,0] nearEntities [\"AllVehicles\",1000000]);\r\n_v\r\n"},{"name":"MAR2D_fnc_getMapMarkersA2","code":"[]\n"},{"name":"MAR2D_fnc_getMapMarkersA3","code":"private[\"_m\"];\n\n_m=[];\n{\n\tif (markerText _x != \"\") then\n\t{\n\t\t_m set [count _m, [markerText _x, getMarkerPos _x]];\n\t};\n} forEach allMapMarkers;\n_m\n"},{"name":"MAR_fnc_execute","code":"private ['_id', '_code', '_args', '_timeout', '_return', '_varname', '_randvar', '_handle', '_start', '_time', '_val'];\r\n\r\n_id = _this select 0;\r\n_code = _this select 1;\r\n_args = _this select 2;\r\n_timeout = if (count _this > 3) then {_this select 3} else {true};\r\n_return = if (count _this > 4) then {_this select 4} else {false};\r\n_varname = 'MRDRV_' + _id;\r\n\r\nmissionNamespace setVariable [_varname, nil];\r\n_handle = [_args, _code, _varname, _return] spawn {\r\n\tif (_this select 3) then {\r\n\t\tmissionNamespace setVariable [_this select 2, (_this select 0) call (_this select 1)];\r\n\t} else {\r\n\t\t(_this select 0) call (_this select 1);\r\n\t\tmissionNamespace setVariable [_this select 2, true];\r\n\t};\r\n};\r\nif (!_timeout) exitWith {\r\n\t\"marma-debug\" callExtension ('8:' + _id + ':Code executed');\r\n};\r\n_start = diag_tickTime;\r\nwaitUntil {\r\n\t(diag_tickTime - _start) > 60 ||\r\n\tscriptDone _handle\r\n};\r\nterminate _handle;\r\n_time = diag_tickTime - _start;\r\n\r\nif (isNil _varname) then {\r\n\t\"marma-debug\" callExtension ('8:' + _id + ':Error - Code timed out');\r\n} else {\r\n\tif (_return) then {\r\n\t\t_val = missionNamespace getVariable [_varname, ''];\r\n\t\tif (typeName _val != 'STRING') then {\r\n\t\t\t_val = str _val;\r\n\t\t};\r\n\t\t\"marma-debug\" callExtension ('8:' + _id + ':' + _val);\r\n\t} else {\r\n\t\t\"marma-debug\" callExtension ('8:' + _id + format[':Code executed in %1 seconds', _time]);\r\n\t};\r\n};\r\n"},{"name":"MAR_fnc_getJob","code":"private ['_default', '_response', '_id', '_command', '_argStr', '_args'];\r\n_default = [-1, '', ''];\r\n_string = \"marma-debug\" callExtension '6';\r\n_response = call compile _string;\r\n\r\nif (isNil '_response') exitWith {\r\n\t['Error parsing job response (isNil) ' + _string, 'error'] call MAR_fnc_log;\r\n};\r\n\r\nif (count _response != 2) exitWith {\r\n\t['Error parsing job response (response count wrong) ' + _string, 'error'] call MAR_fnc_log;\r\n};\r\n\r\n_id = _response select 0;\r\nif (typeName _id != 'STRING') exitWith {\r\n\t['Error parsing job response (job id nan) ' + _string, 'error'] call MAR_fnc_log;\r\n};\r\n\r\n_command = _response select 1;\r\nif (typeName _command != 'STRING') exitWith {\r\n\t\"marma-debug\" callExtension ('8:' + _id + ':Error parsing job response (command not a string) ' + _string);\r\n};\r\n\r\n_argStr = '';\r\nwhile {true} do {\r\n\t_response = \"marma-debug\" callExtension ('7:' + _id);\r\n\tif (_response == '') exitWith {};\r\n\t_argStr = _argStr + _response;\r\n};\r\n\r\n_args = call compile _argStr;\r\nif (isNil '_args') exitWith {\r\n\t\"marma-debug\" callExtension ('8:' + _id + ':Error parsing job args (isNil) ' + _argStr);\r\n};\r\n\r\nif (typeName _args != 'ARRAY') exitWith {\r\n\t\"marma-debug\" callExtension ('8:' + _id + ':Error parsing job args (not array) ' + _argStr);\r\n};\r\n\r\n[_id, _command, _args] call MAR_fnc_processJob;\r\n"},{"name":"MAR_fnc_getJob_A3_168","code":"private ['_default', '_response', '_id', '_command', '_argStr', '_args'];\r\n_default = [-1, '', ''];\r\n_string = \"marma-debug\" callExtension '6';\r\n_response = parseSimpleArray _string;\r\n\r\nif (isNil '_response') exitWith {\r\n\t['Error parsing job response (isNil) ' + _string, 'error'] call MAR_fnc_log;\r\n};\r\n\r\nif (count _response != 2) exitWith {\r\n\t['Error parsing job response (response count wrong) ' + _string, 'error'] call MAR_fnc_log;\r\n};\r\n\r\n_id = _response select 0;\r\nif (typeName _id != 'STRING') exitWith {\r\n\t['Error parsing job response (job id nan) ' + _string, 'error'] call MAR_fnc_log;\r\n};\r\n\r\n_command = _response select 1;\r\nif (typeName _command != 'STRING') exitWith {\r\n\t\"marma-debug\" callExtension ('8:' + _id + ':Error parsing job response (command not a string) ' + _string);\r\n};\r\n\r\n_argStr = '';\r\nwhile {true} do {\r\n\t_response = \"marma-debug\" callExtension ('7:' + _id);\r\n\tif (_response == '') exitWith {};\r\n\t_argStr = _argStr + _response;\r\n};\r\n\r\n_args = call compile _argStr;\r\nif (isNil '_args') exitWith {\r\n\t\"marma-debug\" callExtension ('8:' + _id + ':Error parsing job args (isNil) ' + _argStr);\r\n};\r\n\r\nif (typeName _args != 'ARRAY') exitWith {\r\n\t\"marma-debug\" callExtension ('8:' + _id + ':Error parsing job args (not array) ' + _argStr);\r\n};\r\n\r\n[_id, _command, _args] call MAR_fnc_processJob;\r\n"},{"name":"MAR_fnc_getPlayers","code":"private ['_players', '_land', '_plane', '_chopper', '_parachute', '_boat', '_added'];\r\n_players = [];\r\n_land = [];\r\n_plane = [];\r\n_chopper = [];\r\n_parachute = [];\r\n_boat = [];\r\n\r\n_added = [];\r\n{\r\n\tprivate ['_vehicle', '_data', '_crew', '_parents'];\r\n\tif (isPlayer _x) then {\r\n\t\tif (_x != vehicle _x) then {\r\n\t\t\tcomment \"in vehicle\";\r\n\t\t\t_vehicle = vehicle _x;\r\n\t\t\tif !(_vehicle in _added) then {\r\n\t\t\t\t_added set [count _added, _vehicle];\r\n\t\t\t\t_data = [\r\n\t\t\t\t\ttypeOf _vehicle,\r\n\t\t\t\t\tgetPosASL _vehicle,\r\n\t\t\t\t\tgetDir _vehicle,\r\n\t\t\t\t\tgetText (configFile >> 'CfgVehicles' >> typeOf _vehicle >> 'displayName')\r\n\t\t\t\t];\r\n\t\t\t\t_crew = [];\r\n\t\t\t\t{\r\n\t\t\t\t\t_crew set [count _crew, [\r\n\t\t\t\t\t\tname _x,\r\n\t\t\t\t\t\tgetPlayerUID _x,\r\n\t\t\t\t\t\tstr side _x\r\n\t\t\t\t\t]];\r\n\t\t\t\t} forEach (crew _vehicle);\r\n\t\t\t\t_data set [count _data, _crew];\r\n\t\t\t\t_parents = [configFile >> 'CfgVehicles' >> (typeOf _vehicle), true] call BIS_fnc_returnParents;\r\n\t\t\t\tswitch (true) do {\r\n \tcase ('ParachuteBase' in _parents): {\r\n _parachute set [count _parachute, _data];\r\n \t};\r\n\t\t\t\t\tcase ('Helicopter' in _parents): {\r\n\t\t\t\t\t\t_chopper set [count _chopper, _data];\r\n\t\t\t\t\t};\r\n\t\t\t\t\tcase ('Plane' in _parents): {\r\n\t\t\t\t\t\t_plane set [count _plane, _data];\r\n\t\t\t\t\t};\r\n \tcase ('Boat' in _parents): {\r\n \t_boat set [count _boat, _data];\r\n \t};\r\n\t\t\t\t\tdefault {\r\n\t\t\t\t\t\t_land set [count _land, _data];\r\n\t\t\t\t\t};\r\n\t\t\t\t};\r\n\t\t\t};\r\n\t\t} else {\r\n\t\t\tcomment \"on foot\";\r\n\t\t\tif !(_x in _added) then {\r\n\t\t\t\t_players set [count _players, [\r\n\t\t\t\t\tname _x,\r\n\t\t\t\t\tgetPlayerUID _x,\r\n\t\t\t\t\tgetPosASL _x,\r\n\t\t\t\t\tgetDir _x,\r\n\t\t\t\t\tstr side _x\r\n\t\t\t\t]];\r\n\t\t\t\t_added set [count _added, _x];\r\n\t\t\t};\r\n\t\t};\r\n\t};\r\n} forEach playableUnits;\r\n[_players, _land, _plane, _chopper, _parachute, _boat]"},{"name":"MAR_fnc_jobThread","code":"scriptName 'mARMA Job Thread';\r\n\r\nMAR_jobThreadActive = false;\r\nwhile {true} do {\r\n\tMAR_jobThreadActive = true;\r\n\tif ((\"marma-debug\" callExtension '5') == \"true\") then {\r\n\t\tcall MAR_fnc_getJob;\r\n\t};\r\n\tsleep 1;\r\n};\r\n"},{"name":"MAR_fnc_processJob","code":"private ['_id', '_command', '_args', '_response'];\r\n_id = _this select 0;\r\n_command = _this select 1;\r\n_args = _this select 2;\r\n\r\nswitch (_command) do {\r\n\tcase 're': {\r\n\t\t[_id, _args select 0, _args select 1, true, false] call MAR_fnc_execute;\r\n\t};\r\n\tcase 'reNoTimeout': {\r\n\t\t[_id, _args select 0, _args select 1, false, false] call MAR_fnc_execute;\r\n\t};\r\n\tcase 'reReturn': {\r\n\t\t[_id, _args select 0, _args select 1, true, true] call MAR_fnc_execute;\r\n\t};\r\n\tcase 'players': {\r\n\t\t_response = call MAR_fnc_getPlayers;\r\n\t\t\"marma-debug\" callExtension ('8:' + _id + ':' + (str _response));\r\n\t};\r\n\tdefault {\r\n\t\t\"marma-debug\" callExtension ('8:' + _id + ':Unknown Command');\r\n\t};\r\n};\r\n"},{"name":"MAR_fnc_setupA2","code":"private ['_list'];\r\ncomment \"[FuncName, FileName]\";\r\ncomment \"Main reason is ability to have different versions of functions for Arma2\/3\";\r\n_list = [\r\n\t['MAR_fnc_getPlayers','MAR_fnc_getPlayers'],\r\n\t['MAR_fnc_processJob','MAR_fnc_processJob'],\r\n\t['MAR_fnc_getJob','MAR_fnc_getJob'],\r\n\t['MAR_fnc_jobThread','MAR_fnc_jobThread'],\r\n\t['MAR_fnc_execute','MAR_fnc_execute'],\r\n\t['MAR2D_fnc_getAllDead','MAR2D_fnc_getAllDeadA2'],\r\n\t['MAR2D_fnc_getAllLoot','MAR2D_fnc_getAllLootA2'],\r\n\t['MAR2D_fnc_getAllVehicles','MAR2D_fnc_getAllVehiclesA2'],\r\n\t['MAR2D_fnc_getMapMarkers','MAR2D_fnc_getMapMarkersA2']\r\n];\r\n\r\n{\r\n\tprivate ['_sqf_func'];\r\n\tdiag_log ('mARMA Debug: Compiling SQFCode: ' + (_x select 0));\r\n\t_sqf_func = [(_x select 1)] call MAR_fnc_getcfnc;\r\n\tmissionNamespace setVariable [(_x select 0), (compile _sqf_func)];\r\n} forEach _list;\r\n"},{"name":"MAR_fnc_setupA3","code":"comment \"[FuncName, FileName]\";\r\ncomment \"Main reason is ability to have different versions of functions for Arma2\/3\";\r\nprivate _list = [\r\n\t['MAR_fnc_getPlayers','MAR_fnc_getPlayers'],\r\n\t['MAR_fnc_processJob','MAR_fnc_processJob'],\r\n\t['MAR_fnc_jobThread','MAR_fnc_jobThread'],\r\n\t['MAR_fnc_execute','MAR_fnc_execute'],\r\n\t['MAR2D_fnc_getAllDead','MAR2D_fnc_getAllDeadA3'],\r\n\t['MAR2D_fnc_getAllLoot','MAR2D_fnc_getAllLootA3'],\r\n\t['MAR2D_fnc_getAllVehicles','MAR2D_fnc_getAllVehiclesA3'],\r\n\t['MAR2D_fnc_getMapMarkers','MAR2D_fnc_getMapMarkersA3']\r\n];\r\n\r\nif (((productVersion) select 2) >= 168) then\r\n{\r\n\t_list pushBack ['MAR_fnc_getJob','MAR_fnc_getJob_A3_168'];\r\n} else {\r\n\t_list pushBack ['MAR_fnc_getJob','MAR_fnc_getJob'];\r\n};\r\n\r\n{\r\n\tdiag_log ('mARMA Debug: Compiling SQFCode: ' + (_x select 0));\r\n\tprivate _sqf_func = [(_x select 1)] call MAR_fnc_getcfnc;\r\n\tmissionNamespace setVariable [(_x select 0), (compileFinal _sqf_func)];\r\n} forEach _list;\r\n"}] |