make bitePlayer function also work with vehicles

This commit is contained in:
vbawol 2017-06-24 10:36:48 -05:00
parent b217e743fc
commit 66f15a968f

View File

@ -22,14 +22,40 @@
NOTHING
*/
//[[[cog import generate_private_arrays ]]]
private ["_animConfigArray","_animationEffect","_animationEffectGlobal","_bleedAmount","_bleedChance","_bloodpAmount","_bloodpChance","_canSee","_cfgObjectInteraction","_distance","_fatigueChance","_handle","_handles","_ppEffect","_say3dsoundsConfig","_selectedMove","_selectedSound","_soundConfigArray","_soundEffect","_soundEffectGlobal","_switchMovehandlerConfig","_toxicChance"];
private ["_animConfigArray","_animationEffect","_animationEffectGlobal","_bleedAmount","_bleedChance","_bloodpAmount","_bloodpChance","_canSee","_cfgObjectInteraction","_distance","_doAttack","_fatigueChance","_ppEffect","_say3dsoundsConfig","_selectedMove","_selectedSound","_soundConfigArray","_soundEffect","_soundEffectGlobal","_switchMovehandlerConfig","_target","_toxicChance"];
//[[[end]]]
params [["_unit",objNull],["_target",player]];
if (isNull _unit && isNull _target) exitWith {};
if !(_target isEqualTo player) then {
// re to other player
[_unit,_target] remoteExec ["EPOCH_client_bitePlayer", _target];
_doAttack = false;
// check if target is on foot
if (isNull objectParent _target) then {
if (_target isEqualTo player) then {
// handle attack for local player
_doAttack = true;
} else {
// send attack to other player
if (isplayer _target) then {
[_unit,_target] remoteExec ["EPOCH_client_bitePlayer", _target];
};
};
} else {
// target is inside a vehicle, target entire vehicle crew
{
if (_x isEqualTo player) then {
// handle attack for local player if inside vehicle
_target = _x;
_doAttack = true;
} else {
// send attack to other players
if (isplayer _x) then {
[_unit,_x] remoteExec ["EPOCH_client_bitePlayer", _x];
};
};
} forEach (crew _target);
};
if (_doAttack) then {
if !(isNull _unit && alive _unit) then {