From 11d86248a760f938d56b8d164c3d2f128a7ae106 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sat, 25 Apr 2015 22:20:28 +0200 Subject: [PATCH 01/18] Reorganised module and settings #809 --- addons/medical/ACE_Settings.hpp | 4 + addons/medical/CfgVehicles.hpp | 155 +++++++++--------- addons/medical/XEH_preInit.sqf | 3 +- addons/medical/functions/fnc_handleDamage.sqf | 2 +- ... => fnc_moduleAdvancedMedicalSettings.sqf} | 11 +- .../functions/fnc_moduleMedicalSettings.sqf | 8 +- .../functions/fnc_moduleReviveSettings.sqf | 27 +++ addons/medical/functions/fnc_setDead.sqf | 2 +- 8 files changed, 123 insertions(+), 89 deletions(-) rename addons/medical/functions/{fnc_moduleTreatmentConfiguration.sqf => fnc_moduleAdvancedMedicalSettings.sqf} (64%) create mode 100644 addons/medical/functions/fnc_moduleReviveSettings.sqf diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index e7f60a14e8..26fa87e706 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -59,6 +59,10 @@ class ACE_Settings { typeName = "BOOL"; value = 0; }; + class GVAR(enableRevive) { + typeName = "BOOL"; + value = 0; + }; class GVAR(maxReviveTime) { typeName = "SCALAR"; value = 120; diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index 2b1f7c9468..2de90e77d0 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -37,47 +37,38 @@ class CfgVehicles { }; }; }; - class enableFor { - displayName = "Enabled for"; - description = "Select what units the medical system will be enabled for (Adv only)"; + class medicSetting { + displayName = "Medics setting"; + description = "What is the level of detail prefered for medics?"; typeName = "NUMBER"; class values { - class playableUnits { - name = "Players only."; + class disable { + name = "Disable medics"; value = 0; + }; + class normal { + name = "Normal"; + value = 1; default = 1; }; - class playableUnitsAndAI { - name = "Players and AI"; - value = 1; + class full { + name = "Advanced"; + value = 2; }; }; }; - // TODO Disabled until the features are implemented - /*class enableAirway { - displayName = "Enable Airway"; - description = "Enable Advanced medical Airway (Adv only)"; - typeName = "BOOL"; - defaultValue = 0; - }; - class enableFractures { - displayName = "Enable Fractures"; - description = "Enable Advanced medical Fractures (Adv only)"; - typeName = "BOOL"; - defaultValue = 0; - };*/ - class enableAdvancedWounds { - displayName = "Enable Advanced wounds"; - description = "Allow reopening of bandaged wounds? (Adv only)"; - typeName = "BOOL"; - defaultValue = 0; - }; - class enableVehicleCrashes { - displayName = "Vehicle Crashes"; - description = "Do units take damage from a vehicle crash?"; + class allowLitterCreation { + displayName = "Enable Litter"; + description = "Enable litter being created upon treatment"; typeName = "BOOL"; defaultValue = 1; }; + class litterCleanUpDelay { + displayName = "Life time of litter objects"; + description = "How long should litter objects stay? In seconds. -1 is forever."; + typeName = "NUMBER"; + defaultValue = 1800; + }; class enableScreams { displayName = "Enable Screams"; description = "Enable screaming by injuried units"; @@ -141,80 +132,58 @@ class CfgVehicles { }; }; - class ACE_moduleTreatmentSettings: ACE_Module { + class ACE_moduleAdvancedMedicalSettings: ACE_Module { scope = 2; - displayName = "Treatment Settings [ACE]"; + displayName = "Advanced Medical Settings [ACE]"; icon = QUOTE(PATHTOF(UI\Icon_Module_Medical_ca.paa)); category = "ACE_medical"; - function = QUOTE(FUNC(moduleTreatmentConfiguration)); + function = QUOTE(FUNC(moduleAdvancedMedicalSettings)); functionPriority = 10; isGlobal = 2; isTriggerActivated = 0; isDisposable = 0; author = "$STR_ACE_Common_ACETeam"; class Arguments { - class medicSetting { - displayName = "Medics setting"; - description = "What is the level of detail prefered for medics?"; + class enableFor { + displayName = "Enabled for"; + description = "Select what units the advanced medical system will be enabled for"; typeName = "NUMBER"; class values { - class disable { - name = "Disable medics"; + class playableUnits { + name = "Players only."; value = 0; - }; - class normal { - name = "Normal"; - value = 1; default = 1; }; - class full { - name = "Advanced"; - value = 2; + class playableUnitsAndAI { + name = "Players and AI"; + value = 1; }; }; }; - class maxReviveTime { - displayName = "Max Revive time"; - description = "Max amount of seconds a unit can spend in revive state"; - typeName = "NUMBER"; - defaultValue = 120; + class enableAdvancedWounds { + displayName = "Enable Advanced wounds"; + description = "Allow reopening of bandaged wounds?"; + typeName = "BOOL"; + defaultValue = 0; }; - class amountOfReviveLives { - displayName = "Max Revive lives"; - description = "Max amount of lives a unit. 0 or -1 is disabled."; - typeName = "NUMBER"; - defaultValue = -1; - }; - class enableOverdosing { - displayName = "Enable Overdosing"; - description = "Enable overdosing of medications"; + class enableVehicleCrashes { + displayName = "Vehicle Crashes"; + description = "Do units take damage from a vehicle crash?"; typeName = "BOOL"; defaultValue = 1; }; - class allowLitterCreation { - displayName = "Enable Litter"; - description = "Enable litter being created upon treatment"; - typeName = "BOOL"; - defaultValue = 1; - }; - class litterCleanUpDelay { - displayName = "Life time of litter objects"; - description = "How long should litter objects stay? In seconds. -1 is forever."; - typeName = "NUMBER"; - defaultValue = 1800; - }; class medicSetting_PAK { - displayName = "Allow PAK (Adv)"; + displayName = "Allow PAK"; description = "Who can use the PAK for full heal?"; typeName = "NUMBER"; class values { class anyone { name = "Anyone"; value = 0; }; class Medic { name = "Medics only"; value = 1; default = 1; }; - class Special { name = "Doctors only (Adv)"; value = 2; }; + class Special { name = "Doctors only"; value = 2; }; }; }; class consumeItem_PAK { - displayName = "Remove PAK on use (Adv)"; + displayName = "Remove PAK on use"; description = "Should PAK be removed on usage?"; typeName = "NUMBER"; class values { @@ -223,7 +192,7 @@ class CfgVehicles { }; }; class useLocation_PAK { - displayName = "Locations PAK (Adv)"; + displayName = "Locations PAK"; description = "Where can the personal aid kit be used?"; typeName = "NUMBER"; class values { @@ -254,6 +223,42 @@ class CfgVehicles { }; }; + + class ACE_moduleReviveSettings: ACE_Module { + scope = 2; + displayName = "Revive Settings [ACE]"; + icon = QUOTE(PATHTOF(UI\Icon_Module_Medical_ca.paa)); + category = "ACE_medical"; + function = QUOTE(DFUNC(moduleReviveSettings)); + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + author = "$STR_ACE_Common_ACETeam"; + class Arguments { + class enableRevive { + displayName = "Enable Revive"; + description = "Enable a basic revive system"; + typeName = "BOOL"; + defaultValue = 0; + }; + class maxReviveTime { + displayName = "Max Revive time"; + description = "Max amount of seconds a unit can spend in revive state"; + typeName = "NUMBER"; + defaultValue = 120; + }; + class amountOfReviveLives { + displayName = "Max Revive lives"; + description = "Max amount of lives a unit. 0 or -1 is disabled."; + typeName = "NUMBER"; + defaultValue = -1; + }; + }; + class ModuleDescription { + description = "Provides a medical system for both players and AI."; + sync[] = {}; + }; + }; class ACE_moduleAssignMedicRoles: Module_F { scope = 2; displayName = "Set Medic Class [ACE]"; diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index b6deca4033..051f7da266 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -92,10 +92,11 @@ PREP(displayPatientInformation); PREP(displayTriageCard); PREP(dropDownTriageCard); PREP(moduleMedicalSettings); +PREP(moduleAdvancedMedicalSettings); +PREP(moduleReviveSettings); PREP(moduleAssignMedicRoles); PREP(moduleAssignMedicalVehicle); PREP(moduleAssignMedicalFacility); -PREP(moduleTreatmentConfiguration); PREP(copyDeadBody); PREP(requestWoundSync); PREP(unconsciousPFH); diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index c13818bbcd..956b4f95aa 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -76,7 +76,7 @@ if (GVAR(level) >= 2) then { }; [_unit] call FUNC(addToInjuredCollection); -if ((_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)]) && {_damageReturn >= 0.9} && {_selection in ["", "head", "body"]}) exitWith { +if (((_unit getVariable [QGVAR(enableRevive), GVAR(enableRevive)])) && {_damageReturn >= 0.9} && {_selection in ["", "head", "body"]}) exitWith { if (vehicle _unit != _unit and {damage _vehicle >= 1}) then { // @todo // [_unit] call FUNC(unload); diff --git a/addons/medical/functions/fnc_moduleTreatmentConfiguration.sqf b/addons/medical/functions/fnc_moduleAdvancedMedicalSettings.sqf similarity index 64% rename from addons/medical/functions/fnc_moduleTreatmentConfiguration.sqf rename to addons/medical/functions/fnc_moduleAdvancedMedicalSettings.sqf index 5d88fa0f0a..cf884e0ab0 100644 --- a/addons/medical/functions/fnc_moduleTreatmentConfiguration.sqf +++ b/addons/medical/functions/fnc_moduleAdvancedMedicalSettings.sqf @@ -22,12 +22,11 @@ _activated = _this select 2; if !(_activated) exitWith {}; -[_logic, QGVAR(medicSetting), "medicSetting"] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(maxReviveTime), "maxReviveTime"] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(amountOfReviveLives), "amountOfReviveLives"] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(enableOverdosing), "enableOverdosing"] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(allowLitterCreation), "allowLitterCreation"] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(litterCleanUpDelay), "litterCleanUpDelay"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(enableFor), "enableFor"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(enableAdvancedWounds), "enableAdvancedWounds"] call EFUNC(common,readSettingFromModule); +// TODO disabled until implemented +// [_logic, QGVAR(enableAirway), "enableAirway"] call EFUNC(common,readSettingFromModule); +// [_logic, QGVAR(enableFractures), "enableFractures"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(medicSetting_PAK), "medicSetting_PAK"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(medicSetting_SurgicalKit), "medicSetting_SurgicalKit"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(consumeItem_PAK), "consumeItem_PAK"] call EFUNC(common,readSettingFromModule); diff --git a/addons/medical/functions/fnc_moduleMedicalSettings.sqf b/addons/medical/functions/fnc_moduleMedicalSettings.sqf index 34dd063a4d..0d514aee27 100644 --- a/addons/medical/functions/fnc_moduleMedicalSettings.sqf +++ b/addons/medical/functions/fnc_moduleMedicalSettings.sqf @@ -23,11 +23,9 @@ _activated = _this select 2; if !(_activated) exitWith {}; [_logic, QGVAR(level), "level"] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(enableFor), "enableFor"] call EFUNC(common,readSettingFromModule); -// TODO disabled until implemented -// [_logic, QGVAR(enableAirway), "enableAirway"] call EFUNC(common,readSettingFromModule); -// [_logic, QGVAR(enableFractures), "enableFractures"] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(enableAdvancedWounds), "enableAdvancedWounds"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(medicSetting), "medicSetting"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(allowLitterCreation), "allowLitterCreation"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(litterCleanUpDelay), "litterCleanUpDelay"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(enableScreams), "enableScreams"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(playerDamageThreshold), "playerDamageThreshold"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(AIDamageThreshold), "AIDamageThreshold"] call EFUNC(common,readSettingFromModule); diff --git a/addons/medical/functions/fnc_moduleReviveSettings.sqf b/addons/medical/functions/fnc_moduleReviveSettings.sqf new file mode 100644 index 0000000000..c96b1eb67c --- /dev/null +++ b/addons/medical/functions/fnc_moduleReviveSettings.sqf @@ -0,0 +1,27 @@ +/* + * Author: Glowbal + * Module for adjusting the medical revive settings + * + * Arguments: + * 0: The module logic + * 1: units + * 2: activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_logic", "_units", "_activated"]; +_logic = _this select 0; +_units = _this select 1; +_activated = _this select 2; + +if !(_activated) exitWith {}; + +[_logic, QGVAR(maxReviveTime), "maxReviveTime"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(amountOfReviveLives), "amountOfReviveLives"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(enableRevive), "enableRevive"] call EFUNC(common,readSettingFromModule); diff --git a/addons/medical/functions/fnc_setDead.sqf b/addons/medical/functions/fnc_setDead.sqf index 334a2d8b97..428d6674ab 100644 --- a/addons/medical/functions/fnc_setDead.sqf +++ b/addons/medical/functions/fnc_setDead.sqf @@ -26,7 +26,7 @@ if (!local _unit) exitwith { false; }; -if ((_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)]) && !_force) exitwith { +if ((_unit getVariable [QGVAR(enableRevive), GVAR(enableRevive)]) && !_force) exitwith { if (_unit getvariable [QGVAR(inReviveState), false]) exitwith { if (GVAR(amountOfReviveLives) > 0) then { _lifesLeft = _unit getvariable[QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives)]; From fc08ebb0a5ac482fe684b8e634d8e1d5015d6bf3 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 26 Apr 2015 11:19:25 +0200 Subject: [PATCH 02/18] added "isNotInside" exception to unload --- addons/medical/CfgVehicles.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index 2de90e77d0..339abe5a42 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -467,7 +467,7 @@ class CfgVehicles { showDisabled = 0; priority = 2; icon = PATHTOF(UI\icons\medical_cross.paa); - exceptions[] = {"isNotDragging", "isNotCarrying"}; + exceptions[] = {"isNotDragging", "isNotCarrying", "isNotInside"}; }; }; }; From e4db44d73c46a15cfb8e882d593035c0094349d8 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Mon, 27 Apr 2015 16:36:00 +0200 Subject: [PATCH 03/18] adjusted damage parsing --- addons/medical/functions/fnc_handleDamage.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index 956b4f95aa..70b219a8a4 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -63,14 +63,14 @@ if (GVAR(level) >= 2) then { }; }; - if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)} && {_selection in ["", "head", "body"]}) then { + if ([_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)) then { if ([_unit] call FUNC(setDead)) then { _damageReturn = 1; } else { - _damageReturn = 0.89; + _damageReturn = _damageReturn min 0.89; }; } else { - _damageReturn = 0.89; + _damageReturn = _damageReturn min 0.89; }; }; }; From 450e324f7b27adbe8475fc882dd6c5b32f93c164 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Mon, 27 Apr 2015 16:42:12 +0200 Subject: [PATCH 04/18] adjusted damage handling (adv medical) --- addons/medical/functions/fnc_handleDamage.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index 70b219a8a4..a8dddcadc8 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -47,7 +47,7 @@ if (GVAR(level) >= 2) then { }; _newDamage = _this call FUNC(handleDamage_caching); - if (_damageReturn > 0.9) then { + //if (_damageReturn > 0.9) then { _typeOfDamage = [_projectile] call FUNC(getTypeOfDamage); @@ -63,7 +63,7 @@ if (GVAR(level) >= 2) then { }; }; - if ([_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)) then { + if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)}) then { if ([_unit] call FUNC(setDead)) then { _damageReturn = 1; } else { @@ -72,7 +72,7 @@ if (GVAR(level) >= 2) then { } else { _damageReturn = _damageReturn min 0.89; }; - }; + //}; }; [_unit] call FUNC(addToInjuredCollection); From c38fe384e3c53094b98bdf53a51655279a203b9c Mon Sep 17 00:00:00 2001 From: Glowbal Date: Tue, 28 Apr 2015 19:30:35 +0200 Subject: [PATCH 05/18] added default values for getvar's --- addons/medical/functions/fnc_handleUnitVitals.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index 411f64b49e..b806d1358f 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -66,13 +66,13 @@ if (_painStatus > 0) then { if (GVAR(level) == 1) then { // reduce pain - if (_unit getVariable [QGVAR(pain), 0] > 0) then { - _unit setVariable [QGVAR(pain), ((_unit getVariable QGVAR(pain)) - 0.001 * _interval) max 0, _syncValues]; + if (_painStatus > 0) then { + _unit setVariable [QGVAR(pain), (_painStatus - 0.001 * _interval) max 0, _syncValues]; }; // reduce painkillers if (_unit getVariable [QGVAR(morphine), 0] > 0) then { - _unit setVariable [QGVAR(morphine), ((_unit getVariable QGVAR(morphine)) - 0.0015 * _interval) max 0, _syncValues]; + _unit setVariable [QGVAR(morphine), ((_unit getVariable [QGVAR(morphine), 0]) - 0.0015 * _interval) max 0, _syncValues]; }; // bleeding From 95d83554da56d1018ad080ff33f3c71fd2a276c7 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Tue, 28 Apr 2015 20:32:02 +0200 Subject: [PATCH 06/18] Added local treatment through remoteExec for basic --- addons/medical/XEH_preInit.sqf | 2 ++ .../functions/fnc_treatmentBasic_bloodbag.sqf | 7 ++--- .../fnc_treatmentBasic_bloodbagLocal.sqf | 21 +++++++++++++++ .../functions/fnc_treatmentBasic_morphine.sqf | 11 ++------ .../fnc_treatmentBasic_morphineLocal.sqf | 27 +++++++++++++++++++ 5 files changed, 54 insertions(+), 14 deletions(-) create mode 100644 addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf create mode 100644 addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 051f7da266..4f4ff5bc30 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -80,8 +80,10 @@ PREP(treatmentAdvanced_medication); PREP(treatmentAdvanced_medicationLocal); PREP(treatmentBasic_bandage); PREP(treatmentBasic_bloodbag); +PREP(treatmentBasic_bloodbagLocal); PREP(treatmentBasic_epipen); PREP(treatmentBasic_morphine); +PREP(treatmentBasic_morphineLocal); PREP(treatmentIV); PREP(treatmentIVLocal); PREP(treatmentTourniquet); diff --git a/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf index 57563ad8fc..9d2c12280d 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf @@ -15,12 +15,9 @@ */ #include "script_component.hpp" -#define BLOODBAGHEAL 70 -private ["_caller", "_target","_className","_blood"]; +private ["_caller", "_target"]; _caller = _this select 0; _target = _this select 1; -_className = _this select 3; -_blood = ((_target getVariable [QGVAR(bloodVolume), 100]) + BLOODBAGHEAL) min 100; -_target setVariable [QGVAR(bloodVolume), _blood, true]; +[[_target], QUOTE(DFUNC(treatmentBasic_bloodbagLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf b/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf new file mode 100644 index 0000000000..9bbe04b35f --- /dev/null +++ b/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf @@ -0,0 +1,21 @@ +/* + * Author: KoffeinFlummi + * Local callback when the bloodbag treatment is complete + * + * Arguments: + * 0: The patient + * + * Return Value: + * nil + * + * Public: No + */ + +#include "script_component.hpp" +#define BLOODBAGHEAL 70 + +private ["_target","_blood"]; +_target = _this select 0; + +_blood = ((_target getVariable [QGVAR(bloodVolume), 100]) + BLOODBAGHEAL) min 100; +_target setVariable [QGVAR(bloodVolume), _blood, true]; diff --git a/addons/medical/functions/fnc_treatmentBasic_morphine.sqf b/addons/medical/functions/fnc_treatmentBasic_morphine.sqf index d8d793d0bc..048b314781 100644 --- a/addons/medical/functions/fnc_treatmentBasic_morphine.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_morphine.sqf @@ -17,15 +17,8 @@ #include "script_component.hpp" #define MORPHINEHEAL 0.4 -private ["_caller", "_target","_className","_blood","_morphine","_pain"]; +private ["_caller", "_target"]; _caller = _this select 0; _target = _this select 1; -_className = _this select 3; -// reduce pain, pain sensitivity -_morphine = ((_target getVariable [QGVAR(morphine), 0]) + MORPHINEHEAL) min 1; -_target setVariable [QGVAR(morphine), _morphine, true]; -_pain = ((_target getVariable [QGVAR(pain), 0]) - MORPHINEHEAL) max 0; -_target setVariable [QGVAR(pain), _pain, true]; - -// @todo overdose +[[_target], QUOTE(DFUNC(treatmentBasic_morphineLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf b/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf new file mode 100644 index 0000000000..9dddf743e2 --- /dev/null +++ b/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf @@ -0,0 +1,27 @@ +/* + * Author: KoffeinFlummi + * Local callback when the morphine treatment is complete + * + * Arguments: + * 0: The medic + * 1: The patient + * + * Return Value: + * nil + * + * Public: No + */ + +#include "script_component.hpp" +#define MORPHINEHEAL 0.4 + +private ["_target", "_morphine", "_pain"]; +_target = _this select 0; + +// reduce pain, pain sensitivity +_morphine = ((_target getVariable [QGVAR(morphine), 0]) + MORPHINEHEAL) min 1; +_target setVariable [QGVAR(morphine), _morphine, true]; +_pain = ((_target getVariable [QGVAR(pain), 0]) - MORPHINEHEAL) max 0; +_target setVariable [QGVAR(pain), _pain, true]; + +// @todo overdose From ebbb88deffa078b057a1e62413f4a1c7c8053e81 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Tue, 28 Apr 2015 20:32:29 +0200 Subject: [PATCH 07/18] Join in progress players will now be initialized --- addons/medical/XEH_postInit.sqf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index 526990709b..1819178432 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -266,6 +266,10 @@ if (USE_WOUND_EVENT_SYNC) then { [ACE_player] call FUNC(itemCheck); }] call EFUNC(common,addEventHandler); - // Networked litter [QGVAR(createLitter), FUNC(handleCreateLitter), GVAR(litterCleanUpDelay)] call EFUNC(common,addSyncedEventHandler); + +["PlayerJip", { + diag_log format["[ACE] JIP Medical init for player"]; + [player] call FUNC(init); +}] call FUNC(addEventHandler); From c06caa72092b41185646e83964e3523536b03d54 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Tue, 28 Apr 2015 20:33:01 +0200 Subject: [PATCH 08/18] Only add JIP event for player clients --- addons/medical/XEH_postInit.sqf | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index 1819178432..a3eb468442 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -269,7 +269,9 @@ if (USE_WOUND_EVENT_SYNC) then { // Networked litter [QGVAR(createLitter), FUNC(handleCreateLitter), GVAR(litterCleanUpDelay)] call EFUNC(common,addSyncedEventHandler); -["PlayerJip", { - diag_log format["[ACE] JIP Medical init for player"]; - [player] call FUNC(init); -}] call FUNC(addEventHandler); +if (hasInterface) then { + ["PlayerJip", { + diag_log format["[ACE] JIP Medical init for player"]; + [player] call FUNC(init); + }] call FUNC(addEventHandler); +}; From f606c248540bc03f12d28bb6306ef440fc13e625 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Tue, 28 Apr 2015 20:47:11 +0200 Subject: [PATCH 09/18] fixes #901 --- .../medical/functions/fnc_actionDiagnose.sqf | 8 ++++++-- .../fnc_displayPatientInformation.sqf | 2 +- .../medical/functions/fnc_handleUnitVitals.sqf | 18 ++++++++++++------ addons/medical/functions/fnc_init.sqf | 2 +- .../fnc_treatmentAdvanced_fullHealLocal.sqf | 2 +- addons/medical/stringtable.xml | 3 +++ 6 files changed, 24 insertions(+), 11 deletions(-) diff --git a/addons/medical/functions/fnc_actionDiagnose.sqf b/addons/medical/functions/fnc_actionDiagnose.sqf index 234cc6d303..886fa4752b 100644 --- a/addons/medical/functions/fnc_actionDiagnose.sqf +++ b/addons/medical/functions/fnc_actionDiagnose.sqf @@ -26,8 +26,12 @@ if (alive _target) then { } else { _genericMessages pushback "STR_ACE_MEDICAL_diagnoseDead"; }; -if (_target getvariable[QGVAR(hasLostBlood), false]) then { - _genericMessages pushback "STR_ACE_MEDICAL_lostBlood"; +if (_target getvariable[QGVAR(hasLostBlood), 0] > 0) then { + if (_target getvariable[QGVAR(hasLostBlood), 0] > 1) then { + _genericMessages pushback "STR_ACE_MEDICAL_lostBloodALot"; + } else { + _genericMessages pushback "STR_ACE_MEDICAL_lostBlood"; + }; } else { _genericMessages pushback "STR_ACE_MEDICAL_noBloodloss"; }; diff --git a/addons/medical/functions/fnc_displayPatientInformation.sqf b/addons/medical/functions/fnc_displayPatientInformation.sqf index 1fc1051efa..a62bfcacbc 100644 --- a/addons/medical/functions/fnc_displayPatientInformation.sqf +++ b/addons/medical/functions/fnc_displayPatientInformation.sqf @@ -57,7 +57,7 @@ if (_show) then { if (_target getvariable[QGVAR(isBleeding), false]) then { _genericMessages pushback [localize "STR_ACE_MEDICAL_STATUS_BLEEDING", [1, 0.1, 0.1, 1]]; }; - if (_target getvariable[QGVAR(hasLostBlood), false]) then { + if (_target getvariable[QGVAR(hasLostBlood), 0] > 1) then { _genericMessages pushback [localize "STR_ACE_MEDICAL_STATUS_LOST_BLOOD", [1, 0.1, 0.1, 1]]; }; diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index b806d1358f..e04b35955e 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -33,13 +33,19 @@ _bloodVolume = _bloodVolume max 0; _unit setvariable [QGVAR(bloodVolume), _bloodVolume, _syncValues]; // Set variables for synchronizing information across the net -if (_bloodVolume < 90) then { - if !(_unit getvariable [QGVAR(hasLostBlood), false]) then { - _unit setvariable [QGVAR(hasLostBlood), true, true]; - }; +if (_bloodVolume < 100) then { + if ((_bloodVolume < 90 && (GVAR(level) == 2)) || _bloodVolume <= 30) then { + if (_unit getvariable [QGVAR(hasLostBlood), 0] != 2) then { + _unit setvariable [QGVAR(hasLostBlood), 2, true]; + }; + } else { + if (_unit getvariable [QGVAR(hasLostBlood), 0] != 1) then { + _unit setvariable [QGVAR(hasLostBlood), 1, true]; + }; + } } else { - if (_unit getvariable [QGVAR(hasLostBlood),false]) then { - _unit setvariable [QGVAR(hasLostBlood), false, true]; + if (_unit getvariable [QGVAR(hasLostBlood), 0] != 0) then { + _unit setvariable [QGVAR(hasLostBlood), 0, true]; }; }; diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf index d01a63b3a5..80e8d9ba19 100644 --- a/addons/medical/functions/fnc_init.sqf +++ b/addons/medical/functions/fnc_init.sqf @@ -60,7 +60,7 @@ _unit setvariable [QGVAR(airwayCollapsed), false]; _unit setvariable [QGVAR(addedToUnitLoop), false, true]; _unit setvariable [QGVAR(inCardiacArrest), false, true]; _unit setVariable ["ACE_isUnconscious", false, true]; -_unit setvariable [QGVAR(hasLostBlood), false, true]; +_unit setvariable [QGVAR(hasLostBlood), 0, true]; _unit setvariable [QGVAR(isBleeding), false, true]; _unit setvariable [QGVAR(hasPain), false, true]; _unit setvariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives), true]; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf index 77f6d7f44c..e385c5f7c0 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf @@ -55,7 +55,7 @@ if (alive _target) exitwith { _target setvariable [QGVAR(inCardiacArrest), false, true]; _target setvariable [QGVAR(inReviveState), false, true]; _target setVariable ["ACE_isUnconscious", false, true]; - _target setvariable [QGVAR(hasLostBlood), false, true]; + _target setvariable [QGVAR(hasLostBlood), 0, true]; _target setvariable [QGVAR(isBleeding), false, true]; _target setvariable [QGVAR(hasPain), false, true]; diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 52baf9bbe3..7d3c2a6db4 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -1497,6 +1497,9 @@ Il à perdu du sang Stracił trochę krwi + + He's lost a lot of blood + He hasn't lost blood Нет кровопотери From a854b90b00b5854e0604d7cb639cb572acb76bea Mon Sep 17 00:00:00 2001 From: Glowbal Date: Tue, 28 Apr 2015 22:19:30 +0200 Subject: [PATCH 10/18] Increased level at which a lot of blood message gets shown in basic medical --- addons/medical/functions/fnc_handleUnitVitals.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index e04b35955e..0e01ef654c 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -34,7 +34,7 @@ _unit setvariable [QGVAR(bloodVolume), _bloodVolume, _syncValues]; // Set variables for synchronizing information across the net if (_bloodVolume < 100) then { - if ((_bloodVolume < 90 && (GVAR(level) == 2)) || _bloodVolume <= 30) then { + if ((_bloodVolume < 90 && (GVAR(level) == 2)) || _bloodVolume <= 45) then { if (_unit getvariable [QGVAR(hasLostBlood), 0] != 2) then { _unit setvariable [QGVAR(hasLostBlood), 2, true]; }; From 3eb2bdfc8467aa7432312466a1bfb4bac9a52924 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 28 Apr 2015 21:17:29 -0500 Subject: [PATCH 11/18] Display Name Progress Text --- addons/medical/ACE_Medical_Treatments.hpp | 8 +++++--- addons/medical/stringtable.xml | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 85bcab9616..fced8c93bf 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -196,7 +196,7 @@ class ACE_Medical_Actions { }; class SurgicalKit: fieldDressing { displayName = ""; - displayNameProgress = ""; + displayNameProgress = "$STR_ACE_Medical_TreatmentAction"; items[] = {"ACE_surgicalKit"}; treatmentLocations[] = {QGVAR(useLocation_SurgicalKit)}; requiredMedic = QGVAR(medicSetting_SurgicalKit); @@ -208,7 +208,7 @@ class ACE_Medical_Actions { }; class PersonalAidKit: fieldDressing { displayName = ""; - displayNameProgress = ""; + displayNameProgress = "$STR_ACE_Medical_TreatmentAction"; items[] = {"ACE_personalAidKit"}; treatmentLocations[] = {QGVAR(useLocation_PAK)}; requiredMedic = QGVAR(medicSetting_PAK); @@ -225,7 +225,7 @@ class ACE_Medical_Actions { }; class CheckPulse: fieldDressing { displayName = ""; - displayNameProgress = ""; + displayNameProgress = "$STR_ACE_MEDICAL_CHECK_PULSE_CONTENT"; treatmentLocations[] = {"All"}; requiredMedic = 0; treatmentTime = 2; @@ -240,9 +240,11 @@ class ACE_Medical_Actions { }; class CheckBloodPressure: CheckPulse { callbackSuccess = QUOTE(DFUNC(actionCheckBloodPressure)); + displayNameProgress = "$STR_ACE_MEDICAL_CHECK_BLOODPRESSURE_CONTENT"; }; class CheckResponse: CheckPulse { callbackSuccess = QUOTE(DFUNC(actionCheckResponse)); + displayNameProgress = "$STR_ACE_MEDICAL_CHECK_RESPONSE_CONTENT"; }; class RemoveTourniquet: CheckPulse { treatmentTime = 2.5; diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 7d3c2a6db4..dda25fd5ad 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -2080,5 +2080,8 @@ Zkłamana kość udowa Femur Cassé + + Treating... + \ No newline at end of file From 87465b8b102d374f4465cd79520d4e4ad6fae487 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Wed, 29 Apr 2015 21:49:24 +0200 Subject: [PATCH 12/18] fixes #829 --- addons/medical/functions/fnc_handleDamage.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index a8dddcadc8..a989513580 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -63,7 +63,7 @@ if (GVAR(level) >= 2) then { }; }; - if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)}) then { + if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)} || !alive vehicle _unit) then { if ([_unit] call FUNC(setDead)) then { _damageReturn = 1; } else { From 614a93ef127bad28ef1a1ab2e9173949bd83986b Mon Sep 17 00:00:00 2001 From: Glowbal Date: Wed, 29 Apr 2015 22:04:46 +0200 Subject: [PATCH 13/18] fixes #838 --- addons/medical/ACE_Settings.hpp | 3 ++- addons/medical/CfgVehicles.hpp | 7 ++++++- addons/medical/functions/fnc_handleDamage.sqf | 2 +- addons/medical/functions/fnc_setDead.sqf | 5 +++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index 26fa87e706..1d87803f43 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -60,8 +60,9 @@ class ACE_Settings { value = 0; }; class GVAR(enableRevive) { - typeName = "BOOL"; + typeName = "SCALAR"; value = 0; + values[] = {"Disabled", "Players only", "Players and AI"}; }; class GVAR(maxReviveTime) { typeName = "SCALAR"; diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index 339abe5a42..f28322baf7 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -238,8 +238,13 @@ class CfgVehicles { class enableRevive { displayName = "Enable Revive"; description = "Enable a basic revive system"; - typeName = "BOOL"; + typeName = "NUMBER"; defaultValue = 0; + class values { + class disable { name = "Disabled"; value = 0; default = 1;}; + class playerOnly { name = "Player only"; value = 1; }; + class playerAndAI { name = "Player & AI"; value = 2; }; + }; }; class maxReviveTime { displayName = "Max Revive time"; diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index a989513580..db799b45ab 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -76,7 +76,7 @@ if (GVAR(level) >= 2) then { }; [_unit] call FUNC(addToInjuredCollection); -if (((_unit getVariable [QGVAR(enableRevive), GVAR(enableRevive)])) && {_damageReturn >= 0.9} && {_selection in ["", "head", "body"]}) exitWith { +if (((_unit getVariable [QGVAR(enableRevive), GVAR(enableRevive)]) > 0) && {_damageReturn >= 0.9} && {_selection in ["", "head", "body"]}) exitWith { if (vehicle _unit != _unit and {damage _vehicle >= 1}) then { // @todo // [_unit] call FUNC(unload); diff --git a/addons/medical/functions/fnc_setDead.sqf b/addons/medical/functions/fnc_setDead.sqf index 428d6674ab..9d8498cd04 100644 --- a/addons/medical/functions/fnc_setDead.sqf +++ b/addons/medical/functions/fnc_setDead.sqf @@ -13,7 +13,7 @@ #include "script_component.hpp" -private ["_unit", "_force"]; +private ["_unit", "_force", "_reviveVal"]; _unit = _this select 0; _force = false; if (count _this >= 2) then { @@ -26,7 +26,8 @@ if (!local _unit) exitwith { false; }; -if ((_unit getVariable [QGVAR(enableRevive), GVAR(enableRevive)]) && !_force) exitwith { +_reviveVal = _unit getVariable [QGVAR(enableRevive), GVAR(enableRevive)]; +if (((_reviveVal == 1 && {[_unit] call EFUNC(common,isPlayer)} || _reviveVal == 2)) && !_force) exitwith { if (_unit getvariable [QGVAR(inReviveState), false]) exitwith { if (GVAR(amountOfReviveLives) > 0) then { _lifesLeft = _unit getvariable[QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives)]; From aaa8171457ff1300f5a22d8bd6feab017541ad7c Mon Sep 17 00:00:00 2001 From: Glowbal Date: Wed, 29 Apr 2015 22:54:58 +0200 Subject: [PATCH 14/18] Implemented prevent instant death #839 --- addons/medical/functions/fnc_handleDamage.sqf | 53 +++++++++++-------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index db799b45ab..546a6c44b0 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -37,45 +37,54 @@ if !(_selection in (GVAR(SELECTIONS) + [""])) exitWith {0}; _damageReturn = _damage; if (GVAR(level) < 2) then { _damageReturn = _this call FUNC(handleDamage_basic); -}; - -if (GVAR(level) >= 2) then { +} else { if !([_unit] call FUNC(hasMedicalEnabled)) exitwith { // Because of the config changes, we cannot properly disable the medical system for a unit. // lets use basic for the time being.. _damageReturn = _this call FUNC(handleDamage_basic); }; _newDamage = _this call FUNC(handleDamage_caching); + _typeOfDamage = [_projectile] call FUNC(getTypeOfDamage); - //if (_damageReturn > 0.9) then { + _typeIndex = (GVAR(allAvailableDamageTypes) find _typeOfDamage); + _minLethalDamage = 0.01; + if (_typeIndex >= 0) then { + _minLethalDamage = GVAR(minLethalDamages) select _typeIndex; + }; - _typeOfDamage = [_projectile] call FUNC(getTypeOfDamage); - - _typeIndex = (GVAR(allAvailableDamageTypes) find _typeOfDamage); - _minLethalDamage = 0.01; - if (_typeIndex >= 0) then { - _minLethalDamage = GVAR(minLethalDamages) select _typeIndex; + if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _source} && {_projectile == ""} && {_selection == ""}) then { + if (GVAR(enableVehicleCrashes)) then { + _selection = GVAR(SELECTIONS) select (floor(random(count GVAR(SELECTIONS)))); }; + }; - if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _source} && {_projectile == ""} && {_selection == ""}) then { - if (GVAR(enableVehicleCrashes)) then { - _selection = GVAR(SELECTIONS) select (floor(random(count GVAR(SELECTIONS)))); - }; + if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)} || !alive vehicle _unit) then { + if ((_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)])) exitwith { + _damageReturn = 0.9; }; - - if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)} || !alive vehicle _unit) then { - if ([_unit] call FUNC(setDead)) then { - _damageReturn = 1; - } else { - _damageReturn = _damageReturn min 0.89; - }; + if ({[_unit] call FUNC(setDead)}) then { + _damageReturn = 1; } else { _damageReturn = _damageReturn min 0.89; }; - //}; + } else { + _damageReturn = _damageReturn min 0.89; + }; }; [_unit] call FUNC(addToInjuredCollection); +if (_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)]) exitWith { + if (_damageReturn >= 0.9 && {_selection in ["", "head", "body"]}) exitWith { + if (_unit getvariable ["ACE_isUnconscious", false]) exitwith { + [_unit] call FUNC(setDead); + 0.89 + }; + [{ [_this select 0, true] call FUNC(setUnconscious); }, [_unit]] call EFUNC(common,execNextFrame); + 0.89 + }; + _damageReturn min 0.89; +}; + if (((_unit getVariable [QGVAR(enableRevive), GVAR(enableRevive)]) > 0) && {_damageReturn >= 0.9} && {_selection in ["", "head", "body"]}) exitWith { if (vehicle _unit != _unit and {damage _vehicle >= 1}) then { // @todo From 581c64f66faa324cb1ec0382aae51401f65438ab Mon Sep 17 00:00:00 2001 From: Glowbal Date: Wed, 29 Apr 2015 23:12:47 +0200 Subject: [PATCH 15/18] Implemented unloading from vehicles #740 --- addons/interaction/CfgVehicles.hpp | 36 ++++++++++++++++++++++++++++++ addons/medical/CfgVehicles.hpp | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index f6f39808b9..96165d63e3 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -398,6 +398,12 @@ class CfgVehicles { selection = ""; distance = 10; condition = "true"; + class ACE_Passengers { + displayName = "$STR_ACE_Interaction_Passengers"; + condition = "true"; + statement = ""; + insertChildren = QUOTE(_this call DFUNC(addPassengersActions)); + }; }; }; class ACE_SelfActions { @@ -416,6 +422,12 @@ class CfgVehicles { selection = ""; distance = 10; condition = "true"; + class ACE_Passengers { + displayName = "$STR_ACE_Interaction_Passengers"; + condition = "true"; + statement = ""; + insertChildren = QUOTE(_this call DFUNC(addPassengersActions)); + }; }; }; class ACE_SelfActions { @@ -436,6 +448,12 @@ class CfgVehicles { selection = ""; distance = 10; condition = "true"; + class ACE_Passengers { + displayName = "$STR_ACE_Interaction_Passengers"; + condition = "true"; + statement = ""; + insertChildren = QUOTE(_this call DFUNC(addPassengersActions)); + }; }; }; class ACE_SelfActions { @@ -454,6 +472,12 @@ class CfgVehicles { selection = ""; distance = 10; condition = "true"; + class ACE_Passengers { + displayName = "$STR_ACE_Interaction_Passengers"; + condition = "true"; + statement = ""; + insertChildren = QUOTE(_this call DFUNC(addPassengersActions)); + }; }; }; class ACE_SelfActions { @@ -483,6 +507,12 @@ class CfgVehicles { showDisabled = 0; priority = -1; }; + class ACE_Passengers { + displayName = "$STR_ACE_Interaction_Passengers"; + condition = "true"; + statement = ""; + insertChildren = QUOTE(_this call DFUNC(addPassengersActions)); + }; }; }; class ACE_SelfActions { @@ -502,6 +532,12 @@ class CfgVehicles { selection = "gunnerview"; distance = 2; condition = "true"; + class ACE_Passengers { + displayName = "$STR_ACE_Interaction_Passengers"; + condition = "true"; + statement = ""; + insertChildren = QUOTE(_this call DFUNC(addPassengersActions)); + }; }; }; class ACE_SelfActions { diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index f28322baf7..179daae742 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -446,7 +446,7 @@ class CfgVehicles { displayName = "$STR_ACE_MEDICAL_ACTIONS_Medical"; runOnHover = 1; exceptions[] = {"isNotInside"}; - condition = QUOTE(vehicle _target != _target); + condition = QUOTE(vehicle _target != _target && vehicle _target == vehicle _player); statement = QUOTE([ARR_3(_target, true, 0)] call DFUNC(displayPatientInformation)); icon = PATHTOF(UI\icons\medical_cross.paa); From a39e869728e1c0cff4a94e3f87882d292a869b28 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 29 Apr 2015 16:44:47 -0500 Subject: [PATCH 16/18] Fix extra {} wraped Error position: Error if: Type code, expected Bool File z\ace\addons\medical\functions\fnc_handleDamage.sqf, line 50 --- addons/medical/functions/fnc_handleDamage.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index 546a6c44b0..0a39bea055 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -62,7 +62,7 @@ if (GVAR(level) < 2) then { if ((_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)])) exitwith { _damageReturn = 0.9; }; - if ({[_unit] call FUNC(setDead)}) then { + if ([_unit] call FUNC(setDead)) then { _damageReturn = 1; } else { _damageReturn = _damageReturn min 0.89; From 5fef446c0031fb6609462f19cbf9c419a9915f9d Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 29 Apr 2015 16:53:09 -0500 Subject: [PATCH 17/18] EFUNC for dragging calls --- addons/medical/functions/fnc_actionLoadUnit.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/medical/functions/fnc_actionLoadUnit.sqf b/addons/medical/functions/fnc_actionLoadUnit.sqf index 990467521a..34df6aa085 100644 --- a/addons/medical/functions/fnc_actionLoadUnit.sqf +++ b/addons/medical/functions/fnc_actionLoadUnit.sqf @@ -23,10 +23,10 @@ if ([_target] call EFUNC(common,isAwake)) exitwith { ["displayTextStructured", [_caller], [["This person (%1) is awake and cannot be loaded", [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent); }; if ([_target] call FUNC(isBeingCarried)) then { - [_caller, _target] call FUNC(dropObject_carry); + [_caller, _target] call EFUNC(dragging,dropObject_carry); }; if ([_target] call FUNC(isBeingDragged)) then { - [_caller, _target] call FUNC(dropObject); + [_caller, _target] call EFUNC(dragging,dropObject); }; _vehicle = [_caller, _target] call EFUNC(common,loadPerson); From f90834eeaba6e5b2df2b3aeb3d9b79f0212cd893 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 29 Apr 2015 16:57:24 -0500 Subject: [PATCH 18/18] Unused --- addons/medical/functions/fnc_actionLoadUnit.sqf | 6 ------ 1 file changed, 6 deletions(-) diff --git a/addons/medical/functions/fnc_actionLoadUnit.sqf b/addons/medical/functions/fnc_actionLoadUnit.sqf index 34df6aa085..34f93fb11d 100644 --- a/addons/medical/functions/fnc_actionLoadUnit.sqf +++ b/addons/medical/functions/fnc_actionLoadUnit.sqf @@ -30,9 +30,3 @@ if ([_target] call FUNC(isBeingDragged)) then { }; _vehicle = [_caller, _target] call EFUNC(common,loadPerson); -if (!isNull _vehicle) then { - if (!isnil QGVAR(DROP_ADDACTION)) then { - _caller removeAction GVAR(DROP_ADDACTION); - GVAR(DROP_ADDACTION) = nil; - }; -};