forked from acemod/ACE3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Common - Add
setDead
API (acemod#10045)
* Added `setDead` API * Update XEH_PREP.hpp * Update fnc_setDead.sqf * Update addons/common/functions/fnc_disableUserInput.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update fnc_setDead.sqf * Added warning for non-local units --------- Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
53 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: johnb43 | ||
* Kills a unit without changing visual appearance. | ||
* | ||
* Arguments: | ||
* 0: Unit <ARRAY> | ||
* 1: Reason for death (only used if ace_medical is loaded) <STRING> (default: "") | ||
* 2: Killer (vehicle that killed unit) <ARRAY> (default: objNull) | ||
* 3: Instigator (unit who pulled trigger) <ARRAY> (default: objNull) | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [cursorObject, "", player, player] call ace_common_fnc_setDead; | ||
* | ||
* Public: Yes | ||
*/ | ||
|
||
params [["_unit", objNull, [objNull]], ["_reason", "", [""]], ["_source", objNull, [objNull]], ["_instigator", objNull, [objNull]]]; | ||
|
||
if (!local _unit) exitWith { | ||
WARNING_1("setDead executed on non-local unit - %1",_this); | ||
}; | ||
|
||
if (["ace_medical"] call EFUNC(common,isModLoaded)) then { | ||
[_unit, _reason, _source, _instigator] call EFUNC(medical_status,setDead); | ||
} else { | ||
// From 'ace_medical_status_fnc_setDead': Kill the unit without changing visual appearance | ||
|
||
// (#8803) Reenable damage if disabled to prevent having live units in dead state | ||
// Keep this after death event for compatibility with third party hooks | ||
if (!isDamageAllowed _unit) then { | ||
WARNING_1("setDead executed on unit with damage blocked - %1",_this); | ||
_unit allowDamage true; | ||
}; | ||
|
||
private _currentDamage = _unit getHitPointDamage "HitHead"; | ||
|
||
_unit setHitPointDamage ["HitHead", 1, true, _source, _instigator]; | ||
|
||
_unit setHitPointDamage ["HitHead", _currentDamage, true, _source, _instigator]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters