From f6cefa76a215140617024eb0238f67be0e3952f7 Mon Sep 17 00:00:00 2001 From: Salluci <69561145+Salluci@users.noreply.github.com> Date: Tue, 20 Apr 2021 08:10:50 -0300 Subject: [PATCH] Medical - Add Vehicle Crashes setting (#8149) Co-authored-by: jonpas --- addons/medical_damage/initSettings.sqf | 9 +++++++++ addons/medical_damage/stringtable.xml | 6 ++++++ addons/medical_engine/functions/fnc_handleDamage.sqf | 7 ++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/addons/medical_damage/initSettings.sqf b/addons/medical_damage/initSettings.sqf index 14dac50f1a5..5d9003addf9 100644 --- a/addons/medical_damage/initSettings.sqf +++ b/addons/medical_damage/initSettings.sqf @@ -42,3 +42,12 @@ [0, 1, 1, 2, true], true ] call CBA_fnc_addSetting; + +[ + QEGVAR(medical,enableVehicleCrashes), + "CHECKBOX", + [LSTRING(EnableVehicleCrashes_DisplayName), LSTRING(EnableVehicleCrashes_Description)], + ELSTRING(medical,Category), + true, + true +] call CBA_fnc_addSetting; diff --git a/addons/medical_damage/stringtable.xml b/addons/medical_damage/stringtable.xml index ae56dc79c8c..453293e159c 100644 --- a/addons/medical_damage/stringtable.xml +++ b/addons/medical_damage/stringtable.xml @@ -703,5 +703,11 @@ The chance of dying to a fatal injury. + + Enable Vehicle Crash Damage + + + Controls whether crew receives damage from vehicle collisions. + diff --git a/addons/medical_engine/functions/fnc_handleDamage.sqf b/addons/medical_engine/functions/fnc_handleDamage.sqf index 1975bde0c56..9eb799cdcd2 100644 --- a/addons/medical_engine/functions/fnc_handleDamage.sqf +++ b/addons/medical_engine/functions/fnc_handleDamage.sqf @@ -94,7 +94,7 @@ if (_hitPoint isEqualTo "ace_hdbracket") exitWith { // represents all incoming damage for selecting a non-selectionSpecific wound location, (used for selectRandomWeighted [value1,weight1,value2....]) private _damageSelectionArray = [ - HITPOINT_INDEX_HEAD, _damageHead select 1, HITPOINT_INDEX_BODY, _damageBody select 1, HITPOINT_INDEX_LARM, _damageLeftArm select 1, + HITPOINT_INDEX_HEAD, _damageHead select 1, HITPOINT_INDEX_BODY, _damageBody select 1, HITPOINT_INDEX_LARM, _damageLeftArm select 1, HITPOINT_INDEX_RARM, _damageRightArm select 1, HITPOINT_INDEX_LLEG, _damageLeftLeg select 1, HITPOINT_INDEX_RLEG, _damageRightLeg select 1 ]; @@ -204,14 +204,15 @@ if ( // It does fire the EH multiple times, but this seems to scale with the intensity of the crash private _vehicle = vehicle _unit; if ( - _hitPoint isEqualTo "#structural" && + EGVAR(medical,enableVehicleCrashes) && + {_hitPoint isEqualTo "#structural"} && {_ammo isEqualTo ""} && {_vehicle != _unit} && {vectorMagnitude (velocity _vehicle) > 5} // todo: no way to detect if stationary and another vehicle hits you ) exitWith { private _damageSelectionArray = [ - HITPOINT_INDEX_HEAD, 1, HITPOINT_INDEX_BODY, 1, HITPOINT_INDEX_LARM, 1, + HITPOINT_INDEX_HEAD, 1, HITPOINT_INDEX_BODY, 1, HITPOINT_INDEX_LARM, 1, HITPOINT_INDEX_RARM, 1, HITPOINT_INDEX_LLEG, 1, HITPOINT_INDEX_RLEG, 1 ]; [QEGVAR(medical,woundReceived), [_unit, "Body", _newDamage, _unit, "vehiclecrash", _damageSelectionArray]] call CBA_fnc_localEvent;