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
20 changes: 7 additions & 13 deletions addons/recorder/fnc_eh_firedMan.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions addons/recorder/fnc_eh_fired_client.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading