mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
80b2fa9a05
* 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 * Vehicle damage fixes * Made hitpoint hash common * Update fnc_addEventHandler.sqf * Update fnc_medicalDamage.sqf * Update fnc_handleBail.sqf * Changed API * Remove `CBA_fnc_getConfigEntry` as much as possible, as it's 2x slower * More cleanup * More cleanup * Fix merging issues, remove turret tossing * Update translations * More cleanup * Reverted some logic back to original, minor tweaks & fixes * Fix undefined variable * Cleanup * Fixed bad logic * Update addons/vehicle_damage/script_macros.hpp Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update addons/vehicle_damage/functions/fnc_handleDamage.sqf * Update addons/vehicle_damage/stringtable.xml Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update addons/vehicle_damage/stringtable.xml Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update addons/vehicle_damage/XEH_postInit.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com> --------- Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
72 lines
2.3 KiB
Plaintext
72 lines
2.3 KiB
Plaintext
#include "..\script_component.hpp"
|
|
/*
|
|
* Author: tcvm
|
|
* Checks hitpoint damage and determines if a vehicle should cook off.
|
|
*
|
|
* Arguments:
|
|
* 0: Vehicle <OBJECT>
|
|
* 1: Chance of fire <NUMBER>
|
|
* 2: Intensity of cookoff <NUMBER>
|
|
* 3: Source of damage <OBJECT>
|
|
* 4: Person who caused damage <OBJECT>
|
|
* 5: Part of vehicle which got hit <STRING> (default: "")
|
|
* 6: Whether or not the vehicle can spawn ring-fire effect <BOOL> (default: false)
|
|
* 7: Whether or not the vehicle can spawn jet-fire effect <BOOL> (default: true)
|
|
*
|
|
* Return Value:
|
|
* If vehicle started or already cooking off <BOOL>
|
|
*
|
|
* Example:
|
|
* [cursorObject, 0.1, 5, player, player] call ace_vehicle_damage_fnc_handleCookoff
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_vehicle", "_chanceOfFire", "_intensity", "_source", "_instigator", ["_hitPart", ""], ["_canRing", true], ["_canJet", true]];
|
|
TRACE_8("handleCookoff",_vehicle,_chanceOfFire,_intensity,_source,_instigator,_hitPart,_canRing,_canJet);
|
|
|
|
// Ignore if the vehicle is already cooking off
|
|
if (_vehicle getVariable [QEGVAR(cookoff,isCookingOff), false]) exitWith {
|
|
TRACE_3("already cooking off",_vehicle,_chanceOfFire,_intensity);
|
|
|
|
true // return
|
|
};
|
|
|
|
_chanceOfFire = _chanceOfFire * EGVAR(cookoff,probabilityCoef);
|
|
|
|
// Failure to cook off
|
|
if (_chanceOfFire == 0 || {_chanceOfFire < random 1}) exitWith {
|
|
TRACE_3("no cook-off",_vehicle,_chanceOfFire,_intensity);
|
|
|
|
false // return
|
|
};
|
|
|
|
// Vehicle will cook off
|
|
private _configOf = configOf _vehicle;
|
|
private _fireDetonateChance = getNumber (_configOf >> QGVAR(detonationDuringFireProb));
|
|
|
|
if (_canRing) then {
|
|
_canRing = getNumber (_configOf >> QGVAR(canHaveFireRing)) == 1;
|
|
};
|
|
|
|
if (_canJet) then {
|
|
_canJet = getNumber (_configOf >> QEGVAR(cookoff,canHaveFireJet)) == 1;
|
|
};
|
|
|
|
private _delaySmoke = _chanceOfFire < random 1;
|
|
private _detonateAfterCookoff = (_fireDetonateChance / 4) > random 1;
|
|
|
|
private _source = "";
|
|
|
|
if (_hitPart == "engine") then {
|
|
_source = ["hit_engine_point", "HitPoints"];
|
|
};
|
|
|
|
[QEGVAR(cookOff,cookOffServer), [_vehicle, _intensity, _injurer, _injurer, _delayWithSmoke, _fireDetonateChance, _detonateAfterCookoff, _source, _canRing, _canJet]] call CBA_fnc_serverEvent;
|
|
TRACE_4("cooking-off",_vehicle,_chanceOfFire,_delaySmoke,_detonateAfterCookoff);
|
|
|
|
// Abandon vehicle
|
|
_vehicle call FUNC(abandon);
|
|
|
|
true // return
|