2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2021-10-14 15:49:27 +00:00
|
|
|
/*
|
2023-08-16 23:18:01 +00:00
|
|
|
* Author: tcvm
|
2021-10-14 15:49:27 +00:00
|
|
|
* Checks hitpoint damage and determines if a vehicle should cookoff.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: The vehicle <OBJECT>
|
|
|
|
* 1: Chance of fire <NUMBER>
|
|
|
|
* 2: Intensity of cookoff <NUMBER>
|
|
|
|
* 3: Person who instigated cookoff <OBJECT> (default: objNull)
|
|
|
|
* 4: Part of vehicle which got hit <STRING> (default: "")
|
2023-08-23 17:37:17 +00:00
|
|
|
* 5: Whether or not the vehicle can spawn ring-fire effect <BOOL> (default: false)
|
|
|
|
* 6: Can Jet <BOOL> (default: true)
|
2021-10-14 15:49:27 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* If cooked off
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [tank2, 0.1, 5] call ace_vehicle_damage_fnc_handleCookoff;
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2023-08-23 17:37:17 +00:00
|
|
|
params ["_vehicle", "_chanceOfFire", "_intensity", ["_injurer", objNull], ["_hitPart", ""], ["_canRing", false], ["_canJet", true]];
|
2021-10-14 15:49:27 +00:00
|
|
|
|
2024-06-05 19:36:39 +00:00
|
|
|
// Ignore if the vehicle is already cooking off
|
|
|
|
if (_vehicle getVariable [QEGVAR(cookoff,isCookingOff), false]) exitWith {true};
|
2021-10-14 15:49:27 +00:00
|
|
|
|
2024-06-05 19:36:39 +00:00
|
|
|
_chanceOfFire = _chanceOfFire * EGVAR(cookoff,probabilityCoef);
|
|
|
|
|
|
|
|
if (_chanceOfFire >= random 1) exitWith {
|
2022-03-09 03:41:21 +00:00
|
|
|
private _configOf = configOf _vehicle;
|
|
|
|
private _fireDetonateChance = [_configOf >> QGVAR(detonationDuringFireProb), "number", 0] call CBA_fnc_getConfigEntry;
|
2021-10-14 15:49:27 +00:00
|
|
|
if (_canRing) then {
|
2022-03-09 03:41:21 +00:00
|
|
|
_canRing = ([_configOf >> QGVAR(canHaveFireRing), "number", 0] call CBA_fnc_getConfigEntry) == 1;
|
2021-10-14 15:49:27 +00:00
|
|
|
};
|
|
|
|
|
2023-08-23 17:37:17 +00:00
|
|
|
if (_canJet) then {
|
|
|
|
_canJet = ([_configOf >> QEGVAR(cookoff,canHaveFireJet), "number", 1] call CBA_fnc_getConfigEntry) == 1;
|
|
|
|
};
|
|
|
|
|
2021-10-14 15:49:27 +00:00
|
|
|
private _delayWithSmoke = _chanceOfFire < random 1;
|
|
|
|
private _detonateAfterCookoff = (_fireDetonateChance / 4) > random 1;
|
2021-10-30 21:42:03 +00:00
|
|
|
|
2021-10-14 15:49:27 +00:00
|
|
|
private _source = "";
|
2024-03-07 21:08:13 +00:00
|
|
|
if (_hitPart == "engine") then {
|
2021-10-14 15:49:27 +00:00
|
|
|
_source = ["hit_engine_point", "HitPoints"];
|
|
|
|
};
|
|
|
|
|
2024-06-05 19:36:39 +00:00
|
|
|
[QEGVAR(cookOff,cookOffServer), [_vehicle, _intensity, _injurer, _injurer, _delayWithSmoke, _fireDetonateChance, _detonateAfterCookoff, _source, _canRing, _canJet]] call CBA_fnc_serverEvent;
|
2021-10-14 15:49:27 +00:00
|
|
|
LOG_4("Cooking-off [%1] with a chance-of-fire [%2] - Delayed Smoke | Detonate after cookoff [%3 | %4]",_vehicle,_chanceOfFire,_delayWithSmoke,_detonateAfterCookoff);
|
|
|
|
[_vehicle] spawn FUNC(abandon);
|
|
|
|
LOG_1("[%1] is on fire is bailing",_vehicle);
|
2021-10-30 21:42:03 +00:00
|
|
|
|
2021-10-14 15:49:27 +00:00
|
|
|
true
|
|
|
|
};
|
|
|
|
|
|
|
|
LOG_2("[%1] No Cook-off - Chance of fire [%2]",_vehicle,_chanceOfFire);
|
|
|
|
false
|