Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookoff - Fix zeus end keybind not killing ammo containers #10434

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion addons/cookoff/functions/fnc_handleDamageBox.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,24 @@
// If cookoff for boxes is disabled, exit
if (!GVAR(enableAmmobox) || {GVAR(ammoCookoffDuration) == 0}) exitWith {};

params ["_box", "", "_damage", "_source", "_ammo", "", "_instigator", "_hitPoint"];
params ["_box", "_selection", "_damage", "_source", "_ammo", "_hitIndex", "_instigator", "_hitPoint", "", "_context"];

if (!local _box) exitWith {};

// If it's already dead, ignore
if (!alive _box) exitWith {};

private _currentDamage = if (_selection != "") then {
_box getHitIndex _hitIndex
} else {
damage _box
};

// Killing units via End key is an edge case (#10375)
// This didn't matter pre-Arma 3 2.18 but now this goes through the event handler
// TODO: Structural fire damage >= 1 in a single damage event could still be caught here and we don't want that, but we haven't found a better way to catch this, fire damage should be small most of the time anyway
if (_context == 0 && {(abs (_damage - _currentDamage - 1)) < 0.001 && _ammo == "" && isNull _source && isNull _instigator}) exitWith {_damage};

if !(_box getVariable [QGVAR(enableAmmoCookoff), true]) exitWith {};

if !(_hitPoint == "" && {_damage > 0.5}) exitWith {}; // "" means structural damage
Expand Down