mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
c44a1e7ea7
* Cook-off improvements * More changes * Update fnc_getVehicleAmmo.sqf * Better engine fire placement * Update fnc_detonateAmmunition.sqf * Update XEH_postInit.sqf * Update fnc_getVehicleAmmo.sqf * Update events-framework.md * Various improvements * Separate effect handling * Tweaks * Update XEH_postInit.sqf * Prevent double ammo detonation * Fixed objects not being able to cook-off again * Added incendiary rounds as source of box cookoff * Converted enable setting to bool * Fixed brackets * Update fnc_cookOff.sqf * Update CfgEden.hpp * Removed GVAR(enable), added GVAR(enableFire) back * Update initSettings.inc.sqf * Update events-framework.md * Update addons/cookoff/functions/fnc_cookOffEffect.sqf * Restructured, redid API events * Fix effect for JIP, minor optimisations * Removed `cbaSettings_settingChanged` * Renamed variables, tweaked string table entries * Update fire damage #9991 * Capitalize comments again * Fix cookoff for very short durations and fix effect removal being too quick
55 lines
1.9 KiB
Plaintext
55 lines
1.9 KiB
Plaintext
#include "..\script_component.hpp"
|
|
/*
|
|
* Author: johnb43
|
|
* Starts detonating ammunition from an object (e.g. vehicle or crate).
|
|
*
|
|
* Arguments:
|
|
* 0: Object <OBJECT>
|
|
* 1: Destroy when finished <BOOL> (default: false)
|
|
* 2: Source <OBJECT> (default: objNull)
|
|
* 3: Instigator <OBJECT> (default: objNull)
|
|
* 4: Initial delay <NUMBER> (default: 0)
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [cursorObject] call ace_cookoff_fnc_detonateAmmunitionServer
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
if (!isServer) exitWith {};
|
|
|
|
params ["_object", ["_destroyWhenFinished", false], ["_source", objNull], ["_instigator", objNull], ["_initialDelay", 0]];
|
|
|
|
if (isNull _object) exitWith {};
|
|
|
|
// Check if the object can cook its ammo off
|
|
if (
|
|
underwater _object ||
|
|
{private _posASL = getPosWorld _object; surfaceIsWater _posASL && {(_posASL select 2) < 0}} || // Underwater is not very reliable, so use model center instead
|
|
{GVAR(ammoCookoffDuration) == 0} ||
|
|
{!([GVAR(enableAmmoCookoff), GVAR(enableAmmobox)] select (_object isKindOf "ReammoBox_F"))} ||
|
|
{!(_object getVariable [QGVAR(enableAmmoCookoff), true])}
|
|
) exitWith {};
|
|
|
|
// Don't have an object detonate its ammo twice
|
|
if (_object getVariable [QGVAR(isAmmoDetonating), false]) exitWith {};
|
|
|
|
_object setVariable [QGVAR(isAmmoDetonating), true, true];
|
|
|
|
_object setVariable [QGVAR(cookoffMagazines), _object call FUNC(getVehicleAmmo)];
|
|
|
|
// TODO: When setMagazineTurretAmmo and magazineTurretAmmo are fixed (https://feedback.bistudio.com/T79689),
|
|
// we can add gradual ammo removal during cook-off
|
|
if (GVAR(removeAmmoDuringCookoff)) then {
|
|
clearMagazineCargoGlobal _object;
|
|
|
|
{
|
|
[QEGVAR(common,removeMagazinesTurret), [_object, _x select 0, _x select 1], _object, _x select 1] call CBA_fnc_turretEvent;
|
|
} forEach (magazinesAllTurrets _object);
|
|
};
|
|
|
|
[LINKFUNC(detonateAmmunitionServerLoop), [_object, _destroyWhenFinished, _source, _instigator], _initialDelay] call CBA_fnc_waitAndExecute;
|