Skip to content

Commit

Permalink
Vehicle Damage - Improve finding engine selection (#10340)
Browse files Browse the repository at this point in the history
Co-authored-by: PabstMirror <[email protected]>
  • Loading branch information
johnb432 and PabstMirror authored Sep 29, 2024
1 parent 6bbff91 commit dbf5aed
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion addons/cookoff/functions/fnc_cookOffLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* 0: Vehicle <OBJECT>
* 1: Spawn fire jet <BOOL>
* 2: Spawn fire ring <BOOL>
* 3: What selection fire will originate from <STRING>
* 3: What selection fire will originate from <STRING><ARRAY>
* 4: Cookoff intensity value <NUMBER>
* 5: Start time <NUMBER>
* 6: Duration of effect (max 20 seconds) <NUMBER>
Expand Down
2 changes: 1 addition & 1 deletion addons/cookoff/functions/fnc_cookOffServer.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* 4: Delay between smoke and fire enabled <BOOL> (default: true)
* 5: Ammo detonation chance <NUMBER> (default: 0)
* 6: Detonate after cook-off <BOOL> (default: false)
* 7: Selection for fire source <STRING> (default: "")
* 7: Selection for fire source <STRING><ARRAY> (default: "")
* 8: Can spawn fire ring <BOOL> (default: true)
* 9: Can spawn fire jet <BOOL> (default: true)
* 10: Maximum intensity <NUMBER> (default: MAX_COOKOFF_INTENSITY)
Expand Down
6 changes: 5 additions & 1 deletion addons/cookoff/functions/fnc_engineFireLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ if (hasInterface) then {
private _hitPoints = getAllHitPointsDamage _vehicle;

// Get hitpoint for engine
private _index = (_hitPoints select 0) findIf {_x == "hitengine"};
private _index = if (_hitPoints isNotEqualTo []) then {
(_hitPoints select 0) findIf {_x == "hitengine"}
} else {
-1
};

// Get corresponding selection
private _position = if (_index != -1) then {
Expand Down
13 changes: 12 additions & 1 deletion addons/vehicle_damage/functions/fnc_handleCookoff.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,19 @@ private _detonateAfterCookoff = (_fireDetonateChance / 4) > random 1;

private _sourceHitpoint = "";

// Passed to the selectionPosition command in cookoff
if (_hitPart == "engine") then {
_sourceHitpoint = ["hit_engine_point", "HitPoints"];
private _hitPoints = getAllHitPointsDamage _vehicle;

if (_hitPoints isEqualTo []) exitWith {};

// Get hitpoint for engine
private _index = (_hitPoints select 0) findIf {_x == "hitengine"};

if (_index == -1) exitWith {};

// Get corresponding selection
_sourceHitpoint = [(_hitPoints select 1) select _index, "HitPoints", "AveragePoint"];
};

[QEGVAR(cookOff,cookOffServer), [_vehicle, _intensity, _source, _instigator, _delaySmoke, _fireDetonateChance, _detonateAfterCookoff, _sourceHitpoint, _canRing, _canJet]] call CBA_fnc_serverEvent;
Expand Down

0 comments on commit dbf5aed

Please sign in to comment.