Advertisement
Marz1pan

Untitled

Nov 1st, 2019
721
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 5.57 KB | None | 0 0
  1. #include "\ocap\script_macros.hpp"
  2. private _isKindOfApc = {
  3.     _bool = false;
  4.     {
  5.         if (_this isKindOf _x) exitWith {_bool = true;};false
  6.     } count ["Wheeled_APC_F","Tracked_APC","APC_Wheeled_01_base_F","APC_Wheeled_02_base_F",
  7.     "APC_Wheeled_03_base_F","APC_Tracked_01_base_F","APC_Tracked_02_base_F","APC_Tracked_03_base_F"];
  8.     _bool
  9. };
  10. private _getClass = {
  11.     if (_this isKindOf "Truck_F") exitWith {"truck"}; // Should be higher than Car
  12.     if (_this call _isKindOfApc) exitWith {"apc"};
  13.     if (_this isKindOf "Car") exitWith {"car"};
  14.     if (_this isKindOf "Tank") exitWith {"tank"};
  15.     if (_this isKindOf "StaticMortar") exitWith {"static-mortar"};
  16.     if (_this isKindOf "StaticWeapon") exitWith {"static-weapon"};
  17.     if (_this isKindOf "ParachuteBase") exitWith {"parachute"};
  18.     if (_this isKindOf "Helicopter") exitWith {"heli"};
  19.     if (_this isKindOf "Plane") exitWith {"plane"};
  20.     if (_this isKindOf "Air") exitWith {"plane"};
  21.     if (_this isKindOf "Ship") exitWith {"sea"};
  22.     if (_this isKindOf "TimeBombCore") exitWith {"explosive"};
  23.     "unknown"
  24. };
  25.  
  26. waitUntil{sleep 5.127; (count(allPlayers) >= ocap_minPlayerCount) && (a3a_var_started)};
  27. ocap_capture = true;
  28. ocap_startTime = time;
  29. LOG(ARR3(__FILE__, "ocap_capture start, time:", ocap_startTime));
  30. private _id = 0;
  31.  
  32. {    
  33.     private _tempArray = [];  
  34.     _playersMarker = toArray _x;
  35.     _playersMarker resize 15;
  36.     _swtMarker = toArray _x;  
  37.     _swtMarker resize 6;  
  38.     if ((toString _playersMarker != "_USER_DEFINED #") && (toString _swtMarker != "SWT_M#")) then {
  39.         _tempArray pushBack _x;
  40.         _tempArray pushBack (markerText _x);    
  41.         _tempArray pushBack (getMarkerType _x);  
  42.         _tempArray pushBack (getMarkerPos _x);  
  43.         _tempArray pushBack (getMarkerSize _x);  
  44.         _tempArray pushBack (getMarkerColor _x);
  45.         _tempArray pushBack (markerBrush _x);
  46.         _tempArray pushBack (markerAlpha _x);
  47.         _tempArray pushBack round(markerDir _x);
  48.         [":EDITORMARKER:CREATE:", _tempArray] call ocap_fnc_extension;
  49.     }  
  50. } forEach allMapMarkers;
  51.  
  52.  
  53. while {ocap_capture} do {
  54.     isNil {
  55.         {
  56.             if !(_x getVariable ["ocap_isInitialised", false]) then {
  57.                 if (_x isKindOf "Logic") exitWith {
  58.                     _x setVariable ["ocap_exclude", true];
  59.                     _x setVariable ["ocap_isInitialised", true];
  60.                 };
  61.                 _x setVariable ["ocap_id", _id];
  62.                 [":NEW:UNIT:", [
  63.                     ocap_captureFrameNo, //1
  64.                     _id, //2
  65.                     name _x,  //3
  66.                     groupID (group _x),  //4
  67.                     str side _x,  //5
  68.                     BOOL(isPlayer _x),  //6
  69.                     roleDescription _x  //7
  70.                 ]] call ocap_fnc_extension;
  71.                 _x spawn ocap_fnc_addEventHandlers;
  72.                 _id = _id + 1;
  73.                 _x setVariable ["ocap_isInitialised", true];
  74.             };
  75.             if !(_x getVariable ["ocap_exclude", false]) then {
  76.                 _pos = getPosATL _x;
  77.                 _pos resize 2;
  78.                 [":UPDATE:UNIT:", [
  79.                     (_x getVariable "ocap_id"), //1
  80.                     _pos,  //2
  81.                     round getDir _x,  //3
  82.                     if (alive _x) then {
  83.                         BOOL(_x getVariable ["ACE_isUnconscious", false]) + 1
  84.                     } else {
  85.                         0
  86.                     },  //4
  87.                     BOOL(!((vehicle _x) isEqualTo _x)),  //5
  88.                     if (alive _x) then {name _x} else {""}, //6
  89.                     BOOL(isPlayer _x) //7
  90.                 ]] call ocap_fnc_extension;
  91.             };
  92.             false
  93.         } count (allUnits + allDeadMen);
  94.  
  95.         {
  96.             if !(_x getVariable ["ocap_isInitialised", false]) then {
  97.                 _vehType = typeOf _x;
  98.                 _class = _vehType call _getClass;
  99.                 if ((_class isEqualTo "unknown") || (_vehType in ocap_excludeFromRecord)) exitWith {
  100.                     LOG(ARR2("WARNING: vehicle is defined as 'unknown' or exclude:", _vehType));
  101.                     _x setVariable ["ocap_isInitialised", true];
  102.                     _x setVariable ["ocap_exclude", true];
  103.                 };
  104.                 _x setVariable ["ocap_id", _id];
  105.                 [":NEW:VEH:", [
  106.                     ocap_captureFrameNo, //1
  107.                     _id, //2
  108.                     _class,  //3
  109.                     getText (configFile >> "CfgVehicles" >> _vehType >> "displayName")  //4
  110.                 ]] call ocap_fnc_extension;
  111.                 _x spawn ocap_fnc_addEventHandlers;
  112.                 _id = _id + 1;
  113.                 _x setVariable ["ocap_isInitialised", true];
  114.             };
  115.             if !(_x getVariable ["ocap_exclude", false]) then {
  116.                 private _crew = [];
  117.                 {
  118.                     if (_x getVariable ["ocap_isInitialised", false]) then {
  119.                         _crew pushBack (_x getVariable "ocap_id");
  120.                     }; false
  121.                 } count (crew _x);
  122.                 _pos = getPosATL _x;
  123.                 _pos set [2, round(_pos select 2)];
  124.                 [":UPDATE:VEH:", [
  125.                     (_x getVariable "ocap_id"), //1
  126.                     _pos,  //2
  127.                     round getDir _x,  //3
  128.                     BOOL(alive _x),  //4
  129.                     _crew  //5
  130.                 ]] call ocap_fnc_extension;
  131.             };
  132.             false
  133.         } count vehicles;
  134.        
  135.        
  136.        
  137.        
  138.        
  139.         {
  140.             if !(_x getVariable ["ocap_isInitialised", false]) then {
  141.                 _ammoType = typeOf _x;
  142.                 _class = _ammoType call _getClass;
  143.                 if ((_class isEqualTo "unknown") || (_ammoType in ocap_excludeFromRecord)) exitWith {
  144.                     LOG(ARR2("WARNING: vehicle is defined as 'unknown' or exclude:", _ammoType));
  145.                     _x setVariable ["ocap_isInitialised", true];
  146.                     _x setVariable ["ocap_exclude", true];
  147.                 };
  148.                 _x setVariable ["ocap_id", _id];
  149.                 [":NEW:VEH:", [
  150.                     ocap_captureFrameNo, //1
  151.                     _id, //2
  152.                     _class,  //3
  153.                     _ammoType  //4
  154.                 ]] call ocap_fnc_extension;
  155.                 _x spawn ocap_fnc_addEventHandlers;
  156.                 _id = _id + 1;
  157.                 _x setVariable ["ocap_isInitialised", true];
  158.             };
  159.             if !(_x getVariable ["ocap_exclude", false]) then {
  160.                 private _crew = [];
  161.                
  162.                 _pos = getPosATL _x;
  163.                 _pos set [2, round(_pos select 2)];
  164.                 [":UPDATE:VEH:", [
  165.                     (_x getVariable "ocap_id"), //1
  166.                     _pos,  //2
  167.                     round getDir _x,  //3
  168.                     BOOL(alive _x),  //4
  169.                     _crew  //5
  170.                 ]] call ocap_fnc_extension;
  171.             };
  172.             false
  173.         } count allMines;
  174.                
  175.     };
  176.     sleep (call ocap_fnc_getDelay);
  177.     ocap_captureFrameNo = ocap_captureFrameNo + 1;
  178. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement