Medical AI - Fix AI healing itself too fast when hit (#7955)

* Fix AI healing itself too fast when hit

* make time constants gvars

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
BaerMitUmlaut 2020-10-29 17:38:24 +01:00 committed by GitHub
parent 2b0db19807
commit b389740a29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -9,6 +9,11 @@
_unit setVariable [QGVAR(lastFired), CBA_missionTime]; _unit setVariable [QGVAR(lastFired), CBA_missionTime];
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;
["CAManBase", "Hit", {
params ["_unit"];
_unit setVariable [QGVAR(lastHit), CBA_missionTime];
}] call CBA_fnc_addClassEventHandler;
#include "stateMachine.sqf" #include "stateMachine.sqf"
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;

View File

@ -8,4 +8,8 @@ PREP_RECOMPILE_END;
#include "initSettings.sqf" #include "initSettings.sqf"
// default time values for AI being ready to heal, used in fnc_isSafe
if (isNil QGVAR(timeSafe_shoot)) then { GVAR(timeSafe_shoot) = 30; };
if (isNil QGVAR(timeSafe_hit)) then { GVAR(timeSafe_hit) = 30; };
ADDON = true; ADDON = true;

View File

@ -16,5 +16,6 @@
*/ */
(getSuppression _this == 0) (getSuppression _this == 0)
&& {CBA_missionTime - (_this getVariable [QGVAR(lastFired), -30]) > 30} && {CBA_missionTime - (_this getVariable [QGVAR(lastFired), -999999]) > GVAR(timeSafe_shoot)}
&& {CBA_missionTime - (_this getVariable [QGVAR(lastHit), -999999]) > GVAR(timeSafe_hit)}
&& {!(_this getVariable [QEGVAR(captives,isHandcuffed), false])} && {!(_this getVariable [QEGVAR(captives,isHandcuffed), false])}