Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General - Change UAV unit config lookups to unitIsUAV #9735

Merged
merged 4 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_getVehicleUAVCrew.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@

params [["_vehicle", objNull, [objNull]]];

crew _vehicle select {getText (configOf _x >> "simulation") == "UAVPilot"} // return
(crew _vehicle) select {unitIsUAV _x} // return
2 changes: 1 addition & 1 deletion addons/dragging/functions/fnc_canCarry.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion addons/dragging/functions/fnc_canDrag.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions addons/gforces/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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));
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved
}, true] call CBA_fnc_addPlayerEventHandler;

Expand Down
5 changes: 2 additions & 3 deletions addons/medical_engine/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions addons/medical_status/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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)}];
Expand Down