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 ctrlSetTooltip "Abort.";
|
||||||
|
|
||||||
_ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer);
|
_ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer);
|
||||||
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(closeDialog 0; player setDamage 1; [false] call DFUNC(disableUserInput);)];
|
if (["ace_medical"] call FUNC(isModLoaded)) then {
|
||||||
_ctrl ctrlEnable (call {private _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}});
|
_ctrl ctrlSetEventHandler ["buttonClick", 'closeDialog 0; [player, "respawn_button"] call EFUNC(medical_status,setDead); [false] call DFUNC(disableUserInput);'];
|
||||||
_ctrl ctrlSetText "RESPAWN";
|
} else {
|
||||||
|
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(closeDialog 0; player setDamage 1; [false] call DFUNC(disableUserInput);)];
|
||||||
|
};
|
||||||
|
_ctrl ctrlEnable ((getMissionConfigValue ["respawnButton", -1]) != 0); // handles 3den attribute or description.ext
|
||||||
|
_ctrl ctrlSetText localize "$str_3den_multiplayer_attributecategory_respawn_displayname";
|
||||||
_ctrl ctrlSetTooltip "Respawn.";
|
_ctrl ctrlSetTooltip "Respawn.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ if (isNull _unit) exitWith {};
|
|||||||
TRACE_3("enteredStateDeath",_this,_thisOrigin,_thisTransition);
|
TRACE_3("enteredStateDeath",_this,_thisOrigin,_thisTransition);
|
||||||
|
|
||||||
private _causeOfDeath = format ["%1:%2", _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)
|
// 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,20 +30,22 @@ if (_unit isEqualTo (_unit getVariable [QGVAR(killed), objNull])) exitWith {
|
|||||||
_unit setVariable [QGVAR(killed), _unit];
|
_unit setVariable [QGVAR(killed), _unit];
|
||||||
|
|
||||||
private _causeOfDeath = _unit getVariable [QEGVAR(medical,causeOfDeath), "#scripted"];
|
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 {
|
if (_causeOfDeath != "#scripted") then {
|
||||||
_killer = _unit getVariable [QEGVAR(medical,lastDamageSource), _killer]; // vehicle
|
_killer = _unit getVariable [QEGVAR(medical,lastDamageSource), _killer]; // vehicle
|
||||||
_instigator = _unit getVariable [QEGVAR(medical,lastInstigator), _instigator]; // unit in the turret
|
_instigator = _unit getVariable [QEGVAR(medical,lastInstigator), _instigator]; // unit in the turret
|
||||||
|
} else {
|
||||||
// All Killed EHs uses the same array, so we can modify it now to pass the correct killer/instigator
|
// call setDead manually to prevent any issues
|
||||||
if (missionNamespace getVariable [QEGVAR(medical,modifyKilledArray), true]) then { // getVar so this can be disabled
|
|
||||||
_this set [1, _killer];
|
|
||||||
_this set [2, _instigator];
|
|
||||||
};
|
|
||||||
} else { // in that case, call setDead manually to prevent any issues
|
|
||||||
[_unit, "#scripted"] call FUNC(setDead);
|
[_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 (_modifyKilledArray) then {
|
||||||
|
_this set [1, _killer];
|
||||||
|
_this set [2, _instigator];
|
||||||
|
};
|
||||||
TRACE_3("killer info",_killer,_instigator,_causeOfDeath);
|
TRACE_3("killer info",_killer,_instigator,_causeOfDeath);
|
||||||
|
|
||||||
if (_unit == player) then {
|
if (_unit == player) then {
|
||||||
|
@ -30,16 +30,16 @@ if (_unit isEqualTo (_unit getVariable [QGVAR(killedMission), objNull])) exitWit
|
|||||||
_unit setVariable [QGVAR(killedMission), _unit];
|
_unit setVariable [QGVAR(killedMission), _unit];
|
||||||
|
|
||||||
private _causeOfDeath = _unit getVariable [QEGVAR(medical,causeOfDeath), "#scripted"];
|
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 {
|
if (_causeOfDeath != "#scripted") then {
|
||||||
_killer = _unit getVariable [QEGVAR(medical,lastDamageSource), _killer]; // vehicle
|
_killer = _unit getVariable [QEGVAR(medical,lastDamageSource), _killer]; // vehicle
|
||||||
_instigator = _unit getVariable [QEGVAR(medical,lastInstigator), _instigator]; // unit in the turret
|
_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
|
// 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
|
if (_modifyKilledArray) then {
|
||||||
_this set [1, _killer];
|
_this set [1, _killer];
|
||||||
_this set [2, _instigator];
|
_this set [2, _instigator];
|
||||||
};
|
|
||||||
};
|
};
|
||||||
TRACE_3("killer mission info",_killer,_instigator,_causeOfDeath);
|
TRACE_3("killer mission info",_killer,_instigator,_causeOfDeath);
|
||||||
|
@ -75,6 +75,9 @@ if (_isRespawn) then {
|
|||||||
|
|
||||||
// Unconscious spontanious wake up chance
|
// Unconscious spontanious wake up chance
|
||||||
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), nil];
|
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), nil];
|
||||||
|
|
||||||
|
// Cause of death
|
||||||
|
_unit setVariable [QEGVAR(medical,causeOfDeath), nil];
|
||||||
};
|
};
|
||||||
|
|
||||||
[{
|
[{
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: The unit <OBJECT>
|
* 0: The unit <OBJECT>
|
||||||
* 1: Reason for death <STRING>
|
* 1: Reason for death <STRING>
|
||||||
|
* 2: Killer <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -13,8 +14,8 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_unit", ["_reason", "#setDead"]];
|
params ["_unit", ["_reason", "#setDead"], ["_instigator", objNull]];
|
||||||
TRACE_2("setDead",_unit,_reason);
|
TRACE_3("setDead",_unit,_reason,_instigator);
|
||||||
|
|
||||||
// No heart rate or blood pressure to measure when dead
|
// No heart rate or blood pressure to measure when dead
|
||||||
_unit setVariable [VAR_HEART_RATE, 0, true];
|
_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;
|
[QEGVAR(medical,death), [_unit]] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
// Kill the unit without changing visual apperance
|
// 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 {
|
if (alive _patient) then {
|
||||||
TRACE_1("Manually killing with setDead",_patient);
|
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];
|
private _position = (getPosASL _patient) vectorAdd [0, 0, 0.2];
|
||||||
|
Loading…
Reference in New Issue
Block a user