Fire - Remove medical_engine dependency (#10122)

* Remove medical dependency from fire

* Update initSettings.inc.sqf
This commit is contained in:
johnb432 2024-07-20 08:37:04 +02:00 committed by GitHub
parent 5d133bd793
commit a7ce63a536
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 67 additions and 40 deletions

View File

@ -1,5 +1,10 @@
#include "script_component.hpp"
["CBA_settingsInitialized", {
TRACE_1("settingsInitialized",GVAR(enabled));
if (!GVAR(enabled)) exitWith {};
[QGVAR(burn), LINKFUNC(burn)] call CBA_fnc_addEventHandler;
[QGVAR(burnEffects), LINKFUNC(burnEffects)] call CBA_fnc_addEventHandler;
[QGVAR(burnSimulation), LINKFUNC(burnSimulation)] call CBA_fnc_addEventHandler;
@ -15,11 +20,6 @@
if (!isServer) exitWith {};
["CBA_settingsInitialized", {
TRACE_1("settingsInit",GVAR(enabled));
if (!GVAR(enabled)) exitWith {};
GVAR(fireSources) = createHashMap;
[QGVAR(addFireSource), {

View File

@ -0,0 +1,20 @@
#include "script_component.hpp"
class CfgPatches {
class SUBADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_medical_engine"};
skipWhenMissingDependencies = 1;
author = ECSTRING(common,ACETeam);
authors[] = {};
url = ECSTRING(main,URL);
VERSION_CONFIG;
addonRootClass = QUOTE(ADDON);
};
};
#include "ACE_Medical_Treatment_Actions.hpp"

View File

@ -0,0 +1,3 @@
#define SUBCOMPONENT medical_engine
#define SUBCOMPONENT_BEAUTIFIED Medical Engine
#include "..\script_component.hpp"

View File

@ -1,20 +1,12 @@
#include "script_component.hpp"
#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common", "ace_medical_engine"};
requiredAddons[] = {"ace_common"};
author = ECSTRING(common,ACETeam);
authors[] = {"commy2", "tcvm"};
url = ECSTRING(main,URL);
@ -25,7 +17,4 @@ class CfgPatches {
#include "CfgEventHandlers.hpp"
#include "CfgSounds.hpp"
#include "CfgVehicles.hpp"
#include "ACE_Medical_Treatment_Actions.hpp"
#include "RscTitles.hpp"
#endif

View File

@ -148,6 +148,10 @@ params ["_unit", "_instigator"];
_unit call FUNC(burnReaction);
};
// Keep pain around unconsciousness limit to allow for more fun interactions
private _damageToAdd = [0.15, _intensity / BURN_MAX_INTENSITY] select (!alive _unit || {GET_PAIN_PERCEIVED(_unit) < (PAIN_UNCONSCIOUS + random 0.2)});
if (GETEGVAR(medical,enabled,false)) then {
if (!isNull _instigator) then {
_unit setVariable [QEGVAR(medical,lastDamageSource), _instigator];
_unit setVariable [QEGVAR(medical,lastInstigator), _instigator];
@ -156,11 +160,15 @@ params ["_unit", "_instigator"];
// Common burn areas are the hands and face https://www.ncbi.nlm.nih.gov/pubmed/16899341/
private _bodyPart = ["Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"] selectRandomWeighted [0.77, 0.5, 0.8, 0.8, 0.3, 0.3];
// Keep pain around unconciousness limit to allow for more fun interactions
private _damageToAdd = [0.15, _intensity / BURN_MAX_INTENSITY] select (!alive _unit || {GET_PAIN_PERCEIVED(_unit) < (PAIN_UNCONSCIOUS + random 0.2)});
// Use event directly, as ace_medical_fnc_addDamageToUnit requires unit to be alive
[QEGVAR(medical,woundReceived), [_unit, [[_damageToAdd, _bodyPart, _damageToAdd]], _instigator, "burn"]] call CBA_fnc_localEvent;
} else {
private _bodyParts = [["HitFace", "HitNeck", "HitHead"], ["HitPelvis", "HitAbdomen", "HitDiaphragm", "HitChest", "HitBody"], ["HitArms", "HitHands"], ["HitLegs"]] selectRandomWeighted [0.77, 0.5, 0.8, 0.3];
{
_unit setHitPointDamage [_x, (_unit getHitPointDamage _x) + _damageToAdd, true, _instigator, _instigator];
} forEach _bodyParts;
};
_unit setVariable [QGVAR(intensity), _intensity, true]; // Globally sync intensity across all clients to make sure simulation is deterministic
};

View File

@ -5,7 +5,7 @@
LSTRING(Category_DisplayName),
true,
1,
{[QGVAR(fireEnabled), _this] call EFUNC(common,cbaSettings_settingChanged)},
{[QGVAR(enabled), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;

View File

@ -16,7 +16,14 @@
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\medical_engine\script_macros_medical.hpp")
#include "\z\ace\addons\medical_engine\script_macros_medical.hpp"
#else
#define GET_PAIN_PERCEIVED(var) 0
#define PAIN_UNCONSCIOUS 1
#endif
#define FIRE_MANAGER_PFH_DELAY 0.25
#define FLARE_SIZE_MODIFIER 5