Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 25 additions & 14 deletions addons/recorder/fnc_captureLoop.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ GVAR(PFHObject) = [

private _lifeState = 0;
if (alive _x) then {
if (EGVAR(settings,preferACEUnconscious) && !isNil "ace_common_fnc_isAwake") then {
if (EGVAR(settings,preferACEUnconscious) && GVAR(hasACEIsAwake)) then {
_lifeState = if ([_x] call ace_common_fnc_isAwake) then {1} else {2};
} else {
_lifeState = if (lifeState _x isEqualTo "INCAPACITATED") then {2} else {1};
Expand All @@ -157,6 +157,7 @@ GVAR(PFHObject) = [
_x setVariable [QGVAR(lastScoresStr), _scoresStr];
};

private _parent = objectParent _x;
private _unitData = [
(_x getVariable QGVARMAIN(id)), //1
_pos, //2
Expand All @@ -167,11 +168,11 @@ GVAR(PFHObject) = [
BOOL(isPlayer _x), //7
_unitRole, //8
0, // frame placeholder for comparison (set before sending) 9
if (!isNil "ace_medical_status_fnc_hasStableVitals") then {BOOL([_x] call ace_medical_status_fnc_hasStableVitals)} else {true}, // 10
if (!isNil "ace_medical_status_fnc_isBeingDragged") then {BOOL([_x] call ace_medical_status_fnc_isBeingDragged)} else {false}, // 11
if (GVAR(hasACEStableVitals)) then {BOOL([_x] call ace_medical_status_fnc_hasStableVitals)} else {true}, // 10
if (GVAR(hasACEIsBeingDragged)) then {BOOL([_x] call ace_medical_status_fnc_isBeingDragged)} else {false}, // 11
_scoresStr, // scores 12
_x call CBA_fnc_vehicleRole, // vehicle role 13
if (!isNull objectParent _x) then {(objectParent _x) getVariable [QGVARMAIN(id), -1]} else {-1}, // 14
if (!isNull _parent) then {_parent getVariable [QGVARMAIN(id), -1]} else {-1}, // 14
stance _x, // 15
groupID _unitGroup, // 16 group name (dynamic)
str side _unitGroup // 17 side (dynamic)
Expand All @@ -183,8 +184,7 @@ GVAR(PFHObject) = [
[":SOLDIER:STATE:", _unitData] call EFUNC(extension,sendData);
};
};
false
} count (allUnits + allDeadMen);
} forEach (allUnits + allDeadMen);

{
private _justInitialized = false;
Expand Down Expand Up @@ -238,6 +238,7 @@ GVAR(PFHObject) = [
[_x] spawn FUNC(addUnitEventHandlers);
GVAR(nextId) = GVAR(nextId) + 1;
_x setVariable [QGVARMAIN(vehicleClass), _class];
_x setVariable [QGVARMAIN(hasTurret), (_x weaponsTurret [0]) isNotEqualTo []];
_x setVariable [QGVARMAIN(isInitialized), true, true];
_justInitialized = true;
};
Expand All @@ -246,18 +247,24 @@ GVAR(PFHObject) = [
{
if (_x getVariable [QGVARMAIN(isInitialized), false]) then {
_crew pushBack (_x getVariable QGVARMAIN(id));
}; false
} count (crew _x);
};
} forEach (crew _x);
_pos = getPosASL _x;

([_x, [0], true] call CBA_fnc_turretDir) params ["_turretAz", "_turretEl"];
private _turretAz = 0;
private _turretEl = 0;
if (_x getVariable [QGVARMAIN(hasTurret), false]) then {
private _turretResult = [_x, [0], true] call CBA_fnc_turretDir;
_turretAz = _turretResult select 0;
_turretEl = _turretResult select 1;
};
private _vehicleData = [
(_x getVariable QGVARMAIN(id)), //1
_pos, //2
round getDir _x, //3
BOOL(alive _x), //4
_crew, //5
GVAR(captureFrameNo), // 6
0, // frame placeholder for comparison (set before sending) 6
fuel _x, // 7
damage _x, // 8
isEngineOn _x, // 9
Expand All @@ -274,16 +281,20 @@ GVAR(PFHObject) = [
// Stop tracking parachutes/ejection seats that are empty or dead
if ((_x getVariable [QGVARMAIN(vehicleClass), ""]) isEqualTo "parachute" && {!((alive _x) && {_crew isNotEqualTo []})}) then {
_vehicleData set [3, 0];
_vehicleData set [5, GVAR(captureFrameNo)];
[":VEHICLE:STATE:", _vehicleData] call EFUNC(extension,sendData);
_x setVariable [QGVARMAIN(exclude), true, true];
GVAR(trackedVehicles) deleteAt _ocapId;
} else {
[":VEHICLE:STATE:", _vehicleData] call EFUNC(extension,sendData);
GVAR(trackedVehicles) set [_ocapId, [_x, _pos, round getDir _x, side _x, vectorDir _x, vectorUp _x]];
if (_x getVariable [QGVARMAIN(vehicleData), []] isNotEqualTo _vehicleData) then {
_x setVariable [QGVARMAIN(vehicleData), +_vehicleData];
_vehicleData set [5, GVAR(captureFrameNo)];
[":VEHICLE:STATE:", _vehicleData] call EFUNC(extension,sendData);
GVAR(trackedVehicles) set [_ocapId, [_x, _pos, round getDir _x, side _x, vectorDir _x, vectorUp _x]];
};
};
};
false
} count vehicles;
} forEach vehicles;

// Detect disappeared vehicles (deleted/garbage-collected) and send final dead state
private _toRemove = [];
Expand Down
42 changes: 26 additions & 16 deletions addons/recorder/fnc_getClass.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,29 @@ Author:
---------------------------------------------------------------------------- */
#include "script_component.hpp"

if (getText(configFile >> "CfgVehicles" >> _this >> "model") isEqualTo "\A3\Weapons_f\empty") exitWith {"unknown"};

if ((toLower getText(configFile >> "CfgVehicles" >> _this >> "displayName")) find "ejection" > -1) exitWith {"parachute"};

if (_this isKindOf "Truck_F") exitWith {"truck"}; // Should be higher than Car
if (_this call FUNC(isKindOfApc)) exitWith {"apc"};
if (_this isKindOf "Car") exitWith {"car"};
if (_this isKindOf "Tank") exitWith {"tank"};
if (_this isKindOf "StaticMortar") exitWith {"static-mortar"};
if (_this isKindOf "StaticWeapon") exitWith {"static-weapon"};
if (_this isKindOf "ParachuteBase") exitWith {"parachute"};
if (_this isKindOf "Helicopter") exitWith {"heli"};
if (_this isKindOf "Plane") exitWith {"plane"};
if (_this isKindOf "Air") exitWith {"plane"};
if (_this isKindOf "Ship") exitWith {"sea"};
"unknown"
if (isNil QGVAR(classCache)) then {
GVAR(classCache) = createHashMap;
};

private _cached = GVAR(classCache) getOrDefault [_this, ""];
if (_cached isNotEqualTo "") exitWith {_cached};

private _result = call {
if (getText(configFile >> "CfgVehicles" >> _this >> "model") isEqualTo "\A3\Weapons_f\empty") exitWith {"unknown"};
if ((toLower getText(configFile >> "CfgVehicles" >> _this >> "displayName")) find "ejection" > -1) exitWith {"parachute"};
if (_this isKindOf "Truck_F") exitWith {"truck"};
if (_this call FUNC(isKindOfApc)) exitWith {"apc"};
if (_this isKindOf "Car") exitWith {"car"};
if (_this isKindOf "Tank") exitWith {"tank"};
if (_this isKindOf "StaticMortar") exitWith {"static-mortar"};
if (_this isKindOf "StaticWeapon") exitWith {"static-weapon"};
if (_this isKindOf "ParachuteBase") exitWith {"parachute"};
if (_this isKindOf "Helicopter") exitWith {"heli"};
if (_this isKindOf "Plane") exitWith {"plane"};
if (_this isKindOf "Air") exitWith {"plane"};
if (_this isKindOf "Ship") exitWith {"sea"};
"unknown"
};

GVAR(classCache) set [_this, _result];
_result
2 changes: 1 addition & 1 deletion addons/recorder/fnc_getUnitType.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private _typePic = getText (configOf _unitToCheck >> "icon");

switch (true) do {
case (
["Officer", _typePic] call BIS_fnc_inString
"Officer" in _typePic
): {_role = "Officer"};
case (
_unitToCheck == leader group _unitToCheck
Expand Down
10 changes: 5 additions & 5 deletions addons/recorder/fnc_handleMarkers.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ EGVAR(listener,markers) = [QGVARMAIN(handleMarker), {
};

if (_sideOfMarker in ["EMPTY", "LOGIC", "UNKNOWN"] ||
(["Projectile#", _mrk_name] call BIS_fnc_inString) ||
(["Detonation#", _mrk_name] call BIS_fnc_inString) ||
(["Mine#", _mrk_name] call BIS_fnc_inString) ||
(["ObjectMarker", _mrk_name] call BIS_fnc_inString) ||
(["moduleCoverMap", _mrk_name] call BIS_fnc_inString) ||
("Projectile#" in _mrk_name) ||
("Detonation#" in _mrk_name) ||
("Mine#" in _mrk_name) ||
("ObjectMarker" in _mrk_name) ||
("moduleCoverMap" in _mrk_name) ||
_forceGlobal) then {_sideOfMarker = -1};

private ["_polylinePos"];
Expand Down
4 changes: 4 additions & 0 deletions addons/recorder/fnc_init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ GVAR(excludeMarkerList) = if (!isNil QEGVAR(settings,excludeMarkerFromRecord)) t
[]
};

GVAR(hasACEIsAwake) = !isNil "ace_common_fnc_isAwake";
GVAR(hasACEStableVitals) = !isNil "ace_medical_status_fnc_hasStableVitals";
GVAR(hasACEIsBeingDragged) = !isNil "ace_medical_status_fnc_isBeingDragged";

/*
VARIABLE: OCAP_version
Global variable that represents the version of OCAP addon being used [String]
Expand Down
21 changes: 15 additions & 6 deletions addons/recorder/fnc_telemetryLoop.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ Author:
// [2] Per-side entity counts: [east, west, independent, civilian]
// Each side: [[serverLocal], [remote]]
// Each locality: [units_total, units_alive, units_dead, groups, vehicles, weaponholders]
private _totalAlive = 0;
private _totalDead = 0;
private _totalGroups = 0;
private _totalVeh = 0;
private _totalWH = 0;
private _sideData = [];
{
private _s = _x;
Expand Down Expand Up @@ -100,17 +105,21 @@ Author:
[_localUnits, _localAlive, _localDead, _localGroups, _localVeh, _localWH],
[_remoteUnits, _remoteAlive, _remoteDead, _remoteGroups, _remoteVeh, _remoteWH]
];
_totalAlive = _totalAlive + _localAlive + _remoteAlive;
_totalDead = _totalDead + _localDead + _remoteDead;
_totalGroups = _totalGroups + _localGroups + _remoteGroups;
_totalVeh = _totalVeh + _localVeh + _remoteVeh;
_totalWH = _totalWH + _localWH + _remoteWH;
} forEach [east, west, independent, civilian];

// [3] Global entity counts
private _weaponholders = {_x isKindOf "WeaponHolderSimulated"} count _vehicles;
private _playersAlive = {alive _x} count _allPlayers;
private _globalCounts = [
{alive _x} count _allUnits,
count _allDeadMen,
count _allGroups,
count _vehicles - _weaponholders,
_weaponholders,
_totalAlive,
_totalDead,
_totalGroups,
_totalVeh,
_totalWH,
_playersAlive,
count _allPlayers - _playersAlive,
count _allPlayers
Expand Down