Arma3_Exile_Mission/@marma/code/sqf.json

1 line
11 KiB
JSON
Raw Normal View History

[{"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}