mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* advanced_ballistics * advanced_fatigue * advanced_throwing * ai * aircraft * arsenal * atragmx * attach * backpacks * ballistics * captives * cargo * chemlights * common * concertina_wire * cookoff * dagr * disarming * disposable * dogtags * dragging * explosives * fastroping * fcs * finger * frag * gestures * gforces * goggles * grenades * gunbag * hearing * hitreactions * huntir * interact_menu * interaction * inventory * kestrel4500 * laser * laserpointer * logistics_uavbattery * logistics_wirecutter * magazinerepack * map * map_gestures * maptools * markers * medical * medical_ai * medical_blood * medical_menu * microdagr * minedetector * missileguidance * missionmodules * mk6mortar * modules * movement * nametags * nightvision * nlaw * optics * optionsmenu * overheating * overpressure * parachute * pylons * quickmount * rangecard * rearm * recoil * refuel * reload * reloadlaunchers * repair * respawn * safemode * sandbag * scopes * slideshow * spectator * spottingscope * switchunits * tacticalladder * tagging * trenches * tripod * ui * vector * vehiclelock * vehicles * viewdistance * weaponselect * weather * winddeflection * yardage450 * zeus * arsenal defines.hpp * optionals * DEBUG_MODE_FULL 1 * DEBUG_MODE_FULL 2 * Manual fixes * Add SQF Validator check for #include after block comment * explosives fnc_openTimerUI * fix uniqueItems
67 lines
2.0 KiB
Plaintext
67 lines
2.0 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: Glowbal
|
|
* Either kills a unit or puts the unit in a revivable state, depending on the settings.
|
|
*
|
|
* Arguments:
|
|
* 0: The unit that will be killed <OBJECT>
|
|
* 1: Force Dead (ignore revive setting) <BOOL> (default: false)
|
|
* 1: Delay setDamage for a frame <BOOL> (default: false)
|
|
*
|
|
* Return Value:
|
|
* Did he died? <BOOL>
|
|
*
|
|
* Example:
|
|
* [bob, false, false] call ace_medical_fnc_setDead
|
|
*
|
|
* Public: yes
|
|
*/
|
|
|
|
params ["_unit", ["_force", false], ["_delaySetDamage", false]];
|
|
|
|
if ((!alive _unit) || {_unit getVariable ["ACE_isDead", false]}) exitWith {true};
|
|
if (!local _unit) exitwith {
|
|
[QGVAR(setDead), [_unit, _force], _unit] call CBA_fnc_targetEvent;
|
|
false;
|
|
};
|
|
|
|
private _reviveVal = _unit getVariable [QGVAR(enableRevive), GVAR(enableRevive)];
|
|
if (((_reviveVal == 1 && {[_unit] call EFUNC(common,isPlayer)} || _reviveVal == 2)) && !_force) exitwith {
|
|
if (_unit getVariable [QGVAR(inReviveState), false]) exitwith {
|
|
if (GVAR(amountOfReviveLives) > 0) then {
|
|
private _lifesLeft = _unit getVariable[QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives)];
|
|
if (_lifesLeft <= 0) then {
|
|
[_unit, true] call FUNC(setDead);
|
|
};
|
|
};
|
|
|
|
false;
|
|
};
|
|
|
|
_unit setVariable [QGVAR(inReviveState), true, true];
|
|
_unit setVariable [QGVAR(reviveStartTime), CBA_missionTime];
|
|
[_unit, true] call FUNC(setUnconscious);
|
|
|
|
// Run the loop that tracks the revive state
|
|
[_unit ] call FUNC(reviveStateLoop);
|
|
false;
|
|
};
|
|
|
|
_unit setVariable ["ACE_isDead", true, true];
|
|
if (isPLayer _unit) then {
|
|
_unit setVariable ["isDeadPlayer", true, true];
|
|
};
|
|
|
|
["ace_killed", [_unit]] call CBA_fnc_localEvent;
|
|
|
|
//Delay a frame before killing the unit via scripted damage
|
|
//to avoid triggering the "Killed" Event twice (and having the wrong killer)
|
|
|
|
if (!_delaySetDamage) then {
|
|
[_unit, 1] call FUNC(setStructuralDamage);
|
|
} else {
|
|
[FUNC(setStructuralDamage), [_unit, 1]] call CBA_fnc_execNextFrame;
|
|
};
|
|
|
|
true;
|