General - Convert vehicle to objectParent (#9801)

Convert vehicle to objectParent
This commit is contained in:
Mike-MF 2024-03-26 12:54:06 +00:00 committed by GitHub
parent a8ed533004
commit cee187adac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 27 additions and 27 deletions

View File

@ -19,7 +19,7 @@ params ["_unit"];
if !(_unit getVariable [QGVAR(inHand), false]) exitWith {false};
if (vehicle _unit != _unit) exitWith {
if (!isNull objectParent _unit) exitWith {
private _startPos = eyePos _unit;
private _aimLinePos = AGLToASL (positionCameraToWorld [0, 0, 1]);
private _intersections = lineIntersectsSurfaces [_startPos, _aimLinePos, _unit, objNull, false];

View File

@ -45,7 +45,7 @@ if (!(_unit getVariable [QGVAR(primed), false])) then {
private _newVelocity = (_p1 vectorFromTo _p2) vectorMultiply _velocity;
// Adjust for throwing from inside vehicles, where we have a vehicle-based velocity that can't be compensated for by a human
if (vehicle _unit != _unit) then {
if (!isNull objectParent _unit) then {
_newVelocity = _newVelocity vectorAdd (velocity (vehicle _unit));
};

View File

@ -27,7 +27,7 @@ if (_isUnconc) then {
};
} else {
//Woke up: if handcuffed, goto animation
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then {
if (_unit getVariable [QGVAR(isHandcuffed), false] && {isNull objectParent _unit}) then {
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
};

View File

@ -17,6 +17,6 @@
params ["_unit"];
if (currentWeapon _unit != "" && {currentWeapon _unit == primaryWeapon _unit} && {weaponLowered _unit} && {stance _unit == "STAND"} && {vehicle _unit == _unit}) then {
if (currentWeapon _unit != "" && {currentWeapon _unit == primaryWeapon _unit} && {weaponLowered _unit} && {stance _unit == "STAND"} && {isNull objectParent _unit}) then {
[_unit, "amovpercmstpsraswrfldnon", 0] call FUNC(doAnimation);
};

View File

@ -29,7 +29,7 @@ private _unitActionsCfg = configFile >> "CfgMovesBasic" >> "Actions" >> getText
TRACE_2("Animation/Action",configName _unitAnimationCfg,configName _unitActionsCfg);
if (vehicle _unit != _unit) then {
if (!isNull objectParent _unit) then {
private _interpolateArray = getArray (_unitAnimationCfg >> "interpolateTo");
for "_index" from 0 to (count _interpolateArray - 1) step 2 do {

View File

@ -18,7 +18,7 @@
params ["_unit"];
// Animation changes even inside vehicle post-1.60
if (stance _unit == "PRONE" || {vehicle _unit != _unit} || {_unit call EFUNC(common,isSwimming)}) exitWith {};
if (stance _unit == "PRONE" || {!isNull objectParent _unit} || {_unit call EFUNC(common,isSwimming)}) exitWith {};
[
_unit,

View File

@ -44,7 +44,7 @@ if (_tryLoad && {!(_target isKindOf "CAManBase")} && {["ace_cargo"] call EFUNC(c
// Fix anim when aborting carrying persons
if (_target isKindOf "CAManBase" || {animationState _unit in CARRY_ANIMATIONS}) then {
if (vehicle _unit == _unit && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
if (isNull objectParent _unit && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
[_unit, "", 2] call EFUNC(common,doAnimation);
};

View File

@ -24,7 +24,7 @@ if (isNull _explosive) exitWith {
deleteVehicle _target;
false
};
if (vehicle _unit != _unit || {(_unit call EFUNC(common,uniqueItems)) findAny GVAR(defusalKits) == -1}) exitWith {false};
if (!isNull objectParent _unit || {(_unit call EFUNC(common,uniqueItems)) findAny GVAR(defusalKits) == -1}) exitWith {false};
if (GVAR(RequireSpecialist) && {!([_unit] call EFUNC(Common,isEOD))}) exitWith {false};

View File

@ -20,7 +20,7 @@ _arguments params ["_unit", "", "_rope", "", "_timeToPlayRopeSound"];
_rope params ["", "", "", "_dummy", "_hook"];
//Wait until the unit is actually outside of the helicopter
if (vehicle _unit != _unit) exitWith {};
if (!isNull objectParent _unit) exitWith {};
// dummy lost hook
if (isNull _hook) exitWith {

View File

@ -20,7 +20,7 @@ _arguments params ["_unit", "_vehicle", "_rope", "_ropeIndex", "_hasBeenAttached
_rope params ["_attachmentPoint", "_ropeTop", "_ropeBottom", "_dummy", "_hook"];
//Wait until the unit is actually outside of the helicopter
if (vehicle _unit != _unit) exitWith {};
if (!isNull objectParent _unit) exitWith {};
//Prevent teleport if hook has been deleted due to rope cut
if (isNull _hook) exitWith {

View File

@ -22,7 +22,7 @@ if (!alive _unit) exitWith {};
private _fnc_underCover = {
params ["_unit"];
if (vehicle _unit != _unit && {!isTurnedOut _unit}) exitWith {true};
if (!isNull objectParent _unit && {!isTurnedOut _unit}) exitWith {true};
// looking up and no roof over head
private _position = eyePos _unit;

View File

@ -23,7 +23,7 @@ if (!alive _unit) exitWith {};
GVAR(FrameEvent) set [0, !(GVAR(FrameEvent) select 0)];
if (GVAR(FrameEvent) select 0) exitWith {
if (vehicle _unit != _unit && {!isTurnedOut _unit}) exitWith {
if (!isNull objectParent _unit && {!isTurnedOut _unit}) exitWith {
(GVAR(FrameEvent) select 1) set [0, false];
};

View File

@ -19,7 +19,7 @@
params ["_unit", "_actionName", "_isSelfTreatment"];
TRACE_3("playTreatmentAnim",_unit,_actionName,_isSelfTreatment);
if (vehicle _unit != _unit) exitWith {};
if (!isNull objectParent _unit) exitWith {};
private _configProperty = "animationMedic";
if (_isSelfTreatment) then {

View File

@ -28,7 +28,7 @@ if (_damageType in GVAR(noBloodDamageTypes)) exitWith {};
if (GVAR(enabledFor) == BLOOD_ONLY_PLAYERS && {!isPlayer _unit && {_unit != ACE_player}}) exitWith {};
// Don't bleed on the ground if in a vehicle
if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")}) exitWith {};
if (!isNull objectParent _unit && {!(vehicle _unit isKindOf "StaticWeapon")}) exitWith {};
private _bulletDir = if (isNull _shooter) then {
random 360 // Cannot calculate the direction properly, pick a random direction

View File

@ -22,7 +22,7 @@ params ["_unit"];
if !(_unit call FUNC(isBleeding)) exitWith {};
// Don't bleed on the ground if in a vehicle
if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")}) exitWith {};
if (!isNull objectParent _unit && {!(vehicle _unit isKindOf "StaticWeapon")}) exitWith {};
if (CBA_missionTime > (_unit getVariable [QGVAR(nextTime), -10])) then {
private _bloodLoss = (if (GVAR(useAceMedical)) then {GET_BLOOD_LOSS(_unit) * 2.5} else {getDammage _unit * 2}) min 6;

View File

@ -33,14 +33,14 @@ if (_isUnconscious) then {
};
// set animation inside vehicles
if (vehicle _unit != _unit) then {
if (!isNull objectParent _unit) then {
private _unconAnim = _unit call EFUNC(common,getDeathAnim);
TRACE_2("inVehicle - playing death anim",_unit,_unconAnim);
[_unit, _unconAnim] call EFUNC(common,doAnimation);
};
} else {
// reset animation inside vehicles
if (vehicle _unit != _unit) then {
if (!isNull objectParent _unit) then {
private _awakeAnim = _unit call EFUNC(common,getAwakeAnim);
TRACE_2("inVehicle - playing awake anim",_unit,_awakeAnim);
[_unit, _awakeAnim, 2] call EFUNC(common,doAnimation);

View File

@ -104,7 +104,7 @@ GVAR(bloodTickCounter) = 0;
if (ACE_player distance _unit > _distance) exitWith {};
if (vehicle _unit == _unit) then {
if (isNull objectParent _unit) then {
// say3D waits for the previous sound to finish, so use a dummy instead
private _dummy = "#dynamicsound" createVehicleLocal [0, 0, 0];
_dummy attachTo [_unit, [0, 0, 0], "camera"];

View File

@ -23,7 +23,7 @@ TRACE_2("onCameraViewChanged",_unit,_cameraView);
call FUNC(refreshGoggleType);
if (GVAR(disableNVGsWithSights) && {(hmd _unit) != ""}) then {
if ((vehicle _unit == _unit)
if ((isNull objectParent _unit)
|| {isTurnedOut _unit}
|| {!([_unit] call EFUNC(common,hasHatch))
&& {[_unit] call EFUNC(common,getTurretIndex) in ([vehicle _unit] call EFUNC(common,getTurretsFFV))}

View File

@ -21,7 +21,7 @@ TRACE_2("onVisionModeChanged",_unit,_visionMode);
// Handle disableNVGsWithSights setting:
if (GVAR(disableNVGsWithSights) && {(hmd _unit) != ""}) then {
if ((vehicle _unit == _unit)
if ((isNull objectParent _unit)
|| {isTurnedOut _unit}
|| {!([_unit] call EFUNC(common,hasHatch))
&& {[_unit] call EFUNC(common,getTurretIndex) in ([vehicle _unit] call EFUNC(common,getTurretsFFV))}

View File

@ -17,7 +17,7 @@
params ["_unit"];
if (vehicle _unit != _unit) exitWith {false};
if (!isNull objectParent _unit) exitWith {false};
private _weaponClass = currentWeapon _unit;
private _weaponIndex = [_unit, _weaponClass] call EFUNC(common,getWeaponIndex);

View File

@ -18,7 +18,7 @@
params ["_unit"];
if (cameraView == "GUNNER") exitWith {false};
if (vehicle _unit != _unit) exitWith {false};
if (!isNull objectParent _unit) exitWith {false};
if (GVAR(simplifiedZeroing)) exitWith {false};
if (!(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false])) exitWith {false};

View File

@ -18,7 +18,7 @@
params ["_unit"];
if (cameraView == "GUNNER") exitWith {false};
if (vehicle _unit != _unit) exitWith {false};
if (!isNull objectParent _unit) exitWith {false};
if (!(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false])) exitWith {false};
private _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);

View File

@ -17,7 +17,7 @@
params ["_unit"];
if (vehicle _unit != _unit) exitWith {false};
if (!isNull objectParent _unit) exitWith {false};
private _weaponClass = currentWeapon _unit;
private _weaponIndex = [_unit, _weaponClass] call EFUNC(common,getWeaponIndex);

View File

@ -19,6 +19,6 @@ params ["_unit"];
!([_unit] call EFUNC(common,isPlayer)
|| {_unit in playableUnits}
|| {vehicle _unit != _unit}
|| {!isNull objectParent _unit}
|| {_unit getVariable [QGVAR(IsPlayerUnit), false]}
|| {_unit getVariable [QGVAR(IsPlayerControlled), false]}) // return

View File

@ -23,7 +23,7 @@ if (!hasInterface) exitWith {};
if (!XGVAR(lowerInVehicles)) exitWith {};
if (vehicle _unit != _unit) then {
if (!isNull objectParent _unit) then {
call FUNC(lowerVolume);
} else {
call FUNC(restoreVolume);

View File

@ -29,7 +29,7 @@ if (_activated && local _logic) then {
case (isnull _unit): {_error = localize "str_a3_BIS_fnc_showCuratorFeedbackMessage_506";};
case !(alive _unit): {_error = localize "str_a3_BIS_fnc_moduleArsenal_errorDead";};
case (isnull group _unit || !(side group _unit in [east,west,resistance,civilian])): {_error = localize "str_a3_BIS_fnc_moduleArsenal_errorBrain";};
case (vehicle _unit != _unit || effectivecommander _unit != _unit): {_error = localize "str_a3_BIS_fnc_moduleArsenal_errorVehicle";};
case (!isNull objectParent _unit || effectivecommander _unit != _unit): {_error = localize "str_a3_BIS_fnc_moduleArsenal_errorVehicle";};
};
if (_error == "") then {