From a67815d0725326cb0785276b24a2e335a5cb77df Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 22 Aug 2017 13:27:11 -0500 Subject: [PATCH] Disable damage on cars loaded as cargo (#5402) --- addons/cargo/XEH_postInit.sqf | 5 +++++ addons/cargo/functions/fnc_loadItem.sqf | 6 ++++++ addons/common/XEH_postInit.sqf | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/addons/cargo/XEH_postInit.sqf b/addons/cargo/XEH_postInit.sqf index 051c77ec9c..9d531a8e1a 100644 --- a/addons/cargo/XEH_postInit.sqf +++ b/addons/cargo/XEH_postInit.sqf @@ -50,6 +50,11 @@ _item hideObjectGlobal false; _item setPosASL (AGLtoASL _emptyPosAGL); + + if ((getText (configFile >> "CfgVehicles" >> (typeOf _item) >> "simulation")) == "carx") then { + TRACE_1("re-enabling car damage",_item); + [_item, "blockDamage", "ACE_cargo", false] call EFUNC(common,statusEffect_set); + }; }] call CBA_fnc_addEventHandler; // Private events to handle adding actions globally via public functions diff --git a/addons/cargo/functions/fnc_loadItem.sqf b/addons/cargo/functions/fnc_loadItem.sqf index bb608ff926..f8b00478e6 100644 --- a/addons/cargo/functions/fnc_loadItem.sqf +++ b/addons/cargo/functions/fnc_loadItem.sqf @@ -36,6 +36,12 @@ if (_item isEqualType objNull) then { detach _item; _item attachTo [_vehicle,[0,0,-100]]; [QEGVAR(common,hideObjectGlobal), [_item, true]] call CBA_fnc_serverEvent; + + // Cars below water will take engine damage over time and eventualy become "water logged" and unfixable (because of negative z attach) + if ((getText (configFile >> "CfgVehicles" >> (typeOf _item) >> "simulation")) == "carx") then { + TRACE_1("disabling car damage",_item); + [_item, "blockDamage", "ACE_cargo", true] call EFUNC(common,statusEffect_set); + }; }; true diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 51baec47f9..bddbc2c217 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -22,7 +22,7 @@ ["forceWalk", false, ["ACE_SwitchUnits", "ACE_Attach", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_Sandbag", "ACE_refuel", "ACE_rearm", "ACE_dragging"]] call FUNC(statusEffect_addType); ["blockSprint", false, []] call FUNC(statusEffect_addType); ["setCaptive", true, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered), "ace_unconscious"]] call FUNC(statusEffect_addType); -["blockDamage", false, ["fixCollision"]] call FUNC(statusEffect_addType); +["blockDamage", false, ["fixCollision", "ACE_cargo"]] call FUNC(statusEffect_addType); ["blockEngine", false, ["ACE_Refuel"]] call FUNC(statusEffect_addType); [QGVAR(forceWalk), {