General - Change UAV unit config lookups to unitIsUAV (#9735)

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
This commit is contained in:
Grim 2024-01-15 18:39:28 -03:00 committed by GitHub
parent 03c7c4e97f
commit cb08a7c172
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 11 deletions

View File

@ -17,4 +17,4 @@
params [["_vehicle", objNull, [objNull]]];
crew _vehicle select {getText (configOf _x >> "simulation") == "UAVPilot"} // return
(crew _vehicle) select {unitIsUAV _x} // return

View File

@ -28,7 +28,7 @@ if ((_unit getHitPointDamage "HitLegs") >= 0.5) exitWith {false};
// Static weapons need to be empty for carrying (ignore UAV AI)
if (_target isKindOf "StaticWeapon") exitWith {
(crew _target) findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1
(crew _target) findIf {!unitIsUAV _x} == -1
};
// Units need to be unconscious or limping; Units also need to not be in ragdoll, as that causes desync issues

View File

@ -24,7 +24,7 @@ if !([_unit, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)) exi
// Static weapons need to be empty for dragging (ignore UAV AI)
if (_target isKindOf "StaticWeapon") exitWith {
(crew _target) findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1
(crew _target) findIf {!unitIsUAV _x} == -1
};
// Units need to be unconscious or limping; Units also need to not be in ragdoll, as that causes desync issues

View File

@ -12,8 +12,7 @@ GVAR(playerIsVirtual) = false;
["unit", { // Add unit changed EH to check if player is either virtual (logic) or a UAV AI
params ["_unit"];
GVAR(playerIsVirtual) = ((getNumber (configOf _unit >> "isPlayableLogic")) == 1) ||
{(getText (configOf _unit >> "simulation")) == "UAVPilot"};
GVAR(playerIsVirtual) = unitIsUAV _unit || {(getNumber (configOf _unit >> "isPlayableLogic")) == 1};
TRACE_3("unit changed",_unit,typeOf _unit,GVAR(playerIsVirtual));
}, true] call CBA_fnc_addPlayerEventHandler;

View File

@ -16,9 +16,8 @@
while {(_allHitPoints param [0, ""]) select [0,1] == "#"} do { WARNING_1("Ignoring Reflector hitpoint %1", _allHitPoints deleteAt 0); };
if (_allHitPoints param [0, ""] != "ACE_HDBracket") then {
private _config = configOf _unit;
if (getText (_config >> "simulation") == "UAVPilot") exitWith {TRACE_1("ignore UAV AI",typeOf _unit);};
if (getNumber (_config >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit)};
if (unitIsUAV _unit) exitWith {TRACE_1("ignore UAV AI",typeOf _unit);};
if (getNumber ((configOf _unit) >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit)};
ERROR_1("Bad hitpoints for unit type ""%1""",typeOf _unit);
} else {
// Calling this function inside curly brackets allows the usage of

View File

@ -12,9 +12,8 @@ PREP_RECOMPILE_END;
["CAManBase", "init", {
params ["_unit"];
private _config = configOf _unit;
if (getText (_config >> "simulation") == "UAVPilot") exitWith {TRACE_1("ignore UAV AI",typeOf _unit);};
if (getNumber (_config >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit)};
if (unitIsUAV _unit) exitWith {TRACE_1("ignore UAV AI",typeOf _unit);};
if (getNumber ((configOf _unit) >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit)};
// Hopefully this EH gets added first as it can only effect other EH called after it
private _ehIndex = _unit addEventHandler ["Killed", {_this call FUNC(handleKilled)}];