mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fixed headers, made fire simulation local
This commit is contained in:
parent
c0344ee9c0
commit
2af0da4853
@ -60,7 +60,7 @@ if (!isServer) exitWith {};
|
||||
private _hashedKey = hashValue _key;
|
||||
|
||||
if (isNil "_hashedKey") exitWith {
|
||||
ERROR_3("Unsupported key type used: %1 - %2 - %3",_key,typeName _key,typeOf _key);
|
||||
ERROR_2("Unsupported key type used: %1 - %2 - %3",_key,typeName _key);
|
||||
};
|
||||
|
||||
// To avoid issues, remove existing entries first before overwriting
|
||||
@ -77,7 +77,7 @@ if (!isServer) exitWith {};
|
||||
private _hashedKey = hashValue _key;
|
||||
|
||||
if (isNil "_hashedKey") exitWith {
|
||||
ERROR_3("Unsupported key type used: %1 - %2 - %3",_key,typeName _key,typeOf _key);
|
||||
ERROR_2("Unsupported key type used: %1 - %2 - %3",_key,typeName _key);
|
||||
};
|
||||
|
||||
(GVAR(fireSources) deleteAt _hashedKey) params [["_fireLogic", objNull]];
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
if (!EGVAR(common,settingsInitFinished)) exitWith {
|
||||
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(burn), _this];
|
||||
EGVAR(common,runAtSettingsInitialized) pushBack [LINKFUNC(burn), _this];
|
||||
};
|
||||
|
||||
if (!GVAR(enabled)) exitWith {};
|
||||
@ -49,11 +49,10 @@ if (_unit call FUNC(isBurning)) exitWith {
|
||||
_unit setVariable [QGVAR(intensity), _intensity, true];
|
||||
|
||||
// Fire simulation (objects are handled differently)
|
||||
private _burnSimulationJipID = [QGVAR(burnSimulation), [_unit, _instigator]] call CBA_fnc_globalEventJIP;
|
||||
[_burnSimulationJipID, _unit] call CBA_fnc_removeGlobalEventJIP;
|
||||
[QGVAR(burnSimulation), [_unit, _instigator], _unit] call CBA_fnc_targetEvent;
|
||||
|
||||
// Spawn effects for unit
|
||||
private _burnEffectsJipID = [QGVAR(burnEffects), _unit] call CBA_fnc_globalEventJIP;
|
||||
[_burnEffectsJipID, _unit] call CBA_fnc_removeGlobalEventJIP;
|
||||
|
||||
_unit setVariable [QGVAR(jipIDs), [_burnSimulationJipID, _burnEffectsJipID], true];
|
||||
_unit setVariable [QGVAR(jipID), _burnEffectsJipID, true];
|
||||
|
@ -16,14 +16,15 @@
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_unit", "_pfhHandle"];
|
||||
params ["_unit", "_pfhID"];
|
||||
|
||||
if (!alive _unit || {!(_unit call FUNC(isBurning))}) exitWith {
|
||||
_pfhHandle call CBA_fnc_removePerFrameHandler;
|
||||
_pfhID call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
_unit setVariable [QGVAR(burnUIPFH), nil];
|
||||
};
|
||||
|
||||
// Don't show burn overlay if unconscious or dead
|
||||
if !(_unit call EFUNC(common,isAwake)) exitWith {};
|
||||
|
||||
private _iteration = _unit getVariable [QGVAR(indicatorIteration), 0];
|
||||
|
@ -12,29 +12,27 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* player call ace_fire_fnc_burnSimulation
|
||||
* [player, player] call ace_fire_fnc_burnSimulation
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_unit", "_instigator"];
|
||||
|
||||
// Reset variables
|
||||
_unit setVariable [QGVAR(stopDropRoll), nil];
|
||||
_unit setVariable [QGVAR(burnCounter), nil];
|
||||
|
||||
[{
|
||||
params ["_args", "_pfhID"];
|
||||
_args params ["_unit", "_instigator"];
|
||||
|
||||
private _remote = !local _unit;
|
||||
|
||||
// If unit is local and the fire has died out, the effects need to be cleaned up -> do not stop PFH here
|
||||
if (isNull _unit || {_remote && {!(_unit call FUNC(isBurning))}}) exitWith {
|
||||
if (isNull _unit) exitWith {
|
||||
_pfhID call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
if (_remote) exitWith {};
|
||||
// Locality has changed
|
||||
if (!local _unit) exitWith {
|
||||
_pfhID call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
[QGVAR(burnSimulation), [_unit, _instigator], _unit] call CBA_fnc_targetEvent;
|
||||
};
|
||||
|
||||
// If unit is invulnerable or in water or if the fire has died out, stop burning unit
|
||||
if (
|
||||
@ -42,21 +40,18 @@ _unit setVariable [QGVAR(burnCounter), nil];
|
||||
{!(isDamageAllowed _unit && {_unit getVariable [QEGVAR(medical,allowDamage), true]})} ||
|
||||
{private _eyePos = eyePos _unit; surfaceIsWater _eyePos && {(_eyePos select 2) < 0.1}}
|
||||
) exitWith {
|
||||
// Remove global effects and simulation
|
||||
{
|
||||
_x call CBA_fnc_removeGlobalEventJIP;
|
||||
} forEach (_unit getVariable [QGVAR(jipIDs), []]);
|
||||
// Remove global effects
|
||||
(_unit getVariable [QGVAR(jipID), ""]) call CBA_fnc_removeGlobalEventJIP;
|
||||
|
||||
// Update globally that the unit isn't burning anymore
|
||||
_unit setVariable [QGVAR(intensity), nil, true];
|
||||
|
||||
_pfhID call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
_unit setVariable [QGVAR(stopDropRoll), nil];
|
||||
_unit setVariable [QGVAR(burnCounter), nil];
|
||||
|
||||
if (!isPlayer _unit) then {
|
||||
if (!isNil {_unit getVariable QGVAR(stopDropRoll)} && {!isPlayer _unit}) then {
|
||||
_unit setUnitPos "AUTO";
|
||||
|
||||
_unit setVariable [QGVAR(stopDropRoll), nil, true];
|
||||
};
|
||||
};
|
||||
|
||||
@ -94,7 +89,7 @@ _unit setVariable [QGVAR(burnCounter), nil];
|
||||
private _vehicle = objectParent _unit;
|
||||
|
||||
if (isNull _vehicle && {_sdr || {0.05 > random 1}}) then {
|
||||
_unit setVariable [QGVAR(stopDropRoll), true];
|
||||
_unit setVariable [QGVAR(stopDropRoll), true, true];
|
||||
|
||||
if (!_sdr) then {
|
||||
TRACE_1("stop, drop, roll!",_unit);
|
||||
|
@ -4,14 +4,13 @@
|
||||
* Handles various objects on fire and determines if units close to objects deserve to get burned.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Args (not used) <ARRAY>
|
||||
* 1: PFH Handle (not used) <NUMBER>
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [[], -1] call CBA_fnc_addPerFrameHandler
|
||||
* ace_fire_fnc_fireManagerPFH call CBA_fnc_addPerFrameHandler
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -37,8 +36,8 @@ private _adjustedIntensity = 0;
|
||||
_distancePercent = 1 - ((_fireLogic distance _x) / _radius);
|
||||
_adjustedIntensity = _intensity * _distancePercent;
|
||||
|
||||
// Don't burn if intensity is too low
|
||||
if (BURN_MIN_INTENSITY > _adjustedIntensity) then {
|
||||
// Don't burn if intensity is too low or already burning with higher intensity
|
||||
if (BURN_MIN_INTENSITY > _adjustedIntensity || {(_x getVariable [QGVAR(intensity), 0]) > _adjustedIntensity}) then {
|
||||
continue;
|
||||
};
|
||||
|
||||
|
@ -17,21 +17,18 @@
|
||||
|
||||
params ["_logic"];
|
||||
|
||||
if !(local _logic) exitWith {};
|
||||
if (!local _logic) exitWith {};
|
||||
|
||||
private _unit = attachedTo _logic;
|
||||
deleteVehicle _logic;
|
||||
|
||||
switch (false) do {
|
||||
case !(isNull _unit): {
|
||||
case (!isNull _unit): {
|
||||
[LSTRING(NothingSelected)] call FUNC(showMessage);
|
||||
};
|
||||
case (_unit isKindOf "CAManBase"): {
|
||||
case (_unit isKindOf "CAManBase" && {getNumber (configOf _unit >> "isPlayableLogic") == 0}): {
|
||||
[LSTRING(OnlyInfantry)] call FUNC(showMessage);
|
||||
};
|
||||
case (alive _unit): {
|
||||
[LSTRING(OnlyAlive)] call FUNC(showMessage);
|
||||
};
|
||||
case (["ace_fire"] call EFUNC(common,isModLoaded)): {
|
||||
[LSTRING(RequiresAddon)] call FUNC(showMessage);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user