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
3 changes: 3 additions & 0 deletions addons/recorder/fnc_addEventMission.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ if (isNil QEGVAR(EH,EntityRespawned)) then {
GVAR(captureFrameNo)
]] call EFUNC(extension,sendData);
_corpse setVariable [QGVARMAIN(exclude), true];
if (!isNil QGVAR(trackedUnits)) then {
GVAR(trackedUnits) deleteAt (_corpse getVariable [QGVARMAIN(id), -1]);
};
};

[_entity, true] spawn FUNC(addUnitEventHandlers);
Expand Down
19 changes: 19 additions & 0 deletions addons/recorder/fnc_captureLoop.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ if (isNil QGVAR(startTime)) then {
};

GVAR(trackedVehicles) = createHashMap;
GVAR(trackedUnits) = createHashMap;

// Pre-compute frame intervals that depend on frameCaptureDelay (constant for the mission)
// Must be GVARs, not private — PFH code runs in a different scope.
Expand Down Expand Up @@ -120,6 +121,7 @@ GVAR(PFHObject) = [
[_x] spawn FUNC(addUnitEventHandlers);
GVAR(nextId) = GVAR(nextId) + 1;
_x setVariable [QGVARMAIN(isInitialized), true, true];
GVAR(trackedUnits) set [_x getVariable [QGVARMAIN(id), -1], _x];
_justInitialized = true;
};
// Re-include units that have become player-controlled again (e.g., reconnected players)
Expand Down Expand Up @@ -186,6 +188,19 @@ GVAR(PFHObject) = [
};
} forEach (allUnits + allDeadMen);

// Detect disappeared units (deleted/garbage-collected) and report removal
private _toRemoveUnits = [];
{
if (isNull _y) then {
[":SOLDIER:DELETE:", [
_x,
GVAR(captureFrameNo)
]] call EFUNC(extension,sendData);
_toRemoveUnits pushBack _x;
};
} forEach GVAR(trackedUnits);
{ GVAR(trackedUnits) deleteAt _x } forEach _toRemoveUnits;

{
private _justInitialized = false;
if !(_x getVariable [QGVARMAIN(isInitialized), false]) then {
Expand Down Expand Up @@ -305,6 +320,10 @@ GVAR(PFHObject) = [
_x, _lastPos, _lastDir, 0, [], GVAR(captureFrameNo),
0, 1, false, false, _lastSide, _lastVectorDir, _lastVectorUp, 0, 0
]] call EFUNC(extension,sendData);
[":VEHICLE:DELETE:", [
_x,
GVAR(captureFrameNo)
]] call EFUNC(extension,sendData);
_toRemove pushBack _x;
};
} forEach (keys GVAR(trackedVehicles));
Expand Down
3 changes: 3 additions & 0 deletions addons/recorder/fnc_eh_disconnected.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ if (_unit getVariable [QGVARMAIN(isInitialized), false]) then {
GVAR(captureFrameNo)
]] call EFUNC(extension,sendData);
_unit setVariable [QGVARMAIN(exclude), true];
if (!isNil QGVAR(trackedUnits)) then {
GVAR(trackedUnits) deleteAt (_unit getVariable [QGVARMAIN(id), -1]);
};
};

// saveOnEmpty: if this was the last player, save immediately
Expand Down
Loading