Skip to content

Commit

Permalink
Fire - Reset intensity on unit respawn (#10712)
Browse files Browse the repository at this point in the history
Co-authored-by: johnb432 <[email protected]>
  • Loading branch information
LinkIsGrim and johnb432 authored Feb 3, 2025
1 parent 9d70617 commit eb95025
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
9 changes: 9 additions & 0 deletions addons/fire/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,12 @@ class Extended_PostInit_EventHandlers {
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit));
};
};

class Extended_Init_EventHandlers {
class CAManBase {
class ADDON {
init = QUOTE([ARR_2((_this select 0),false)] call FUNC(initUnit));
exclude[] = {IGNORE_BASE_UAVPILOTS};
};
};
};
1 change: 1 addition & 0 deletions addons/fire/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PREP(burnIndicator);
PREP(burnReaction);
PREP(burnSimulation);
PREP(fireManagerPFH);
PREP(initUnit);
PREP(isBurning);
PREP(medical_canPatDown);
PREP(medical_progress);
Expand Down
33 changes: 33 additions & 0 deletions addons/fire/functions/fnc_initUnit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include "..\script_component.hpp"
/*
* Author: LinkIsGrim
* Initializes unit variables.
*
* Arguments:
* 0: The Unit <OBJECT>
* 1: Is Respawned <BOOL>
*
* Return Value:
* None
*
* Example:
* [bob, false] call ace_fire_fnc_initUnit
*
* Public: No
*/

params ["_unit", ["_isRespawn", true]];
TRACE_2("initUnit",_unit,_isRespawn);

if (!_isRespawn) then { // Always add respawn EH (same as CBA's onRespawn=1)
_unit addEventHandler ["Respawn", {[(_this select 0), true] call FUNC(initUnit)}];
};

if (!local _unit) exitWith {};

if (_isRespawn) then {
TRACE_1("resetting all vars on respawn",_isRespawn);

_unit setVariable [QGVAR(intensity), nil, true];
_unit setVariable [QGVAR(stopDropRoll), nil, true];
};
3 changes: 3 additions & 0 deletions addons/fire/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@
#define BURN_PROPAGATE_UPDATE 1
#define BURN_PROPAGATE_DISTANCE 2
#define BURN_THRESHOLD_INTENSE 3

// Ignore UAV/Drone AI Base Classes
#define IGNORE_BASE_UAVPILOTS "B_UAV_AI", "O_UAV_AI", "UAV_AI_base_F"

0 comments on commit eb95025

Please sign in to comment.