Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
13e3ba3
Reworked fire module
johnb432 Jan 26, 2024
623ce0b
Merge branch 'master' into fire-refactor
johnb432 Jan 26, 2024
ccb09e6
Update fnc_burn.sqf
johnb432 Feb 3, 2024
41bd5bf
Fire deals more damage
johnb432 Feb 5, 2024
e2f94af
Merge branch 'master' into fire-refactor
johnb432 Feb 5, 2024
8f3a1e9
Update fnc_burnEffects.sqf
johnb432 Feb 5, 2024
7586048
Merged main
johnb432 Feb 6, 2024
a35864c
Minor tweaks
johnb432 Feb 6, 2024
b5dfe0a
Removed outdated comment
johnb432 Feb 12, 2024
70b21f6
Minor cleanup
johnb432 Feb 12, 2024
eb02fd7
Use eyePos for better position
johnb432 Feb 13, 2024
a9dde6d
Merge branch 'master' into fire-refactor
johnb432 Mar 24, 2024
1aaaa37
Update fnc_burnSimulation.sqf
johnb432 Mar 26, 2024
c0344ee
Merge branch 'master' into fire-refactor
johnb432 Apr 1, 2024
2af0da4
Fixed headers, made fire simulation local
johnb432 Apr 1, 2024
4f51eed
Merge branch 'master' into fire-refactor
johnb432 Apr 4, 2024
2bf85c0
Medical damage fix for dead units, cleanup
johnb432 Apr 10, 2024
02539ef
Merge branch 'master' into fire-refactor
johnb432 Apr 19, 2024
201366c
Merge branch 'master' into fire-refactor
johnb432 May 26, 2024
4b3d283
Update XEH_PREP.hpp
johnb432 May 26, 2024
9546ca2
Update fnc_cookOffEffect.sqf
johnb432 May 26, 2024
48f3d19
Update compats
johnb432 Jun 2, 2024
a93c0b4
Added TRACE macros
johnb432 Jun 2, 2024
0f24464
Minor tweaks
johnb432 Jun 2, 2024
acc9e09
Merge branch 'master' into fire-refactor
johnb432 Jun 2, 2024
94acbf2
Update initSettings.inc.sqf
johnb432 Jun 2, 2024
de652d5
Update comment to bring up to standard
johnb432 Jun 5, 2024
dcbefb2
Merge branch 'master' into fire-refactor
johnb432 Jun 5, 2024
8c3dacc
Update fnc_cookOffServer.sqf
johnb432 Jun 5, 2024
209d3ff
Update XEH_postInit.sqf
johnb432 Jun 6, 2024
a4968b5
Minor tweaks and cleanup
johnb432 Jun 6, 2024
303136a
More cleanup
johnb432 Jun 11, 2024
7b6ffe5
Merge branch 'master' into fire-refactor
johnb432 Jun 16, 2024
d17e003
Enforce code
johnb432 Jun 17, 2024
fb42389
comment grammar
LinkIsGrim Jun 20, 2024
4c50f53
Correct comment
johnb432 Jun 20, 2024
cb7ea45
Merge branch 'master' into fire-refactor
johnb432 Jun 20, 2024
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
8 changes: 2 additions & 6 deletions addons/compat_sog/functions/fnc_woundsHandlerIncendiary.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
* Public: No
*/

#define BURN_THRESHOLD 1

params ["_unit", "_damages"];
TRACE_2("woundsHandlerIncendiary",_unit,_damages);

Expand All @@ -32,9 +30,7 @@ private _fireDamage = 0;
private _intensity = linearConversion [0, 20, _fireDamage, 0, 10, true];
TRACE_2("",_intensity,_fireDamage);

if (_intensity > BURN_THRESHOLD) then {
TRACE_2("Setting unit ablaze",_intensity,BURN_THRESHOLD);
["ace_fire_burn", [_unit, _intensity]] call CBA_fnc_globalEvent;
};
// Let fire handle if unit is set ablaze or not
[QEGVAR(fire,burn), [_unit, _intensity]] call CBA_fnc_localEvent;

