-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
establishes parity between killed and hit in recording/display (#23)
* Replaced Hit with MPHit * Renaming * copied kill to hit event handler * Fix * start commit * ready for testing * fixes Co-authored-by: Florian Kinder <[email protected]>
- Loading branch information
Showing
5 changed files
with
84 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,50 @@ | ||
#include "script_macros.hpp"; | ||
params ["_unit", "_causedBy", "_damage", "_instigator"]; | ||
|
||
[_unit, _causedBy, _instigator] spawn { | ||
params ["_unit", "_causedBy", "_instigator"]; | ||
_unitID = _unit getVariable "ocap_id"; | ||
|
||
if (isNull _instigator) then { | ||
_instigator = [_unit, _causedBy] call ocap_fnc_getInstigator; | ||
}; | ||
|
||
_unitID = _unit getVariable ["ocap_id", -1]; | ||
if (_unitID == -1) exitWith {}; | ||
private _eventData = [ocap_captureFrameNo, "hit", _unitID, ["null"], -1]; | ||
if (!isNull _causedBy) then { | ||
_causedByInfo = []; | ||
if (_causedBy isKindOf "CAManBase") then { | ||
|
||
if (!isNull _instigator) then { | ||
_causedById = _causedBy getVariable ["ocap_id", -1]; | ||
_instigatorId = _instigator getVariable ["ocap_id", -1]; | ||
|
||
private _causedByInfo = []; | ||
private _distanceInfo = 0; | ||
if (_causedBy isKindOf "CAManBase" && _causedById > -1) then { | ||
_causedByInfo = [ | ||
_causedBy getVariable "ocap_id", | ||
getText (configFile >> "CfgWeapons" >> currentWeapon _causedBy >> "displayName") | ||
_causedById, | ||
([_causedBy] call ocap_fnc_getEventWeaponText) | ||
]; | ||
_distanceInfo = round (_unit distance _causedBy); | ||
} else { | ||
if (!isNull _instigator && _causedBy != _instigator && _instigator isKindOf "CAManBase") then { | ||
// pilot/driver doesn't return a value, so check for this | ||
private _turPath = []; | ||
if (count (assignedVehicleRole _instigator) > 1) then { | ||
_turPath = assignedVehicleRole _instigator select 1; | ||
} else { | ||
_turPath = [-1]; | ||
}; | ||
|
||
private _curVic = getText(configFile >> "CfgVehicles" >> (typeOf vehicle _instigator) >> "displayName"); | ||
(weaponstate [vehicle _causedBy, _turPath]) params ["_curWep", "_curMuzzle", "_curFiremode", "_curMag"]; | ||
private _curWepDisplayName = getText(configFile >> "CfgWeapons" >> _curWep >> "displayName"); | ||
private _curMagDisplayName = getText(configFile >> "CfgMagazines" >> _curMag >> "displayName"); | ||
private _text = ""; | ||
if (count _curMagDisplayName < 22) then { | ||
_text = _curVic + " [" + _curWepDisplayName + " / " + _curMagDisplayName + "]"; | ||
} else { | ||
if (_curWep != _curMuzzle) then { | ||
_text = _curVic + " [" + _curWepDisplayName + " / " + _curMuzzle + "]"; | ||
} else { | ||
_text = _curVic + " [" + _curWepDisplayName + "]"; | ||
}; | ||
}; | ||
|
||
if (!isNull _instigator && _causedBy != _instigator && _instigator isKindOf "CAManBase" && _instigatorId > -1) then { | ||
_causedByInfo = [ | ||
_instigator getVariable "ocap_id", | ||
_text | ||
_instigatorId, | ||
([_instigator] call ocap_fnc_getEventWeaponText) | ||
]; | ||
_distanceInfo = round (_unit distance _instigator); | ||
} else { | ||
_causedByInfo = [_causedBy getVariable "ocap_id"]; | ||
_causedByInfo = [_causedById]; | ||
_distanceInfo = round (_unit distance _causedBy); | ||
}; | ||
}; | ||
_eventData = [ | ||
ocap_captureFrameNo, | ||
"hit", | ||
_unitID, | ||
_causedByInfo, | ||
round (_unit distance _causedBy) | ||
_distanceInfo | ||
]; | ||
}; | ||
|
||
DEBUG(_eventData); | ||
[":EVENT:", _eventData] call ocap_fnc_extension; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
addons/@ocap/addons/ocap/functions/fn_getEventWeaponText.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
params ["_instigator"]; | ||
|
||
if (vehicle _instigator isEqualTo _instigator) exitWith { | ||
getText (configFile >> "CfgWeapons" >> currentWeapon _instigator >> "displayName"); | ||
}; | ||
|
||
// pilot/driver doesn't return a value, so check for this | ||
private _turPath = []; | ||
if (count (assignedVehicleRole _instigator) > 1) then { | ||
_turPath = assignedVehicleRole _instigator select 1; | ||
} else { | ||
_turPath = [-1]; | ||
}; | ||
|
||
private _curVic = getText(configFile >> "CfgVehicles" >> (typeOf vehicle _instigator) >> "displayName"); | ||
(weaponstate [vehicle _instigator, _turPath]) params ["_curWep", "_curMuzzle", "_curFiremode", "_curMag"]; | ||
private _curWepDisplayName = getText(configFile >> "CfgWeapons" >> _curWep >> "displayName"); | ||
private _curMagDisplayName = getText(configFile >> "CfgMagazines" >> _curMag >> "displayName"); | ||
private _text = _curVic; | ||
if (count _curMagDisplayName < 22) then { | ||
if !(_curWepDisplayName isEqualTo "") then { | ||
_text = _text + " [" + _curWepDisplayName; | ||
if !(_curMagDisplayName isEqualTo "") then { | ||
_text = _text + " / " + _curMagDisplayName + "]"; | ||
} else { | ||
_text = _text + "]" | ||
}; | ||
}; | ||
} else { | ||
if !(_curWepDisplayName isEqualTo "") then { | ||
_text = _text + " [" + _curWepDisplayName; | ||
if (_curWep != _curMuzzle && !(_curMuzzle isEqualTo "")) then { | ||
_text = _text + " / " + _curMuzzle + "]"; | ||
} else { | ||
_text = _text + "]"; | ||
}; | ||
}; | ||
}; | ||
|
||
_text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters