Skip to content

Commit

Permalink
tweak disableUserInput / handleKilled
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror committed Nov 12, 2021
1 parent 891aac0 commit 4304701
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
14 changes: 7 additions & 7 deletions addons/common/functions/fnc_disableUserInput.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +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", QUOTE(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";
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 ((getMissionConfigValue ["respawnButton", -1]) != 0); // handles 3den attribute or description.ext
_ctrl ctrlSetText localize "$str_3den_multiplayer_attributecategory_respawn_displayname";
_ctrl ctrlSetTooltip "Respawn.";
};

Expand Down
9 changes: 4 additions & 5 deletions addons/medical_status/functions/fnc_handleKilled.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@ _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, forced respawn)
if (_causeOfDeath != "#scripted" || {IS_UNCONSCIOUS(_unit)}) then { // forced respawn while uncon
// 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
};

if (_causeOfDeath == "#scripted") then { // call setDead manually to prevent any issues
} else {
// call setDead manually to prevent any issues
[_unit, "#scripted"] call FUNC(setDead);
};

Expand Down
4 changes: 2 additions & 2 deletions addons/medical_status/functions/fnc_handleKilledMission.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ _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, forced respawn)
if (_causeOfDeath != "#scripted" || {IS_UNCONSCIOUS(_unit)}) then { // forced respawn while uncon
// 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
};
Expand Down
3 changes: 3 additions & 0 deletions addons/medical_status/functions/fnc_initUnit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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];
};

[{
Expand Down
2 changes: 1 addition & 1 deletion addons/medical_status/functions/fnc_setDead.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

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
_unit setVariable [VAR_HEART_RATE, 0, true];
Expand Down
2 changes: 1 addition & 1 deletion addons/medical_treatment/functions/fnc_placeInBodyBag.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 4304701

Please sign in to comment.