Advertisement
Marz1pan

Untitled

Nov 2nd, 2019
684
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 5.06 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.     "unknown"
  23. };
  24.  
  25. waitUntil{sleep 5.127; (count(allPlayers) >= ocap_minPlayerCount)};
  26. ocap_capture = true;
  27. ocap_startTime = time;
  28. LOG(ARR3(__FILE__, "ocap_capture start, time:", ocap_startTime));
  29. private _id = 0;
  30.  
  31. {    
  32.     private _tempArray = [];  
  33.     _playersMarker = toArray _x;
  34.     _playersMarker resize 15;
  35.     _swtMarker = toArray _x;  
  36.     _swtMarker resize 6;  
  37.     if ((toString _playersMarker != "_USER_DEFINED #") && (toString _swtMarker != "SWT_M#")) then {
  38.         _tempArray pushBack _x;
  39.         _tempArray pushBack (markerText _x);    
  40.         _tempArray pushBack (getMarkerType _x);  
  41.         _tempArray pushBack (getMarkerPos _x);  
  42.         _tempArray pushBack (getMarkerSize _x);  
  43.         _tempArray pushBack (getMarkerColor _x);
  44.         _tempArray pushBack (markerBrush _x);
  45.         _tempArray pushBack (markerAlpha _x);
  46.         _tempArray pushBack round(markerDir _x);
  47.         [":EDITORMARKER:CREATE:", _tempArray] call ocap_fnc_extension;
  48.     }  
  49. } forEach allMapMarkers;
  50.  
  51.  
  52. while {ocap_capture} do {
  53.     isNil {
  54.         {
  55.             if !(_x getVariable ["ocap_isInitialised", false]) then {
  56.                 if (_x isKindOf "Logic") exitWith {
  57.                     _x setVariable ["ocap_exclude", true];
  58.                     _x setVariable ["ocap_isInitialised", true];
  59.                 };
  60.                 _x setVariable ["ocap_id", _id];
  61.                 [":NEW:UNIT:", [
  62.                     ocap_captureFrameNo, //1
  63.                     _id, //2
  64.                     name _x,  //3
  65.                     groupID (group _x),  //4
  66.                     str side _x,  //5
  67.                     BOOL(isPlayer _x),  //6
  68.                     roleDescription _x  //7
  69.                 ]] call ocap_fnc_extension;
  70.                 _x spawn ocap_fnc_addEventHandlers;
  71.                 _id = _id + 1;
  72.                 _x setVariable ["ocap_isInitialised", true];
  73.             };
  74.             if !(_x getVariable ["ocap_exclude", false]) then {
  75.                 _pos = getPosATL _x;
  76.                 _pos resize 2;
  77.                 [":UPDATE:UNIT:", [
  78.                     (_x getVariable "ocap_id"), //1
  79.                     _pos,  //2
  80.                     round getDir _x,  //3
  81.                     if (alive _x) then {
  82.                         BOOL(_x getVariable ["ACE_isUnconscious", false]) + 1
  83.                     } else {
  84.                         0
  85.                     },  //4
  86.                     BOOL(!((vehicle _x) isEqualTo _x)),  //5
  87.                     if (alive _x) then {name _x} else {""}, //6
  88.                     BOOL(isPlayer _x) //7
  89.                 ]] call ocap_fnc_extension;
  90.             };
  91.             false
  92.         } count (allUnits + allDeadMen);
  93.  
  94.         {
  95.             if !(_x getVariable ["ocap_isInitialised", false]) then {
  96.                 _vehType = typeOf _x;
  97.                 _class = _vehType call _getClass;
  98.                 if ((_class isEqualTo "unknown") || (_vehType in ocap_excludeFromRecord)) exitWith {
  99.                     LOG(ARR2("WARNING: vehicle is defined as 'unknown' or exclude:", _vehType));
  100.                     _x setVariable ["ocap_isInitialised", true];
  101.                     _x setVariable ["ocap_exclude", true];
  102.                 };
  103.                 _x setVariable ["ocap_id", _id];
  104.                 [":NEW:VEH:", [
  105.                     ocap_captureFrameNo, //1
  106.                     _id, //2
  107.                     _class,  //3
  108.                     getText (configFile >> "CfgVehicles" >> _vehType >> "displayName")  //4
  109.                 ]] call ocap_fnc_extension;
  110.                 _x spawn ocap_fnc_addEventHandlers;
  111.                 _id = _id + 1;
  112.                 _x setVariable ["ocap_isInitialised", true];
  113.             };
  114.             if !(_x getVariable ["ocap_exclude", false]) then {
  115.                 private _crew = [];
  116.                 {
  117.                     if (_x getVariable ["ocap_isInitialised", false]) then {
  118.                         _crew pushBack (_x getVariable "ocap_id");
  119.                     }; false
  120.                 } count (crew _x);
  121.                 _pos = getPosATL _x;
  122.                 _pos set [2, round(_pos select 2)];
  123.                 [":UPDATE:VEH:", [
  124.                     (_x getVariable "ocap_id"), //1
  125.                     _pos,  //2
  126.                     round getDir _x,  //3
  127.                     BOOL(alive _x),  //4
  128.                     _crew  //5
  129.                 ]] call ocap_fnc_extension;
  130.             };
  131.             false
  132.         } count vehicles;
  133.        
  134.         {
  135.             _mineLoc = getPosASL _x;
  136.             _closestMines = nearestLocations [_mineLoc, ["Invisible"], 1];
  137.             if (count _closestMines < 1) then {
  138.                 _ammoType = typeOf _x;
  139.             _kostil = createlocation ["Invisible", _mineLoc,1,1];
  140.             if !(_kostil getVariable ["ocap_isInitialised", false]) then {
  141.                 _kostil setVariable ["ocap_id", _id];
  142.               _eventData = [
  143.               ocap_captureFrameNo,
  144.               "placedMine",
  145.               _id,
  146.               _mineLoc,
  147.               _AmmoType
  148.           ];
  149.             [":EVENT:", _eventData] call ocap_fnc_extension;
  150.                 _id = _id + 1;
  151.                 _kostil setVariable ["ocap_isInitialised", true];
  152.                 };
  153.             };
  154.             false
  155.         } count allMines;
  156.        
  157.                
  158.     };
  159.     sleep (call ocap_fnc_getDelay);
  160.     ocap_captureFrameNo = ocap_captureFrameNo + 1;
  161. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement