diff --git a/addons/recorder/fnc_eh_firedMan.sqf b/addons/recorder/fnc_eh_firedMan.sqf index 0fd8dde..19727a6 100644 --- a/addons/recorder/fnc_eh_firedMan.sqf +++ b/addons/recorder/fnc_eh_firedMan.sqf @@ -41,21 +41,15 @@ if (!SHOULDSAVEEVENTS) exitWith {}; params ["_firer", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"]; -private _initialProjPos = getPosASL _projectile; -if (getPos _firer distance _initialProjPos > 50 || vehicle _firer isKindOf "Air") then { - // if projectile in unscheduled environment is > 50m from FiredMan then likely remote controlled - // we should find the actual firing entity - private _nearest = [_initialProjPos, allUnits select { - !isPlayer _x - }, 75] call CBA_fnc_getNearest; - if (count _nearest > 0) then { - _firer = _nearest#0; - }; +// Zeus remote control fix: FiredMan fires on the controller's body, not the +// controlled unit. Swap to the actual controlled unit for correct attribution. +private _controlledUnit = missionNamespace getVariable ["bis_fnc_moduleRemoteControl_unit", objNull]; +if (!isNull _controlledUnit && {_controlledUnit getVariable ["BIS_fnc_moduleRemoteControl_owner", objNull] isEqualTo _firer}) then { + _firer = _controlledUnit; + private _controlledVehicle = vehicle _controlledUnit; + _vehicle = if (_controlledVehicle isEqualTo _controlledUnit) then {objNull} else {_controlledVehicle}; }; -// missionNamespace getVariable ["bis_fnc_moduleRemoteControl_unit", _firer]; -// _unit getVariable ["BIS_fnc_moduleRemoteControl_owner", objNull]; - // not sent in ACE Throwing events if (isNil "_vehicle") then { _vehicle = objNull diff --git a/addons/recorder/fnc_eh_fired_client.sqf b/addons/recorder/fnc_eh_fired_client.sqf index 89d32f5..ccb717b 100644 --- a/addons/recorder/fnc_eh_fired_client.sqf +++ b/addons/recorder/fnc_eh_fired_client.sqf @@ -15,6 +15,18 @@ if (isNil "_projectile") exitWith { false; }; +// Zeus remote control fix: FiredMan fires on the controller's body, not the +// controlled unit. bis_fnc_moduleRemoteControl_unit (local to the controller's +// machine) gives us the actual unit doing the firing. +private _controlledUnit = missionNamespace getVariable ["bis_fnc_moduleRemoteControl_unit", objNull]; +if (!isNull _controlledUnit && {_controlledUnit getVariable ["BIS_fnc_moduleRemoteControl_owner", objNull] isEqualTo _firer}) then { + TRACE_2("Swapping firer from Zeus body to remote-controlled unit",name _firer,name _controlledUnit); + _firer = _controlledUnit; + // Fix _vehicle — Zeus body isn't in the static weapon, but the controlled unit is + private _controlledVehicle = vehicle _controlledUnit; + _vehicle = if (_controlledVehicle isEqualTo _controlledUnit) then {objNull} else {_controlledVehicle}; +}; + // get ocap id of firer private _firerOcapId = _firer getVariable [QGVARMAIN(id), -1]; if (_firerOcapId isEqualTo -1) exitWith {