trial implementation

This commit is contained in:
2024-02-13 20:50:09 -08:00
parent 5114ae334f
commit e55c9a0751
5 changed files with 38 additions and 2 deletions

View File

@@ -28,6 +28,7 @@ class DOUBLES(PREFIX,client) {
class addZenModules {}; class addZenModules {};
class bindEmptyGroupGarbageCleanup {}; class bindEmptyGroupGarbageCleanup {};
class bindEventHandlers {}; class bindEventHandlers {};
class bindUnconsciousListener {};
class bindVehicleActions {}; class bindVehicleActions {};
}; };
}; };

View File

@@ -7,11 +7,20 @@ player addEventHandler["Respawn",
params ["_unit", "_corpse"]; params ["_unit", "_corpse"];
private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"]; private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"];
if (_killer == "respawn_button") then { if (_killer == "respawn_button") then {
private _timeWentUnconscious = _unit getVariable [QGVARMAIN(lastTimeKnockedOut), -1];
private _durationSpentUnconscious = diag_tickTime - _timeWentUnconscious;
[ [
LEVEL_INFO, LEVEL_INFO,
QUOTE(COMPONENT), QUOTE(COMPONENT),
"RESPAWNED WHILE UNCONSCIOUS", "RESPAWNED WHILE UNCONSCIOUS",
[_unit] call EFUNC(common,addPlayerInfoToArray) [_unit, [[
"durationSpentUnconscious",
(if (_timeWentUnconscious > - 1) then {
_durationSpentUnconscious
} else {
-1
})
]]] call EFUNC(common,addPlayerInfoToArray)
] remoteExec [QEFUNC(common,log), 2]; ] remoteExec [QEFUNC(common,log), 2];
// format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0]; // format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0];
}; };

View File

@@ -0,0 +1,13 @@
#include "..\script_component.hpp"
if (!hasInterface) exitWith {};
["ace_medical_knockOut", { // local event that's also used directly by the ACE medical statemachine
private _unit = _this;
_this setVariable [QGVARMAIN(lastTimeKnockedOut), diag_tickTime];
}] call CBA_fnc_addEventHandler;
["ace_medical_WakeUp", { // local event that's also used directly by the ACE medical statemachine
private _unit = _this;
_this setVariable [QGVARMAIN(lastTimeKnockedOut), nil];
}] call CBA_fnc_addEventHandler;

View File

@@ -9,6 +9,9 @@ call FUNC(bindEmptyGroupGarbageCleanup);
call FUNC(bindEventHandlers); call FUNC(bindEventHandlers);
call FUNC(bindVehicleActions); call FUNC(bindVehicleActions);
// add listener that tracks when the player goes unconscious and saves a variable with time
call FUNC(bindUnconsciousListener);
[ [
LEVEL_DEBUG, LEVEL_DEBUG,
QUOTE(COMPONENT), QUOTE(COMPONENT),

View File

@@ -8,12 +8,22 @@ if (!hasInterface) exitWith {};
_clientID = _thisArgs select 0; _clientID = _thisArgs select 0;
player setDamage 1; player setDamage 1;
private _timeWentUnconscious = player getVariable [QGVARMAIN(lastTimeKnockedOut), -1];
private _durationSpentUnconscious = diag_tickTime - _timeWentUnconscious;
// log to server RPT // log to server RPT
[ [
LEVEL_INFO, LEVEL_INFO,
QUOTE(COMPONENT), QUOTE(COMPONENT),
"CHAT COMMAND RESPAWN", "CHAT COMMAND RESPAWN",
[player] call EFUNC(common,addPlayerInfoToArray) [player, [[
"durationSpentUnconscious",
(if (_timeWentUnconscious > - 1) then {
_durationSpentUnconscious
} else {
-1
})
]]] call EFUNC(common,addPlayerInfoToArray)
] remoteExec [QEFUNC(common,log), 2]; ] remoteExec [QEFUNC(common,log), 2];
// systemChat to all remote machines // systemChat to all remote machines