add ace_kill event handler

This commit is contained in:
commy2 2016-10-12 23:20:22 +02:00
parent 4e0f3e53e0
commit e38845bf45
5 changed files with 36 additions and 3 deletions

View File

@ -29,3 +29,4 @@ PREP(handleMedications);
PREP(addPain);
PREP(setUnconscious);
PREP(setDead);

View File

@ -76,7 +76,7 @@ if (_painStatus > (_unit getVariable [QGVAR(painSuppress), 0])) then {
};
if (_bloodVolume < BLOOD_VOLUME_DEAD) exitWith {
[_unit] call FUNC(setDead);
[_unit, "bloodloss"] call FUNC(setDead);
};
if ([_unit] call EFUNC(common,isAwake)) then {

View File

@ -0,0 +1,30 @@
/*
* Author: commy2
* Kills a local unit.
*
* Arguments:
* 0: The unit <OBJECT>
* 1: Reason for death <STRING>
*
* ReturnValue:
* None
*
* Example:
* [bob, "bloodloss"] call ace_medical_fnc_setDead;
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", ["_reason", "unknown"]];
// kill
_unit setDamage 1;
// reset textures
[_unit, "All"] call EFUNC(medical_engine,updateBodyPartVisuals);
private _lastShooter = _unit getVariable [QEGVAR(medical_engine,lastShooter), objNull];
private _lastInstigator = _unit getVariable [QEGVAR(medical_engine,lastInstigator), objNull];
["ace_killed", [_unit, _reason, _lastShooter, _lastInstigator]] call CBA_fnc_globalEvent;

View File

@ -16,7 +16,6 @@
*
* Public: yes
*/
#include "script_component.hpp"
// only run this after the settings are initialized

View File

@ -15,7 +15,7 @@
// for travis
#define HIT_STRUCTURAL QGVAR($#structural)
params ["_unit", "_selection", "_damage", "_shooter", "_ammo", "_hitPointIndex"];
params ["_unit", "_selection", "_damage", "_shooter", "_ammo", "_hitPointIndex", "_instigator"];
//diag_log _this;
// HD sometimes triggers for remote units - ignore.
@ -41,6 +41,9 @@ if (_hitPoint in ["hithead", "hitbody", "hithands", "hitlegs"]) exitWith {_oldDa
// Add injury
if (_hitPoint isEqualTo "ace_hdbracket") exitWith {
_unit setVariable [QGVAR(lastShooter), _shooter];
_unit setVariable [QGVAR(lastInstigator), _instigator];
private _damageStructural = _unit getVariable [HIT_STRUCTURAL, 0];
// --- Head