_this // return
8 changes: 2 additions & 6 deletions addons/compat_spe/functions/fnc_woundsHandlerIncendiary.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
* Public: No
*/

#define BURN_THRESHOLD 1

params ["_unit", "_damages"];
TRACE_2("woundsHandlerIncendiary",_unit,_damages);

Expand All @@ -32,9 +30,7 @@ private _fireDamage = 0;
private _intensity = linearConversion [0, 20, _fireDamage, 0, 10, true];
TRACE_2("",_intensity,_fireDamage);

if (_intensity > BURN_THRESHOLD) then {
TRACE_2("Setting unit ablaze",_intensity,BURN_THRESHOLD);
["ace_fire_burn", [_unit, _intensity]] call CBA_fnc_globalEvent;
};
// Let fire handle if unit is set ablaze or not
[QEGVAR(fire,burn), [_unit, _intensity]] call CBA_fnc_localEvent;

_this // return
2 changes: 1 addition & 1 deletion addons/cookoff/functions/fnc_cookOffServer.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ if (_delayBetweenSmokeAndFire) then {
if (["ace_fire"] call EFUNC(common,isModLoaded)) then {
// Use current intensity, in case GVAR(cookoffDuration) is very large and only 1 flameout stage happens
{
[QEGVAR(fire,burn), [_x, _intensity * 1.5, _instigator]] call CBA_fnc_globalEvent;
[QEGVAR(fire,burn), [_x, _intensity * 1.5, _instigator], _x] call CBA_fnc_targetEvent;
} forEach (crew _vehicle);
};

Expand Down
8 changes: 4 additions & 4 deletions addons/fire/CfgSounds.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// weird ass concatenation syntax. PBO Project complains otherwise...
#define CONCAT(a,b) a####b
#define CREATE_SCREAM(no)\
class GVAR(DOUBLES(scream,no)) { \
name = QUOTE(GVAR(CONCAT(scream,no)));\
sound[] = {QUOTE(PATHTOF(CONCAT(sounds\scream,no).ogg)), QUOTE(db+8), 1};\
titles[] = {}; \
class GVAR(DOUBLES(scream,no)) {\
name = QGVAR(CONCAT(scream,no));\
sound[] = {QPATHTOF(CONCAT(sounds\scream,no).ogg), QUOTE(db+8), 1};\
titles[] = {};\
}

class CfgSounds {
Expand Down
7 changes: 7 additions & 0 deletions addons/fire/CfgVehicles.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class CfgVehicles {
class Static;
class GVAR(logic): Static {
scope = 1;
displayName = "";
};
};
7 changes: 4 additions & 3 deletions addons/fire/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
PREP(burn);
PREP(isBurning);
PREP(burnEffects);
PREP(burnIndicator);
PREP(burnReaction);
PREP(burnSimulation);
PREP(fireManagerPFH);

PREP(isBurning);
PREP(medical_canPatDown);
PREP(medical_progress);
PREP(medical_success);
PREP(medical_canPatDown);
98 changes: 75 additions & 23 deletions addons/fire/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -1,37 +1,89 @@
#include "script_component.hpp"

[QGVAR(burn), LINKFUNC(burn)] call CBA_fnc_addEventHandler;
[QGVAR(burnEffects), LINKFUNC(burnEffects)] call CBA_fnc_addEventHandler;
[QGVAR(burnSimulation), LINKFUNC(burnSimulation)] call CBA_fnc_addEventHandler;

[QGVAR(playScream), {
params ["_scream", "_source"];
// only play sound if enabled in settings and enabled for the unit

// Only play sound if enabled in settings and enabled for the unit
if (GVAR(enableScreams) && {_source getVariable [QGVAR(enableScreams), true]}) then {
_source say3D _scream;
};
}] call CBA_fnc_addEventHandler;

["ace_settingsInitialized", {
if (!isServer) exitWith {};

["CBA_settingsInitialized", {
TRACE_1("settingsInit",GVAR(enabled));

if (!GVAR(enabled)) exitWith {};

if (isServer) then {
[QGVAR(addFireSource), {
params ["_source", "_radius", "_intensity", "_key", ["_condition", { true }], ["_conditionArgs", []]];
private _fireLogic = createVehicle ["ACE_LogicDummy", [0, 0, 0], [], 0, "NONE"];
if (_source isEqualType objNull) then {
_fireLogic attachTo [_source];
} else {
_fireLogic setPosASL _source;
};

[GVAR(fireSources), _key, [_fireLogic, _radius, _intensity, _condition, _conditionArgs]] call CBA_fnc_hashSet;
}] call CBA_fnc_addEventHandler;

[QGVAR(removeFireSource), {
params ["_key"];
[GVAR(fireSources), _key] call CBA_fnc_hashRem;
}] call CBA_fnc_addEventHandler;

[LINKFUNC(fireManagerPFH), FIRE_MANAGER_PFH_DELAY, []] call CBA_fnc_addPerFrameHandler;
GVAR(fireSources) = [[], nil] call CBA_fnc_hashCreate;
};
GVAR(fireSources) = createHashMap;

[QGVAR(addFireSource), {
params [
["_source", objNull, [objNull, []]],
["_radius", 0, [0]],
["_intensity", 0, [0]],
["_key", ""],
["_condition", {true}, [{}]],
["_conditionArgs", []]
];

private _isObject = _source isEqualType objNull;

// Check if the source is valid
if !(_isObject || {_source isEqualTypeParams [0, 0, 0]}) exitWith {};

if (_isObject && {isNull _source}) exitWith {};
if (_radius == 0 || _intensity == 0) exitWith {};
if (_key isEqualTo "") exitWith {}; // key can be many types

// hashValue supports more types than hashmaps do by default, but not all (e.g. locations)
private _hashedKey = hashValue _key;

if (isNil "_hashedKey") exitWith {
ERROR_2("Unsupported key type used: %1 - %2",_key,typeName _key);
};

// If a position is passed, create a static object at said position
private _sourcePos = if (_isObject) then {
getPosATL _source
} else {
ASLToATL _source
};

private _fireLogic = createVehicle [QGVAR(logic), _sourcePos, [], 0, "CAN_COLLIDE"];

// If an object was passed, attach logic to the object
if (_isObject) then {
_fireLogic attachTo [_source];
};

// To avoid issues, remove existing entries first before overwriting
if (_hashedKey in GVAR(fireSources)) then {
[QGVAR(removeFireSource), _key] call CBA_fnc_localEvent;
};

GVAR(fireSources) set [_hashedKey, [_fireLogic, _radius, _intensity, _condition, _conditionArgs]];
}] call CBA_fnc_addEventHandler;

[QGVAR(removeFireSource), {
params ["_key"];

private _hashedKey = hashValue _key;

if (isNil "_hashedKey") exitWith {
ERROR_2("Unsupported key type used: %1 - %2",_key,typeName _key);
};

(GVAR(fireSources) deleteAt _hashedKey) params [["_fireLogic", objNull]];

detach _fireLogic;
deleteVehicle _fireLogic;
}] call CBA_fnc_addEventHandler;

[LINKFUNC(fireManagerPFH), FIRE_MANAGER_PFH_DELAY, []] call CBA_fnc_addPerFrameHandler;
}] call CBA_fnc_addEventHandler;
1 change: 1 addition & 0 deletions addons/fire/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class CfgPatches {

#include "CfgEventHandlers.hpp"
#include "CfgSounds.hpp"
#include "CfgVehicles.hpp"
#include "ACE_Medical_Treatment_Actions.hpp"
#include "RscTitles.hpp"

Expand Down
Loading