ACE3/addons/medical_blood/functions/fnc_hit.sqf
PabstMirror 3c7ac5a3e4 Fix medical blood locality / bleeding in vehicles (#4469)
* Fix medical blood locality / bleeding in vehicles

- Fix ace_setting
- Don't run on headless if enabledFor = 1
- Don't create blood for non-local units
- Don't create blood when mounted (except static weapons)

* Add readme
2016-09-29 10:42:56 -05:00

29 lines
744 B
Plaintext

/*
* Author: Glowbal
* Handle unit hit eventhandler
*
* Arguments:
* 0: unit <OBJECT>
* 1: caused by <OBJECT>
* 2: damage <NUMBER>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_causedBy", "_damage"];
if (((vehicle _unit) != _unit) && {!((vehicle _unit) isKindOf "StaticWeapon")}) exitWith {}; // Don't bleed on ground if mounted
if (isNull _causedBy) exitWith { // won't be able to calculate the direction properly, so instead we pick something at random
[QGVAR(spurt), [_unit, random 360, _damage]] call CBA_fnc_serverEvent;
};
// Calculate bulletDirection
private _bulletDir = _unit getDir _causedBy;
[QGVAR(spurt), [_unit, _bulletDir, _damage]] call CBA_fnc_serverEvent;