Medical - Add Vehicle Crashes setting (#8149)

Co-authored-by: jonpas <jonpas33@gmail.com>
This commit is contained in:
Salluci 2021-04-20 08:10:50 -03:00 committed by PabstMirror
parent e3a3e29444
commit c7d4981329
3 changed files with 19 additions and 3 deletions

View File

@ -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;

View File

@ -703,5 +703,11 @@
<Key ID="STR_ACE_Medical_Damage_DeathChance_Description">
<English>The chance of dying to a fatal injury.</English>
</Key>
<Key ID="STR_ACE_Medical_Damage_EnableVehicleCrashes_DisplayName">
<English>Enable Vehicle Crash Damage</English>
</Key>
<Key ID="STR_ACE_Medical_Damage_EnableVehicleCrashes_Description">
<English>Controls whether crew receives damage from vehicle collisions.</English>
</Key>
</Package>
</Project>

View File

@ -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;