mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
add ace_kill event handler
This commit is contained in:
parent
4e0f3e53e0
commit
e38845bf45
@ -29,3 +29,4 @@ PREP(handleMedications);
|
|||||||
|
|
||||||
PREP(addPain);
|
PREP(addPain);
|
||||||
PREP(setUnconscious);
|
PREP(setUnconscious);
|
||||||
|
PREP(setDead);
|
||||||
|
@ -76,7 +76,7 @@ if (_painStatus > (_unit getVariable [QGVAR(painSuppress), 0])) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (_bloodVolume < BLOOD_VOLUME_DEAD) exitWith {
|
if (_bloodVolume < BLOOD_VOLUME_DEAD) exitWith {
|
||||||
[_unit] call FUNC(setDead);
|
[_unit, "bloodloss"] call FUNC(setDead);
|
||||||
};
|
};
|
||||||
|
|
||||||
if ([_unit] call EFUNC(common,isAwake)) then {
|
if ([_unit] call EFUNC(common,isAwake)) then {
|
||||||
|
30
addons/medical/functions/fnc_setDead.sqf
Normal file
30
addons/medical/functions/fnc_setDead.sqf
Normal 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;
|
@ -16,7 +16,6 @@
|
|||||||
*
|
*
|
||||||
* Public: yes
|
* Public: yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
// only run this after the settings are initialized
|
// only run this after the settings are initialized
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// for travis
|
// for travis
|
||||||
#define HIT_STRUCTURAL QGVAR($#structural)
|
#define HIT_STRUCTURAL QGVAR($#structural)
|
||||||
|
|
||||||
params ["_unit", "_selection", "_damage", "_shooter", "_ammo", "_hitPointIndex"];
|
params ["_unit", "_selection", "_damage", "_shooter", "_ammo", "_hitPointIndex", "_instigator"];
|
||||||
//diag_log _this;
|
//diag_log _this;
|
||||||
|
|
||||||
// HD sometimes triggers for remote units - ignore.
|
// HD sometimes triggers for remote units - ignore.
|
||||||
@ -41,6 +41,9 @@ if (_hitPoint in ["hithead", "hitbody", "hithands", "hitlegs"]) exitWith {_oldDa
|
|||||||
|
|
||||||
// Add injury
|
// Add injury
|
||||||
if (_hitPoint isEqualTo "ace_hdbracket") exitWith {
|
if (_hitPoint isEqualTo "ace_hdbracket") exitWith {
|
||||||
|
_unit setVariable [QGVAR(lastShooter), _shooter];
|
||||||
|
_unit setVariable [QGVAR(lastInstigator), _instigator];
|
||||||
|
|
||||||
private _damageStructural = _unit getVariable [HIT_STRUCTURAL, 0];
|
private _damageStructural = _unit getVariable [HIT_STRUCTURAL, 0];
|
||||||
|
|
||||||
// --- Head
|
// --- Head
|
||||||
|
Loading…
Reference in New Issue
Block a user