mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Medical - Update setDead
to use setHitpointDamage
instigator param (#8397)
* Redoing this
* Revert "Redoing this"
This reverts commit 80ff709676
.
* Do this properly
* Update fnc_handleKilled.sqf
* use setDead function directly
* Handle scripted camera
* redo #8387
I'm dumb.
* try this
* if construct outside of ctrlSetEventHandler
Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>
* tweak disableUserInput / handleKilled
Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
parent
ec2028cc8a
commit
a9296f66d5
@ -66,9 +66,13 @@ if (_state) then {
|
||||
_ctrl ctrlSetTooltip "Abort.";
|
||||
|
||||
_ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer);
|
||||
if (["ace_medical"] call FUNC(isModLoaded)) then {
|
||||
_ctrl ctrlSetEventHandler ["buttonClick", 'closeDialog 0; [player, "respawn_button"] call EFUNC(medical_status,setDead); [false] call DFUNC(disableUserInput);'];
|
||||
} else {
|
||||
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(closeDialog 0; player setDamage 1; [false] call DFUNC(disableUserInput);)];
|
||||
_ctrl ctrlEnable (call {private _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}});
|
||||
_ctrl ctrlSetText "RESPAWN";
|
||||
};
|
||||
_ctrl ctrlEnable ((getMissionConfigValue ["respawnButton", -1]) != 0); // handles 3den attribute or description.ext
|
||||
_ctrl ctrlSetText localize "$str_3den_multiplayer_attributecategory_respawn_displayname";
|
||||
_ctrl ctrlSetTooltip "Respawn.";
|
||||
};
|
||||
|
||||
|
@ -22,6 +22,7 @@ if (isNull _unit) exitWith {};
|
||||
TRACE_3("enteredStateDeath",_this,_thisOrigin,_thisTransition);
|
||||
|
||||
private _causeOfDeath = format ["%1:%2", _thisOrigin, _thisTransition];
|
||||
private _instigator = _unit getVariable [QEGVAR(medical,lastInstigator), objNull];
|
||||
|
||||
// could delay a frame here to fix the double killed EH, but we lose it being a "native" kill (scoreboard / rating)
|
||||
[_unit, _causeOfDeath] call EFUNC(medical_status,setDead);
|
||||
[_unit, _causeOfDeath, _instigator] call EFUNC(medical_status,setDead);
|
||||
|
@ -30,19 +30,21 @@ if (_unit isEqualTo (_unit getVariable [QGVAR(killed), objNull])) exitWith {
|
||||
_unit setVariable [QGVAR(killed), _unit];
|
||||
|
||||
private _causeOfDeath = _unit getVariable [QEGVAR(medical,causeOfDeath), "#scripted"];
|
||||
private _modifyKilledArray = missionNamespace getVariable [QEGVAR(medical,modifyKilledArray), true]; // getVar so this can be disabled
|
||||
|
||||
// if undefined then it's a death not caused by ace's setDead (mission setDamage, disconnect)
|
||||
// if undefined then it's a death not caused by ace's setDead (mission setDamage, disconnect, forced respawn while conscious)
|
||||
if (_causeOfDeath != "#scripted") then {
|
||||
_killer = _unit getVariable [QEGVAR(medical,lastDamageSource), _killer]; // vehicle
|
||||
_instigator = _unit getVariable [QEGVAR(medical,lastInstigator), _instigator]; // unit in the turret
|
||||
} else {
|
||||
// call setDead manually to prevent any issues
|
||||
[_unit, "#scripted"] call FUNC(setDead);
|
||||
};
|
||||
|
||||
// All Killed EHs uses the same array, so we can modify it now to pass the correct killer/instigator
|
||||
if (missionNamespace getVariable [QEGVAR(medical,modifyKilledArray), true]) then { // getVar so this can be disabled
|
||||
// All Killed EHs uses the same array, so we can modify it now to pass the correct killer/instigator
|
||||
if (_modifyKilledArray) then {
|
||||
_this set [1, _killer];
|
||||
_this set [2, _instigator];
|
||||
};
|
||||
} else { // in that case, call setDead manually to prevent any issues
|
||||
[_unit, "#scripted"] call FUNC(setDead);
|
||||
};
|
||||
TRACE_3("killer info",_killer,_instigator,_causeOfDeath);
|
||||
|
||||
|
@ -30,16 +30,16 @@ if (_unit isEqualTo (_unit getVariable [QGVAR(killedMission), objNull])) exitWit
|
||||
_unit setVariable [QGVAR(killedMission), _unit];
|
||||
|
||||
private _causeOfDeath = _unit getVariable [QEGVAR(medical,causeOfDeath), "#scripted"];
|
||||
private _modifyKilledArray = missionNamespace getVariable [QEGVAR(medical,modifyKilledArray), true]; // getVar so this can be disabled
|
||||
|
||||
// if undefined then it's a death not caused by ace's setDead (mission setDamage, disconnect)
|
||||
// if undefined then it's a death not caused by ace's setDead (mission setDamage, disconnect, forced respawn while conscious)
|
||||
if (_causeOfDeath != "#scripted") then {
|
||||
_killer = _unit getVariable [QEGVAR(medical,lastDamageSource), _killer]; // vehicle
|
||||
_instigator = _unit getVariable [QEGVAR(medical,lastInstigator), _instigator]; // unit in the turret
|
||||
|
||||
// All Killed EHs uses the same array, so we can modify it now to pass the correct killer/instigator
|
||||
if (missionNamespace getVariable [QEGVAR(medical,modifyKilledArray), true]) then { // getVar so this can be disabled
|
||||
};
|
||||
// All Killed EHs uses the same array, so we can modify it now to pass the correct killer/instigator
|
||||
if (_modifyKilledArray) then {
|
||||
_this set [1, _killer];
|
||||
_this set [2, _instigator];
|
||||
};
|
||||
};
|
||||
TRACE_3("killer mission info",_killer,_instigator,_causeOfDeath);
|
||||
|
@ -75,6 +75,9 @@ if (_isRespawn) then {
|
||||
|
||||
// Unconscious spontanious wake up chance
|
||||
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), nil];
|
||||
|
||||
// Cause of death
|
||||
_unit setVariable [QEGVAR(medical,causeOfDeath), nil];
|
||||
};
|
||||
|
||||
[{
|
||||
|
@ -6,6 +6,7 @@
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
* 1: Reason for death <STRING>
|
||||
* 2: Killer <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -13,8 +14,8 @@
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_unit", ["_reason", "#setDead"]];
|
||||
TRACE_2("setDead",_unit,_reason);
|
||||
params ["_unit", ["_reason", "#setDead"], ["_instigator", objNull]];
|
||||
TRACE_3("setDead",_unit,_reason,_instigator);
|
||||
|
||||
// No heart rate or blood pressure to measure when dead
|
||||
_unit setVariable [VAR_HEART_RATE, 0, true];
|
||||
@ -26,4 +27,8 @@ _unit setVariable [QEGVAR(medical,causeOfDeath), _reason, true];
|
||||
[QEGVAR(medical,death), [_unit]] call CBA_fnc_localEvent;
|
||||
|
||||
// Kill the unit without changing visual apperance
|
||||
[_unit, 1] call EFUNC(medical_engine,setStructuralDamage);
|
||||
private _prevDamage = _unit getHitPointDamage "HitHead";
|
||||
|
||||
_unit setHitPointDamage ["HitHead", 1, true, _instigator];
|
||||
|
||||
_unit setHitPointDamage ["HitHead", _prevDamage];
|
||||
|
@ -31,7 +31,7 @@ if (!local _patient) exitWith {
|
||||
|
||||
if (alive _patient) then {
|
||||
TRACE_1("Manually killing with setDead",_patient);
|
||||
[_patient, "buried_alive"] call EFUNC(medical_status,setDead);
|
||||
[_patient, "buried_alive", _medic] call EFUNC(medical_status,setDead);
|
||||
};
|
||||
|
||||
private _position = (getPosASL _patient) vectorAdd [0, 0, 0.2];
|
||||
|
Loading…
Reference in New Issue
Block a user