fix uncon respawn button use, add static line protection
All checks were successful
Generate testing snapshot / Create testing release (push) Successful in 38s
All checks were successful
Generate testing snapshot / Create testing release (push) Successful in 38s
This commit is contained in:
@@ -24,15 +24,16 @@ class DOUBLES(PREFIX,client) {
|
||||
class functions {
|
||||
file = "framework\client\functions";
|
||||
class initClient {};
|
||||
class addDraw3DPFH {};
|
||||
class addGetNearMenPFH {};
|
||||
class addMicroDAGRWaypoints {};
|
||||
class addZenModules {};
|
||||
class bindEventHandlers {};
|
||||
class bindUnconsciousListener {};
|
||||
class bindVehicleActions {};
|
||||
class addGetNearMenPFH {};
|
||||
class addDraw3DPFH {};
|
||||
class registerPFHCode {};
|
||||
class clearPFHCode {};
|
||||
class logRespawnButtonUse {};
|
||||
class registerPFHCode {};
|
||||
class staticLineProtection {};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -2,48 +2,6 @@
|
||||
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
["ace_killed", {
|
||||
params ["_unit", "_causeOfDeath", "_killer", "_instigator"];
|
||||
|
||||
if (!local _unit) exitWith {};
|
||||
|
||||
if (_causeOfDeath == "respawn_button") then {
|
||||
private _timeWentUnconscious = _corpse getVariable [QGVARMAIN(lastTimeKnockedOut), -1];
|
||||
private _durationSpentUnconscious = -1;
|
||||
if (_timeWentUnconscious > -1) then {
|
||||
_durationSpentUnconscious = diag_tickTime - _timeWentUnconscious;
|
||||
};
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"RESPAWNED WHILE UNCONSCIOUS",
|
||||
[_unit, [
|
||||
["durationSpentUnconscious", _durationSpentUnconscious]
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] remoteExec [QEFUNC(common,log), 2];
|
||||
// format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0];
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
|
||||
// Add GetOutMan event handler to grant temporary invincibility to players ejecting from vehicles
|
||||
// Only for players who have "hooked up" using VS static line
|
||||
// and are ejecting from a plane or helicopter above 100m
|
||||
player addEventHandler ["GetOutMan", {
|
||||
params ["_unit", "_role", "_vehicle", "_turret", "_isEject"];
|
||||
if (!isEject) exitWith {};
|
||||
if (isNil {_unit getVariable "VS_Jump"}) exitWith {};
|
||||
if (
|
||||
not (_vehicle isKindOf "Plane" || _vehicle isKindOf "Helicopter") ||
|
||||
((getPosATL _vehicle)#2) < 100
|
||||
) exitWith {};
|
||||
|
||||
_unit allowDamage false;
|
||||
[{_this allowDamage true}, _unit, 5] call CBA_fnc_waitAndExecute;
|
||||
}];
|
||||
|
||||
|
||||
[
|
||||
{
|
||||
params ["_unit", "_object", "_cost"];
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#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, true];
|
||||
}] 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, true];
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
@@ -8,13 +8,17 @@ call FUNC(addZenModules);
|
||||
call FUNC(bindEventHandlers);
|
||||
call FUNC(bindVehicleActions);
|
||||
|
||||
// add core getNearMenPFH handler
|
||||
localNamespace setVariable [QGVAR(nearMen), []];
|
||||
call FUNC(addGetNearMenPFH);
|
||||
// add core draw3dPFH handler
|
||||
localNamespace setVariable [QGVAR(pfhCode), []];
|
||||
call FUNC(addDraw3DPFH);
|
||||
|
||||
// add listener that tracks when the player goes unconscious and saves a variable with time
|
||||
call FUNC(bindUnconsciousListener);
|
||||
// add listener that tracks using the respawn button while unconscious
|
||||
call FUNC(logRespawnButtonUse);
|
||||
// add conditional eject-from-vehicle handler to apply temp invincibility when static line jumping
|
||||
call FUNC(staticLineProtection);
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
|
||||
56
framework/client/functions/fn_logRespawnButtonUse.sqf
Normal file
56
framework/client/functions/fn_logRespawnButtonUse.sqf
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
["ace_killed", {
|
||||
params ["_unit", "_causeOfDeath", "_killer", "_instigator"];
|
||||
|
||||
if (not (local _unit)) exitWith {};
|
||||
|
||||
private _causeOfDeath = _unit getVariable ["ace_medical_causeOfDeath", "#scripted"];
|
||||
|
||||
if (_causeOfDeath != "respawn_button") exitWith {};
|
||||
private _timeWentUnconscious = _unit getVariable [QGVARMAIN(lastTimeKnockedOut), -1];
|
||||
private _durationSpentUnconscious = -1;
|
||||
if (_timeWentUnconscious != -1) then {
|
||||
_durationSpentUnconscious = diag_tickTime - _timeWentUnconscious;
|
||||
};
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"RESPAWNED WHILE UNCONSCIOUS",
|
||||
[_unit, [
|
||||
["durationSpentUnconscious", _durationSpentUnconscious]
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] remoteExec [QEFUNC(common,log), 2];
|
||||
// format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0];
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
|
||||
["ace_medical_knockOut", { // local event for module & epi event
|
||||
// systemChat format["ace_medical_knockOut: %1", _this];
|
||||
private _unit = _this;
|
||||
if (not (local _unit)) exitWith {};
|
||||
_this setVariable [QGVARMAIN(lastTimeKnockedOut), diag_tickTime];
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
["ace_medical_WakeUp", { // local event for module & epi event
|
||||
// systemChat format["ace_medical_WakeUp: %1", _this];
|
||||
private _unit = _this;
|
||||
if (not (local _unit)) exitWith {};
|
||||
_this setVariable [QGVARMAIN(lastTimeKnockedOut), nil];
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
["ace_unconscious", { // used when applying damage
|
||||
params ["_unit", "_isUnconscious"];
|
||||
if (not (local _unit)) exitWith {};
|
||||
|
||||
if (_isUnconscious && isNil {_unit getVariable QGVARMAIN(lastTimeKnockedOut)}) then {
|
||||
// systemChat format["%1 is unconscious", _unit];
|
||||
_unit setVariable [QGVARMAIN(lastTimeKnockedOut), diag_tickTime];
|
||||
} else {
|
||||
// systemChat format["%1 is conscious", _unit];
|
||||
_unit setVariable [QGVARMAIN(lastTimeKnockedOut), nil];
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
23
framework/client/functions/fn_staticLineProtection.sqf
Normal file
23
framework/client/functions/fn_staticLineProtection.sqf
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
// Add GetOutMan event handler to grant temporary invincibility to players ejecting from vehicles
|
||||
// Only for players who have "hooked up" using VS static line
|
||||
// and are ejecting from a plane or helicopter above 100m
|
||||
player addEventHandler ["GetOutMan", {
|
||||
params ["_unit", "_role", "_vehicle", "_turret", "_isEject"];
|
||||
if (!isEject) exitWith {};
|
||||
if (isNil {_unit getVariable "VS_Jump"}) exitWith {};
|
||||
if (
|
||||
not (_vehicle isKindOf "Plane" || _vehicle isKindOf "Helicopter") ||
|
||||
((getPosATL _vehicle)#2) < 100
|
||||
) exitWith {};
|
||||
|
||||
_unit allowDamage false;
|
||||
(vehicle _unit) allowDamage false;
|
||||
[{
|
||||
_this allowDamage true;
|
||||
(vehicle _this) allowDamage true;
|
||||
}, _unit, 5] call CBA_fnc_waitAndExecute;
|
||||
}];
|
||||
Reference in New Issue
Block a user