ACE3/addons/cookoff/functions/fnc_engineFire.sqf
Brandon Danyluk c4156a6888
Add Vehicle Damage (ACE2 port) & Enhance Cook-Off (#7565)
* Initital port of ACE2 Vehicle Damage

* Add fire damage and burning people

* Migrate vehicle damge stuff from cookoff. Change cookoff function to enhance effect.

* Minor tweaks

* Add incendiary values to all applicable ammunition. Add engine fire/smoke if hit enough

* Handle car damage more elegantly.

* Added ability to create fire sources arbitrarily

* tweaks

* Add chance to detonate after cookoff

* disable compile cache

* Move blown-off turret config to vehicle damage. Add settings inititalized EH for initializing off settings

* tabs->spaces

* Various code improvements

* Change to count loop for deleting effects

* update addon requirements

* remove vanilla config requirements

* Add RHS compatability

* RHS compat. Various QOL fixes/changes

* Various tweaks to compats and code.

* High-Explosive damage tweak

* Change how penetration is calculated for parts

* Fix RHS compat

* Create setting for flare effect

* increase burning scream sounds

* swap out file name for snake_case

* move incendiary values out of vehicle damage. remove medical dependency

* vehicle_dammage - update all refs to snake

* sqf fixes

* fix fire string package caps

* fix pboprefix

* Default setting to on

* Add variables to enable/disable ring fire to avoid goofy looking vehicles. Enhance how particles are cleaned up. Remove advanced penetration simulation. Change how fire intensity is calculated. Add setting to "disable" vehicle after cookoff

* Fix bug where event handler wasn't giving the damage last.

* change to snake

* fix build errors

* Fix UBC

* Fix Order of Operations

* avoid O^2 events

* Make sure that no damage processing happens on dead units

* Change some if statements

* Keep track of player's death to stop various things

* add quotes to right middle wheen

* Add VD documentation

* fire docs

* Code quality fixes

* Clarify documentation

* define IDD

* switch global -> server

* Add newline between header and first code statement

* stop the dead from suffering

Its hard to tell when a unit is dead or in spectator, so check the config of the unit to determine it.

* Add settings to disable cook-off effects

* Delete effects if vehicle is deleted before cookoff occurs. Don't cookoff player ammo. Throw weapon better

* Move fire into own PR

* fix tabs and macro

* Shuffle crew indices so that a random person is first on the list to be injured each time

* fix effects not clearing

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2021-10-14 10:49:27 -05:00

52 lines
1.4 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: KoffeinFlummi, commy2
* Start fire in engine block of a car.
*
* Arguments:
* 0: Vehicle <Object>
*
* Return Value:
* None
*
* Example:
* (vehicle player) call ace_cookoff_fnc_engineFire
*
* Public: No
*/
params ["_vehicle"];
if (_vehicle getVariable [QGVAR(isEngineSmoking), false]) exitWith {};
_vehicle setVariable [QGVAR(isEngineSmoking), true];
if (local _vehicle) then {
[QGVAR(engineFire), _vehicle] call CBA_fnc_globalEvent;
};
private _offset = getArray (_vehicle call CBA_fnc_getObjectConfig >> QGVAR(engineSmokeOffset));
if (_offset isEqualTo []) then {
_offset = [0,0,0];
};
private _position = [
0,
(boundingBoxReal _vehicle select 1 select 1) - 2,
(boundingBoxReal _vehicle select 0 select 2) + 2
] vectorAdd _offset;
private _smoke = "#particlesource" createVehicleLocal [0,0,0];
_smoke setParticleClass "ObjectDestructionSmoke1_2Smallx";
_smoke attachTo [_vehicle, _position];
[{
(_this select 0) params ["_vehicle", "_smoke", "_time"];
if (isNull _vehicle || {!alive _vehicle} || {_vehicle getHitPointDamage "HitEngine" < 0.9} || {CBA_missionTime > _time}) then {
deleteVehicle _smoke;
_vehicle setVariable [QGVAR(isEngineSmoking), false];
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
}, 5, [_vehicle, _smoke, CBA_missionTime + 240]] call CBA_fnc_addPerFrameHandler;