From af255604ac098030613ab983a313e790dac2a02e Mon Sep 17 00:00:00 2001 From: Glowbal Date: Tue, 14 Apr 2015 21:17:36 +0200 Subject: [PATCH 01/28] Switched to event based sync system for open wounds --- addons/medical/XEH_postInit.sqf | 2 +- addons/medical/functions/fnc_handleDamage_wounds.sqf | 1 - .../medical/functions/fnc_onWoundUpdateRequest.sqf | 12 +++++------- addons/medical/functions/fnc_requestWoundSync.sqf | 4 ++-- addons/medical/script_component.hpp | 2 +- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index 1b0a38f1af..3743511790 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -247,7 +247,7 @@ if (USE_WOUND_EVENT_SYNC) then { // We are only pulling the wounds for the units in the player group. Anything else will come when the unit interacts with them. { [_x, _newPlayer] call FUNC(requestWoundSync); - }foreach units group player; + }foreach units group _newPlayer; }; }] call EFUNC(common,addEventhandler); }; diff --git a/addons/medical/functions/fnc_handleDamage_wounds.sqf b/addons/medical/functions/fnc_handleDamage_wounds.sqf index 5933651e57..b45a974166 100644 --- a/addons/medical/functions/fnc_handleDamage_wounds.sqf +++ b/addons/medical/functions/fnc_handleDamage_wounds.sqf @@ -133,7 +133,6 @@ if (count _woundsCreated > 0) then { }; if (USE_WOUND_EVENT_SYNC) then { - // TODO Should this be done in a single broadcast? // Broadcast the new injuries across the net in parts. One broadcast per injury. Prevents having to broadcast one massive array of injuries. { ["medical_propagateWound", [_unit, _x]] call EFUNC(common,globalEvent); diff --git a/addons/medical/functions/fnc_onWoundUpdateRequest.sqf b/addons/medical/functions/fnc_onWoundUpdateRequest.sqf index c160e47ea0..ccbb373648 100644 --- a/addons/medical/functions/fnc_onWoundUpdateRequest.sqf +++ b/addons/medical/functions/fnc_onWoundUpdateRequest.sqf @@ -1,11 +1,10 @@ /* * Author: Glowbal - * Enabled the vitals loop for a unit. + * Handles an wound update request. * * Arguments: * 0: The Unit - * 1: the last known ID - * 2: Origin object + * 1: Origin object * * ReturnValue: * @@ -14,12 +13,11 @@ */ #include "script_component.hpp" -private ["_unit", "_lastId", "_openWounds"]; +private ["_unit", "_openWounds"]; _unit = _this select 0; -_lastId = _this select 1; -_originOfrequest = _this select 2; +_originOfrequest = _this select 1; -if (local _unit) then { +if (local _unit && !(local _originOfrequest)) then { _openWounds = _unit getvariable [QGVAR(openWounds), []]; { ["medical_propagateWound", [_originOfrequest], [_unit, _x]] call EFUNC(common,targetEvent); diff --git a/addons/medical/functions/fnc_requestWoundSync.sqf b/addons/medical/functions/fnc_requestWoundSync.sqf index bf6f881930..7144c49684 100644 --- a/addons/medical/functions/fnc_requestWoundSync.sqf +++ b/addons/medical/functions/fnc_requestWoundSync.sqf @@ -14,11 +14,11 @@ #include "script_component.hpp" -private [ "_target", "_caller", "_openWounds","_lastId"]; +private [ "_target", "_caller", "_openWounds"]; _target = _this select 0; _caller = _this select 1; if (local _target || GVAR(level) < 2) exitwith {}; // if the target is local, we already got the most update to date information if (_target getvariable [QGVAR(isWoundSynced), false]) exitwith {}; _target setvariable [QGVAR(isWoundSynced), true]; -["medical_woundUpdateRequest", [_target], [_target, _lastId, _caller]] call EFUNC(common,targetEvent); +["medical_woundUpdateRequest", [_target], [_target, _caller]] call EFUNC(common,targetEvent); diff --git a/addons/medical/script_component.hpp b/addons/medical/script_component.hpp index 939a811a41..bac6744bc1 100644 --- a/addons/medical/script_component.hpp +++ b/addons/medical/script_component.hpp @@ -11,4 +11,4 @@ #include "\z\ace\addons\main\script_macros.hpp" -#define USE_WOUND_EVENT_SYNC false +#define USE_WOUND_EVENT_SYNC true From c88479d54d49e169a0eaab2fb6f48b966b6ac833 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Wed, 15 Apr 2015 19:45:42 +0200 Subject: [PATCH 02/28] staged work --- .../functions/fnc_handleBandageOpening.sqf | 16 +++++++++++++--- addons/medical/functions/fnc_init.sqf | 1 + .../fnc_treatmentAdvanced_bandageLocal.sqf | 3 ++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/addons/medical/functions/fnc_handleBandageOpening.sqf b/addons/medical/functions/fnc_handleBandageOpening.sqf index b4e40984ae..21211c9c1b 100644 --- a/addons/medical/functions/fnc_handleBandageOpening.sqf +++ b/addons/medical/functions/fnc_handleBandageOpening.sqf @@ -59,20 +59,30 @@ if (isClass (_config >> _className)) then { _bandagedWounds = _target getvariable [QGVAR(bandagedWounds), []]; _exist = false; _injuryId = _injury select 0; +_bandagedInjury = []; { if ((_x select 0) == _injuryId) exitwith { _exist = true; _existingInjury = _x; _existingInjury set [3, (_existingInjury select 3) + _impact]; _bandagedWounds set [_foreachIndex, _existingInjury]; + + _bandagedInjury = _existingInjury; }; }foreach _bandagedWounds; if !(_exist) then { // [ID, classID, bodypart, percentage treated, bloodloss rate] - _bandagedWounds pushback [_injuryId, _injury select 1, _injury select 2, _impact, _injury select 4]; + _bandagedInjury = [_injuryId, _injury select 1, _injury select 2, _impact, _injury select 4]; + _bandagedWounds pushback _bandagedInjury; +}; + +_target setvariable [QGVAR(bandagedWounds), _bandagedWounds, !USE_WOUND_EVENT_SYNC]; + +if (USE_WOUND_EVENT_SYNC) then { + // sync _bandagedInjury + }; -_target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true]; // Check if we are ever going to reopen this if (random(1) <= _reopeningChance) then { @@ -109,7 +119,7 @@ if (random(1) <= _reopeningChance) then { }foreach _bandagedWounds; if (_exist) then { - _target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true]; + _target setvariable [QGVAR(bandagedWounds), _bandagedWounds, !USE_WOUND_EVENT_SYNC]; }; }; // Otherwise something went wrong, we we don't reopen them.. diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf index ed8301b6b2..fa6aa357c2 100644 --- a/addons/medical/functions/fnc_init.sqf +++ b/addons/medical/functions/fnc_init.sqf @@ -28,6 +28,7 @@ _unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; _unit setvariable [QGVAR(openWounds), [], true]; _unit setvariable [QGVAR(bandagedWounds), [], true]; _unit setVariable [QGVAR(internalWounds), [], true]; +_unit setvariable [QGVAR(lastUniqueWoundID), 1]; // vitals _unit setVariable [QGVAR(heartRate), 80]; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf index 217a69cd4d..02626ff1fe 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf @@ -92,7 +92,8 @@ if (USE_WOUND_EVENT_SYNC) then { }; // Handle the reopening of bandaged wounds if (_impact > 0 && {GVAR(enableAdvancedWounds)}) then { - [_target, _impact, _part, _mostEffectiveSpot, _mostEffectiveInjury, _bandage] call FUNC(handleBandageOpening); +// TODO temp disabled until bandaged wounds are supported by event sync. +// [_target, _impact, _part, _mostEffectiveSpot, _mostEffectiveInjury, _bandage] call FUNC(handleBandageOpening); }; // If all wounds have been bandaged, we will reset all damage to 0, so the unit is not showing any blood on the model anymore. From c86be1266800b7683d0dcbb4dbfcf5a598d3111a Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 20:24:05 +0200 Subject: [PATCH 03/28] fixes #599 --- addons/medical/functions/fnc_determineIfFatal.sqf | 6 +++--- addons/medical/functions/fnc_handleDamage.sqf | 6 ++++++ addons/medical/functions/fnc_setUnconscious.sqf | 7 ++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/addons/medical/functions/fnc_determineIfFatal.sqf b/addons/medical/functions/fnc_determineIfFatal.sqf index 6c90e54da3..aedcf161ee 100644 --- a/addons/medical/functions/fnc_determineIfFatal.sqf +++ b/addons/medical/functions/fnc_determineIfFatal.sqf @@ -21,10 +21,10 @@ if ((vehicle _unit != _unit) && {!alive (vehicle _unit)}) exitwith { true }; // Find the correct Damage threshold for unit. _damageThreshold = [1,1,1]; -if (isPlayer _unit) then { - //_damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_Players), GVAR(damageThreshold_Players), GVAR(damageThreshold_Players) * 1.7]]; +if ([_unit] call EFUNC(common,IsPlayer)) then { + _damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(playerDamageThreshold), GVAR(playerDamageThreshold), GVAR(playerDamageThreshold) * 1.7]]; } else { - //_damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_AI), GVAR(damageThreshold_AI), GVAR(damageThreshold_AI) * 1.7]]; + _damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(AIDamageThreshold), GVAR(AIDamageThreshold), GVAR(AIDamageThreshold) * 1.7]]; }; _damageBodyPart = ((_unit getvariable [QGVAR(bodyPartStatus),[0, 0, 0, 0, 0, 0]]) select _part) + _withDamage; diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index 1632a8f55b..c80f0c63e8 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -36,6 +36,12 @@ if !(_selection in (GVAR(SELECTIONS) + [""])) exitWith {0}; _damageReturn = _damage; if (GVAR(level) < 2) then { + if ([_unit] call EFUNC(isPlayer)) then { + _this set [2, _damage / (GVAR(playerDamageThreshold) max 0.01)]; + } else { + _this set [2, _damage / (GVAR(AIDamageThreshold) max 0.01)]; + }; + _damageReturn = _this call FUNC(handleDamage_basic); }; diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index 89ab5ee3b3..7fcfa0d24b 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -23,7 +23,7 @@ _set = if (count _this > 1) then {_this select 1} else {true}; _minWaitingTime = if (count _this > 2) then {_this select 2} else {DEFAULT_DELAY}; if !(_set) exitwith { - _unit setvariable ["ACE_isUnconscious", false,true]; + _unit setvariable ["ACE_isUnconscious", false, true]; }; if !(!(isNull _unit) && {(_unit isKindOf "CaManBase") && ([_unit] call EFUNC(common,isAwake))}) exitwith{}; @@ -40,6 +40,11 @@ if (_unit == ACE_player) then { closeDialog 0; }; +// if we have unconsciousness for AI disabled, we will kill the unit instead +if (!([_unit] call EFUNC(common,IsPlayer)) && (GVAR(enableUnsconsiousnessAI) == 0 || (GVAR(enableUnsconsiousnessAI) == 2 && random(1) <= 0.5))) exitwith { + [_unit, true] call FUNC(setDead); // force, to avoid getting into a loop in case revive is enabled. +}; + // If a unit has the launcher out, it will sometimes start selecting the primairy weapon while unconscious, // therefor we force it to select the primairy weapon before going unconscious if ((vehicle _unit) isKindOf "StaticWeapon") then { From 8b7e46c45f9421d2d87fefa19becf65e2c73aec0 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 20:26:28 +0200 Subject: [PATCH 04/28] fixes #656 --- addons/medical/functions/fnc_setUnconscious.sqf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index 7fcfa0d24b..c6a0e80c9b 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -91,6 +91,12 @@ _startingTime = time; _hasMovedOut = _args select 5; if (!alive _unit) exitwith { + [_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus); + [_unit, false] call EFUNC(common,disableAI); + _unit setUnitPos _originalPos; + _unit setUnconscious false; + ["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent); + [(_this select 1)] call cba_fnc_removePerFrameHandler; }; From 0234eedd54ac6d87203c1db89b85bbf3e4d8211f Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 20:33:13 +0200 Subject: [PATCH 05/28] Changed, only drop unit is player goes unconscious, otherwise keep carrying/dragging unit --- .../dragging/functions/fnc_handleUnconscious.sqf | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/addons/dragging/functions/fnc_handleUnconscious.sqf b/addons/dragging/functions/fnc_handleUnconscious.sqf index 41562756a2..31c703f37b 100644 --- a/addons/dragging/functions/fnc_handleUnconscious.sqf +++ b/addons/dragging/functions/fnc_handleUnconscious.sqf @@ -9,8 +9,6 @@ _isUnconscious = _this select 1; private "_player"; _player = ACE_player; -if ((_unit getHitPointDamage "HitLeftLeg") + (_unit getHitPointDamage "HitRightLeg") > 0.4) exitwith {}; - if (_player getVariable [QGVAR(isDragging), false]) then { private "_draggedObject"; @@ -22,9 +20,9 @@ if (_player getVariable [QGVAR(isDragging), false]) then { }; // handle waking up dragged unit - if (_unit == _draggedObject) then { - [_player, _draggedObject] call FUNC(dropObject); - }; + //if (_unit == _draggedObject) then { + // [_player, _draggedObject] call FUNC(dropObject); + //}; }; @@ -39,8 +37,8 @@ if (_player getVariable [QGVAR(isCarrying), false]) then { }; // handle waking up dragged unit - if (_unit == _carriedObject) then { - [_player, _carriedObject] call FUNC(dropObject_carry); - }; + //if (_unit == _carriedObject) then { + // [_player, _carriedObject] call FUNC(dropObject_carry); + //}; }; From 847ee7e2294312c1c48da0b0585388062241e642 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 20:38:02 +0200 Subject: [PATCH 06/28] Moved unconscious event, so it won't conflict in case the unit is still being carried --- addons/medical/functions/fnc_setUnconscious.sqf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index c6a0e80c9b..63be3fe5a0 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -118,6 +118,7 @@ _startingTime = time; // TODO: what if the unit switched vehicle? [_unit, _oldAnimation, 2] call EFUNC(common,doAnimation); }; + ["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent); // EXIT PFH [(_this select 1)] call cba_fnc_removePerFrameHandler; }; @@ -133,7 +134,7 @@ _startingTime = time; _unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP) _unit setUnconscious false; - ["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent); + // ensure this statement runs only once _args set [5, true]; }; From b333e6e662c7e1e8389a1fe3fa169c5dc449d23b Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 20:40:24 +0200 Subject: [PATCH 07/28] Keep units longer unconscious, instead of quickly fading in/out --- addons/medical/functions/fnc_handleUnitVitals.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index 2b175d7ca2..411f64b49e 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -94,7 +94,7 @@ if (GVAR(level) >= 2) then { if ([_unit] call EFUNC(common,isAwake)) then { if (_bloodVolume < 60) then { if (random(1) > 0.9) then { - [_unit] call FUNC(setUnconscious); + [_unit, true, 15 + random(20)] call FUNC(setUnconscious); }; }; }; @@ -136,7 +136,7 @@ if (GVAR(level) >= 2) then { if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { if (_heartRate < 10 || _bloodPressureH < 30 || _bloodVolume < 20) then { - [_unit] call FUNC(setUnconscious); // safety check to ensure unconsciousness for units if they are not dead already. + [_unit, true, 10+ random(20)] call FUNC(setUnconscious); // safety check to ensure unconsciousness for units if they are not dead already. }; if (_bloodPressureH > 260) then { From 80139521bcc030eb21e8eda97edebe0d80d93249 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 20:49:24 +0200 Subject: [PATCH 08/28] fixes #691 --- addons/medical/functions/fnc_handleDamage.sqf | 2 +- addons/medical/functions/fnc_setUnconscious.sqf | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index c80f0c63e8..876feae637 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -36,7 +36,7 @@ if !(_selection in (GVAR(SELECTIONS) + [""])) exitWith {0}; _damageReturn = _damage; if (GVAR(level) < 2) then { - if ([_unit] call EFUNC(isPlayer)) then { + if ([_unit] call EFUNC(common,isPlayer)) then { _this set [2, _damage / (GVAR(playerDamageThreshold) max 0.01)]; } else { _this set [2, _damage / (GVAR(AIDamageThreshold) max 0.01)]; diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index 63be3fe5a0..99651fc085 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -81,7 +81,7 @@ _unit setUnitPos "DOWN"; _startingTime = time; [{ - private ["_unit", "_vehicleOfUnit","_minWaitingTime", "_oldAnimation", "_captiveSwitch", "_hasMovedOut"]; + private ["_unit", "_vehicleOfUnit","_minWaitingTime", "_oldAnimation", "_captiveSwitch", "_hasMovedOut", "_parachuteCheck"]; _args = _this select 0; _unit = _args select 0; _oldAnimation = _args select 1; @@ -89,6 +89,7 @@ _startingTime = time; _startingTime = _args select 3; _minWaitingTime = _args select 4; _hasMovedOut = _args select 5; + _parachuteCheck = _args select 6; if (!alive _unit) exitwith { [_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus); @@ -140,6 +141,13 @@ _startingTime = time; }; }; + if (_parachuteCheck) then { + if !(vehicle _unit isKindOf "ParachuteBase") then { + [_unit, [_unit] call EFUNC(common,getDeathAnim), 1, true] call EFUNC(common,doAnimation); + _args set [6, false]; + }; + }; + // Ensure we are waiting at least a minimum period before checking if we can wake up the unit again, allows for temp knock outs if ((time - _startingTime) >= _minWaitingTime) exitwith { @@ -147,6 +155,6 @@ _startingTime = time; _unit setvariable ["ACE_isUnconscious", false, true]; }; }; -}, 0.1, [_unit,_animState, _originalPos, _startingTime, _minWaitingTime, false] ] call CBA_fnc_addPerFrameHandler; +}, 0.1, [_unit,_animState, _originalPos, _startingTime, _minWaitingTime, false, vehicle _unit isKindOf "ParachuteBase"] ] call CBA_fnc_addPerFrameHandler; ["medical_onUnconscious", [_unit, true]] call EFUNC(common,globalEvent); From 9b4435827ecfe5c29ac27ed1432880f784aaddfe Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 20:51:57 +0200 Subject: [PATCH 09/28] Added setting for unconscious animations on treatment --- addons/medical/ACE_Settings.hpp | 4 ++++ addons/medical/functions/fnc_treatment.sqf | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index 56e5a531ec..0007352dda 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -124,4 +124,8 @@ class ACE_Settings { values[] = {"$STR_ACE_Medical_painEffect_Flash", "$STR_ACE_Medical_painEffect_Chroma"}; isClientSettable = 1; }; + class GVAR(allowUnconsciousAnimationOnTreatment) { + typeName = "BOOL"; + value = 0; + }; }; diff --git a/addons/medical/functions/fnc_treatment.sqf b/addons/medical/functions/fnc_treatment.sqf index e010279be1..bb291d6c98 100644 --- a/addons/medical/functions/fnc_treatment.sqf +++ b/addons/medical/functions/fnc_treatment.sqf @@ -129,7 +129,7 @@ if (isNil _callbackProgress) then { // Patient Animation _patientAnim = getText (_config >> "animationPatient"); -if (_target getvariable ["ACE_isUnconscious", false]) then { +if (_target getvariable ["ACE_isUnconscious", false] && GVAR(allowUnconsciousAnimationOnTreatment)) then { if !(animationState _target in (getArray (_config >> "animationPatientUnconsciousExcludeOn"))) then { _patientAnim = getText (_config >> "animationPatientUnconscious"); }; From 31bc09a9a32d0135144cd029cb83a04d8ae75fba Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 21:06:30 +0200 Subject: [PATCH 10/28] fixed AI standing up before being killed Doesn't matter if we enable AI again on dead units --- addons/common/functions/fnc_disableAI.sqf | 2 +- addons/medical/functions/fnc_setUnconscious.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/common/functions/fnc_disableAI.sqf b/addons/common/functions/fnc_disableAI.sqf index 92ad35c0f9..0e1985eced 100644 --- a/addons/common/functions/fnc_disableAI.sqf +++ b/addons/common/functions/fnc_disableAI.sqf @@ -27,7 +27,7 @@ if ((local _unit) && {!([_unit] call EFUNC(common,isPlayer))}) then { _unit disableConversation true; } else { //Sanity check to make sure we don't enable unconsious AI - if (_unit getVariable ["ace_isunconscious", false]) exitWith {ERROR("Enabling AI for unconsious unit");}; + if (_unit getVariable ["ace_isunconscious", false] && alive _unit) exitWith {ERROR("Enabling AI for unconsious unit");}; _unit enableAI "MOVE"; _unit enableAI "TARGET"; _unit enableAI "AUTOTARGET"; diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index 99651fc085..3ef4df4d3f 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -94,7 +94,7 @@ _startingTime = time; if (!alive _unit) exitwith { [_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus); [_unit, false] call EFUNC(common,disableAI); - _unit setUnitPos _originalPos; + //_unit setUnitPos _originalPos; _unit setUnconscious false; ["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent); From eb731b116939cf81289dcff585ad87ea77119e62 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 21:07:09 +0200 Subject: [PATCH 11/28] fixes #653 --- addons/medical/functions/fnc_treatment.sqf | 2 ++ addons/medical/functions/fnc_treatment_failure.sqf | 9 ++++++++- addons/medical/functions/fnc_treatment_success.sqf | 9 ++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/addons/medical/functions/fnc_treatment.sqf b/addons/medical/functions/fnc_treatment.sqf index bb291d6c98..df6cc173d0 100644 --- a/addons/medical/functions/fnc_treatment.sqf +++ b/addons/medical/functions/fnc_treatment.sqf @@ -149,6 +149,8 @@ if (_caller == _target) then { _callerAnim = [getText (_config >> "animationCallerSelf"), getText (_config >> "animationCallerSelfProne")] select (stance _caller == "PRONE"); }; +_caller setvariable [QGVAR(selectedWeaponOnTreatment), currentWeapon _caller]; + // Cannot use secondairy weapon for animation if (currentWeapon _caller == secondaryWeapon _caller) then { _caller selectWeapon (primaryWeapon _caller); diff --git a/addons/medical/functions/fnc_treatment_failure.sqf b/addons/medical/functions/fnc_treatment_failure.sqf index d4f853374c..fe8bafb0c7 100644 --- a/addons/medical/functions/fnc_treatment_failure.sqf +++ b/addons/medical/functions/fnc_treatment_failure.sqf @@ -17,7 +17,7 @@ #include "script_component.hpp" -private ["_caller", "_target","_selectionName","_className","_config","_callback", "_usersOfItems"]; +private ["_caller", "_target","_selectionName","_className","_config","_callback", "_usersOfItems", "_weaponSelect"]; _args = _this select 0; _caller = _args select 0; @@ -34,6 +34,13 @@ if (vehicle _caller == _caller) then { }; _caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; +_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnTreatment), ""]); +if (_weaponSelect != "") then { + _caller selectWeapon _weaponSelect; +} else { + _caller action ["SwitchWeapon", _caller, _caller, 99]; +}; + { (_x select 0) addItem (_x select 1); }foreach _usersOfItems; diff --git a/addons/medical/functions/fnc_treatment_success.sqf b/addons/medical/functions/fnc_treatment_success.sqf index 5910a4be86..6822f674c7 100644 --- a/addons/medical/functions/fnc_treatment_success.sqf +++ b/addons/medical/functions/fnc_treatment_success.sqf @@ -17,7 +17,7 @@ #include "script_component.hpp" -private ["_caller", "_target","_selectionName","_className","_config","_callback"]; +private ["_caller", "_target","_selectionName","_className","_config","_callback", "_weaponSelect"]; _args = _this select 0; _caller = _args select 0; _target = _args select 1; @@ -32,6 +32,13 @@ if (vehicle _caller == _caller) then { }; _caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; +_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnTreatment), ""]); +if (_weaponSelect != "") then { + _caller selectWeapon _weaponSelect; +} else { + _caller action ["SwitchWeapon", _caller, _caller, 99]; +}; + // Record specific callback _config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); if (GVAR(level) >= 2) then { From 008c36ac763de4036389469d9edf405b81099d4c Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 21:27:57 +0200 Subject: [PATCH 12/28] fixes #699 --- addons/medical/XEH_preInit.sqf | 1 + addons/medical/functions/fnc_handleLocal.sqf | 10 ++ .../medical/functions/fnc_setUnconscious.sqf | 77 +-------------- .../medical/functions/fnc_unconsciousPFH.sqf | 93 +++++++++++++++++++ 4 files changed, 105 insertions(+), 76 deletions(-) create mode 100644 addons/medical/functions/fnc_unconsciousPFH.sqf diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index f15b4ec109..a54b6d0d8f 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -97,6 +97,7 @@ PREP(moduleAssignMedicalFacility); PREP(moduleTreatmentConfiguration); PREP(copyDeadBody); PREP(requestWoundSync); +PREP(unconsciousPFH); GVAR(injuredUnitCollection) = []; GVAR(IVBags) = []; diff --git a/addons/medical/functions/fnc_handleLocal.sqf b/addons/medical/functions/fnc_handleLocal.sqf index 5d9c5865a4..5a6123d9f7 100644 --- a/addons/medical/functions/fnc_handleLocal.sqf +++ b/addons/medical/functions/fnc_handleLocal.sqf @@ -22,4 +22,14 @@ if (_local) then { if (_unit getvariable[QGVAR(addedToUnitLoop),false]) then { [_unit, true] call FUNC(addToInjuredCollection); }; + + if (count (_unit getvariable [QGVAR(unconsciousArguments), []]) >= 7) then { + private "_arguments"; + _arguments = (_unit getvariable [QGVAR(unconsciousArguments), []]); + _arguments set [ 3, time]; + + [DFUNC(unconsciousPFH), 0.1, _arguments ] call CBA_fnc_addPerFrameHandler; + + _unit setvariable [QGVAR(unconsciousArguments), nil, true]; + }; }; diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index 3ef4df4d3f..ef9ccb246d 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -80,81 +80,6 @@ _unit setUnitPos "DOWN"; _startingTime = time; -[{ - private ["_unit", "_vehicleOfUnit","_minWaitingTime", "_oldAnimation", "_captiveSwitch", "_hasMovedOut", "_parachuteCheck"]; - _args = _this select 0; - _unit = _args select 0; - _oldAnimation = _args select 1; - _originalPos = _args select 2; - _startingTime = _args select 3; - _minWaitingTime = _args select 4; - _hasMovedOut = _args select 5; - _parachuteCheck = _args select 6; - - if (!alive _unit) exitwith { - [_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus); - [_unit, false] call EFUNC(common,disableAI); - //_unit setUnitPos _originalPos; - _unit setUnconscious false; - ["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent); - - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - - // In case the unit is no longer in an unconscious state, we are going to check if we can already reset the animation - if !(_unit getvariable ["ACE_isUnconscious",false]) exitwith { - - // TODO, handle this with carry instead, so we can remove the PFH here. - // Wait until the unit isn't being carried anymore, so we won't end up with wierd animations - if !(([_unit] call FUNC(isBeingCarried)) || ([_unit] call FUNC(isBeingDragged))) then { - if (vehicle _unit == _unit) then { - if (animationState _unit == "AinjPpneMstpSnonWrflDnon") then { - [_unit,"AinjPpneMstpSnonWrflDnon_rolltofront", 2] call EFUNC(common,doAnimation); - [_unit,"amovppnemstpsnonwnondnon", 1] call EFUNC(common,doAnimation); - } else { - [_unit,"amovppnemstpsnonwnondnon", 2] call EFUNC(common,doAnimation); - }; - } else { - // Switch to the units original animation, assuming - // TODO: what if the unit switched vehicle? - [_unit, _oldAnimation, 2] call EFUNC(common,doAnimation); - }; - ["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent); - // EXIT PFH - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - if (!_hasMovedOut) then { - // Reset the unit back to the previous captive state. - [_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus); - - // Swhich the unit back to its original group - //Unconscious units shouldn't be put in another group #527: - // [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); - - [_unit, false] call EFUNC(common,disableAI); - _unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP) - - _unit setUnconscious false; - - // ensure this statement runs only once - _args set [5, true]; - }; - }; - - if (_parachuteCheck) then { - if !(vehicle _unit isKindOf "ParachuteBase") then { - [_unit, [_unit] call EFUNC(common,getDeathAnim), 1, true] call EFUNC(common,doAnimation); - _args set [6, false]; - }; - }; - - // Ensure we are waiting at least a minimum period before checking if we can wake up the unit again, allows for temp knock outs - if ((time - _startingTime) >= _minWaitingTime) exitwith { - - if (!([_unit] call FUNC(getUnconsciousCondition))) then { - _unit setvariable ["ACE_isUnconscious", false, true]; - }; - }; -}, 0.1, [_unit,_animState, _originalPos, _startingTime, _minWaitingTime, false, vehicle _unit isKindOf "ParachuteBase"] ] call CBA_fnc_addPerFrameHandler; +[DFUNC(unconsciousPFH), 0.1, [_unit,_animState, _originalPos, _startingTime, _minWaitingTime, false, vehicle _unit isKindOf "ParachuteBase"] ] call CBA_fnc_addPerFrameHandler; ["medical_onUnconscious", [_unit, true]] call EFUNC(common,globalEvent); diff --git a/addons/medical/functions/fnc_unconsciousPFH.sqf b/addons/medical/functions/fnc_unconsciousPFH.sqf new file mode 100644 index 0000000000..406d0278c1 --- /dev/null +++ b/addons/medical/functions/fnc_unconsciousPFH.sqf @@ -0,0 +1,93 @@ +/* + * Author: Glowbal + * PFH logic for unconscious state + * + * Arguments: + * 0: The unit that will be put in an unconscious state + * + * ReturnValue: + * nil + * + * Public: yes + */ + +#include "script_component.hpp" + +private ["_unit", "_vehicleOfUnit","_minWaitingTime", "_oldAnimation", "_captiveSwitch", "_hasMovedOut", "_parachuteCheck"]; +_args = _this select 0; +_unit = _args select 0; +_oldAnimation = _args select 1; +_originalPos = _args select 2; +_startingTime = _args select 3; +_minWaitingTime = _args select 4; +_hasMovedOut = _args select 5; +_parachuteCheck = _args select 6; + +if (!alive _unit) exitwith { + [_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus); + [_unit, false] call EFUNC(common,disableAI); + //_unit setUnitPos _originalPos; + _unit setUnconscious false; + ["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent); + + [(_this select 1)] call cba_fnc_removePerFrameHandler; +}; + +// In case the unit is no longer in an unconscious state, we are going to check if we can already reset the animation +if !(_unit getvariable ["ACE_isUnconscious",false]) exitwith { + // TODO, handle this with carry instead, so we can remove the PFH here. + // Wait until the unit isn't being carried anymore, so we won't end up with wierd animations + if !(([_unit] call FUNC(isBeingCarried)) || ([_unit] call FUNC(isBeingDragged))) then { + if (vehicle _unit == _unit) then { + if (animationState _unit == "AinjPpneMstpSnonWrflDnon") then { + [_unit,"AinjPpneMstpSnonWrflDnon_rolltofront", 2] call EFUNC(common,doAnimation); + [_unit,"amovppnemstpsnonwnondnon", 1] call EFUNC(common,doAnimation); + } else { + [_unit,"amovppnemstpsnonwnondnon", 2] call EFUNC(common,doAnimation); + }; + } else { + // Switch to the units original animation, assuming + // TODO: what if the unit switched vehicle? + [_unit, _oldAnimation, 2] call EFUNC(common,doAnimation); + }; + ["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent); + // EXIT PFH + [(_this select 1)] call cba_fnc_removePerFrameHandler; + }; + if (!_hasMovedOut) then { + // Reset the unit back to the previous captive state. + [_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus); + + // Swhich the unit back to its original group + //Unconscious units shouldn't be put in another group #527: + // [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); + + [_unit, false] call EFUNC(common,disableAI); + _unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP) + + _unit setUnconscious false; + + // ensure this statement runs only once + _args set [5, true]; + }; +}; + +if (_parachuteCheck) then { + if !(vehicle _unit isKindOf "ParachuteBase") then { + [_unit, [_unit] call EFUNC(common,getDeathAnim), 1, true] call EFUNC(common,doAnimation); + _args set [6, false]; + }; +}; + +if (!local _unit) exitwith { + _args set [ 4, _minWaitingTime - (time - _startingTime)]; + _unit setvariable [QGVAR(unconsciousArguments), _args, true]; + [(_this select 1)] call cba_fnc_removePerFrameHandler; +}; + +// Ensure we are waiting at least a minimum period before checking if we can wake up the unit again, allows for temp knock outs +if ((time - _startingTime) >= _minWaitingTime) exitwith { + if (!([_unit] call FUNC(getUnconsciousCondition))) then { + _unit setvariable ["ACE_isUnconscious", false, true]; + }; +}; From fa7bb5f9c64b51e2c5eb9e0a0598c2ea20334e07 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 21:28:47 +0200 Subject: [PATCH 13/28] Added unconscious state check --- addons/medical/functions/fnc_handleLocal.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical/functions/fnc_handleLocal.sqf b/addons/medical/functions/fnc_handleLocal.sqf index 5a6123d9f7..98b390b51a 100644 --- a/addons/medical/functions/fnc_handleLocal.sqf +++ b/addons/medical/functions/fnc_handleLocal.sqf @@ -23,7 +23,7 @@ if (_local) then { [_unit, true] call FUNC(addToInjuredCollection); }; - if (count (_unit getvariable [QGVAR(unconsciousArguments), []]) >= 7) then { + if ((_unit getvariable ["ACE_isUnconscious",false]) && {count (_unit getvariable [QGVAR(unconsciousArguments), []]) >= 7}) then { private "_arguments"; _arguments = (_unit getvariable [QGVAR(unconsciousArguments), []]); _arguments set [ 3, time]; From 0e858be1b17cdbe1a749887afe567f81bd441c63 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 22:00:07 +0200 Subject: [PATCH 14/28] Changed conditions for body parts are now always true. This way the medical information is always available, and should help a bit with performance as well. --- addons/medical/ACE_Medical_Actions.hpp | 6 ++++++ addons/medical/ACE_Medical_SelfActions.hpp | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/addons/medical/ACE_Medical_Actions.hpp b/addons/medical/ACE_Medical_Actions.hpp index 036dd5e9d9..3acc53cf05 100644 --- a/addons/medical/ACE_Medical_Actions.hpp +++ b/addons/medical/ACE_Medical_Actions.hpp @@ -3,6 +3,7 @@ class ACE_Head { displayName = "$STR_ACE_Interaction_Head"; runOnHover = 1; statement = QUOTE([ARR_3(_target, true, 0)] call DFUNC(displayPatientInformation)); + condition = "true"; EXCEPTIONS icon = PATHTOF(UI\icons\medical_cross.paa); distance = MEDICAL_ACTION_DISTANCE; @@ -74,6 +75,7 @@ class ACE_Torso { displayName = "$STR_ACE_Interaction_Torso"; runOnHover = 1; statement = QUOTE([ARR_3(_target, true, 1)] call DFUNC(displayPatientInformation)); + condition = "true"; EXCEPTIONS icon = PATHTOF(UI\icons\medical_cross.paa); distance = MEDICAL_ACTION_DISTANCE; @@ -173,6 +175,7 @@ class ACE_ArmLeft { displayName = "$STR_ACE_Interaction_ArmLeft"; runOnHover = 1; statement = QUOTE([ARR_3(_target, true, 2)] call DFUNC(displayPatientInformation)); + condition = "true"; EXCEPTIONS icon = PATHTOF(UI\icons\medical_cross.paa); distance = MEDICAL_ACTION_DISTANCE; @@ -329,6 +332,7 @@ class ACE_ArmRight { displayName = "$STR_ACE_Interaction_ArmRight"; runOnHover = 1; statement = QUOTE([ARR_3(_target, true, 3)] call DFUNC(displayPatientInformation)); + condition = "true"; EXCEPTIONS icon = PATHTOF(UI\icons\medical_cross.paa); distance = MEDICAL_ACTION_DISTANCE; @@ -482,6 +486,7 @@ class ACE_LegLeft { displayName = "$STR_ACE_Interaction_LegLeft"; runOnHover = 1; statement = QUOTE([ARR_3(_target, true, 4)] call DFUNC(displayPatientInformation)); + condition = "true"; EXCEPTIONS icon = PATHTOF(UI\icons\medical_cross.paa); distance = MEDICAL_ACTION_DISTANCE; @@ -623,6 +628,7 @@ class ACE_LegRight { displayName = "$STR_ACE_Interaction_LegRight"; runOnHover = 1; statement = QUOTE([ARR_3(_target, true, 5)] call DFUNC(displayPatientInformation)); + condition = "true"; EXCEPTIONS icon = PATHTOF(UI\icons\medical_cross.paa); distance = MEDICAL_ACTION_DISTANCE; diff --git a/addons/medical/ACE_Medical_SelfActions.hpp b/addons/medical/ACE_Medical_SelfActions.hpp index c2a60898f4..e31e99ad01 100644 --- a/addons/medical/ACE_Medical_SelfActions.hpp +++ b/addons/medical/ACE_Medical_SelfActions.hpp @@ -4,6 +4,7 @@ class Medical { hotkey = "M"; exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_3(_target, true, 0)] call DFUNC(displayPatientInformation)); + condition = "true"; icon = PATHTOF(UI\icons\medical_cross.paa); class ACE_Head { @@ -11,6 +12,7 @@ class Medical { icon = PATHTOF(UI\icons\medical_cross.paa); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_3(_target, true, 0)] call DFUNC(displayPatientInformation)); + condition = "true"; runOnHover = 1; class Bandage { @@ -78,6 +80,7 @@ class Medical { runOnHover = 1; exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_3(_target, true, 1)] call DFUNC(displayPatientInformation)); + condition = "true"; showDisabled = 1; priority = 2; hotkey = ""; @@ -146,6 +149,7 @@ class Medical { runOnHover = 1; exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_3(_target, true, 2)] call DFUNC(displayPatientInformation)); + condition = "true"; icon = PATHTOF(UI\icons\medical_cross.paa); class Bandage { @@ -246,6 +250,7 @@ class Medical { runOnHover = 1; exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_3(_target, true, 3)] call DFUNC(displayPatientInformation)); + condition = "true"; icon = PATHTOF(UI\icons\medical_cross.paa); class Bandage { @@ -342,6 +347,7 @@ class Medical { runOnHover = 1; exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_3(_target, true, 4)] call DFUNC(displayPatientInformation)); + condition = "true"; icon = PATHTOF(UI\icons\medical_cross.paa); class Bandage { @@ -427,6 +433,7 @@ class Medical { runOnHover = 1; exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_3(_target, true, 5)] call DFUNC(displayPatientInformation)); + condition = "true"; icon = PATHTOF(UI\icons\medical_cross.paa); class Bandage { From 6d18e484c148aa3e4e783e8ec6b2066e81b98b81 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 22:02:43 +0200 Subject: [PATCH 15/28] Cache condition for target instead of caller --- addons/medical/functions/fnc_canTreatCached.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical/functions/fnc_canTreatCached.sqf b/addons/medical/functions/fnc_canTreatCached.sqf index 34d753b119..b1dfaf7d12 100644 --- a/addons/medical/functions/fnc_canTreatCached.sqf +++ b/addons/medical/functions/fnc_canTreatCached.sqf @@ -19,4 +19,4 @@ #define MAX_DURATION_CACHE 2 // parameters, function, namespace, uid -[_this, DFUNC(canTreat), _this select 0, format[QGVAR(canTreat_%1_%2), _this select 2, _this select 3], MAX_DURATION_CACHE, "clearConditionCaches"] call EFUNC(common,cachedCall); +[_this, DFUNC(canTreat), _this select 1, format[QGVAR(canTreat_%1_%2), _this select 2, _this select 3], MAX_DURATION_CACHE, "clearConditionCaches"] call EFUNC(common,cachedCall); From f5effca21636f18ebbcaef1f48bbb5eac9d7f6b1 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 22:21:15 +0200 Subject: [PATCH 16/28] fixed handleDamage basic --- addons/medical/functions/fnc_handleDamage.sqf | 6 ------ addons/medical/functions/fnc_handleDamage_basic.sqf | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index 876feae637..1632a8f55b 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -36,12 +36,6 @@ if !(_selection in (GVAR(SELECTIONS) + [""])) exitWith {0}; _damageReturn = _damage; if (GVAR(level) < 2) then { - if ([_unit] call EFUNC(common,isPlayer)) then { - _this set [2, _damage / (GVAR(playerDamageThreshold) max 0.01)]; - } else { - _this set [2, _damage / (GVAR(AIDamageThreshold) max 0.01)]; - }; - _damageReturn = _this call FUNC(handleDamage_basic); }; diff --git a/addons/medical/functions/fnc_handleDamage_basic.sqf b/addons/medical/functions/fnc_handleDamage_basic.sqf index aa9c2f61df..6e343b127a 100644 --- a/addons/medical/functions/fnc_handleDamage_basic.sqf +++ b/addons/medical/functions/fnc_handleDamage_basic.sqf @@ -63,6 +63,12 @@ if (_selectionName in GVAR(SELECTIONS)) then { _newDamage = _damage - (_unit getHitPointDamage (GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selectionName))); }; +if ([_unit] call EFUNC(common,isPlayer)) then { + _newDamage = _newDamage / (GVAR(playerDamageThreshold) max 0.01); +} else { + _newDamage = _newDamage / (GVAR(AIDamageThreshold) max 0.01); +}; + _damage = _damage - _newDamage; From 9670267d2001cf7bd8aeb61f65546d250a2e3f63 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 22:21:54 +0200 Subject: [PATCH 17/28] Fixed wrong classnames for IV treatments --- addons/medical/ACE_Medical_Actions.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/medical/ACE_Medical_Actions.hpp b/addons/medical/ACE_Medical_Actions.hpp index 3acc53cf05..ed5670f814 100644 --- a/addons/medical/ACE_Medical_Actions.hpp +++ b/addons/medical/ACE_Medical_Actions.hpp @@ -427,8 +427,8 @@ class ACE_ArmRight { }; class PlasmaIV: BloodIV { displayName = "$STR_ACE_MEDICAL_ACTIONS_Plasma4_1000"; - condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'BloodIV')] call DFUNC(canTreatCached)); - statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'BloodIV')] call DFUNC(treatment)); + condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'PlasmaIV')] call DFUNC(canTreatCached)); + statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'PlasmaIV')] call DFUNC(treatment)); EXCEPTIONS }; class PlasmaIV_500: PlasmaIV { @@ -583,8 +583,8 @@ class ACE_LegLeft { }; class PlasmaIV: BloodIV { displayName = "$STR_ACE_MEDICAL_ACTIONS_Plasma4_1000"; - condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'BloodIV')] call DFUNC(canTreatCached)); - statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'BloodIV')] call DFUNC(treatment)); + condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'PlasmaIV')] call DFUNC(canTreatCached)); + statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'PlasmaIV')] call DFUNC(treatment)); EXCEPTIONS }; class PlasmaIV_500: PlasmaIV { @@ -724,8 +724,8 @@ class ACE_LegRight { }; class PlasmaIV: BloodIV { displayName = "$STR_ACE_MEDICAL_ACTIONS_Plasma4_1000"; - condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'BloodIV')] call DFUNC(canTreatCached)); - statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'BloodIV')] call DFUNC(treatment)); + condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'PlasmaIV')] call DFUNC(canTreatCached)); + statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'PlasmaIV')] call DFUNC(treatment)); EXCEPTIONS }; class PlasmaIV_500: PlasmaIV { From cbc3584f9d6624f8e4bba525c0632d98b0d57e04 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 22:24:42 +0200 Subject: [PATCH 18/28] removed duplicate condition attribute --- addons/medical/ACE_Medical_SelfActions.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/medical/ACE_Medical_SelfActions.hpp b/addons/medical/ACE_Medical_SelfActions.hpp index e31e99ad01..9c79503f3d 100644 --- a/addons/medical/ACE_Medical_SelfActions.hpp +++ b/addons/medical/ACE_Medical_SelfActions.hpp @@ -80,7 +80,6 @@ class Medical { runOnHover = 1; exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_3(_target, true, 1)] call DFUNC(displayPatientInformation)); - condition = "true"; showDisabled = 1; priority = 2; hotkey = ""; From bc4d102d0890023f59bfea846bc4cdc85651f92b Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 22:43:31 +0200 Subject: [PATCH 19/28] changed variable initialization - everything is now done local --- addons/medical/XEH_init.sqf | 5 +-- addons/medical/XEH_respawn.sqf | 3 +- addons/medical/functions/fnc_init.sqf | 49 ++++++++++++++------------- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/addons/medical/XEH_init.sqf b/addons/medical/XEH_init.sqf index 2f840fe950..f3fb2b1e93 100644 --- a/addons/medical/XEH_init.sqf +++ b/addons/medical/XEH_init.sqf @@ -4,7 +4,4 @@ private ["_unit"]; _unit = _this select 0; _unit addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]; - -if (local _unit) then { - [_unit] call FUNC(init); -}; +[_unit] call FUNC(init); diff --git a/addons/medical/XEH_respawn.sqf b/addons/medical/XEH_respawn.sqf index b2101b1d4e..5047f0026c 100644 --- a/addons/medical/XEH_respawn.sqf +++ b/addons/medical/XEH_respawn.sqf @@ -6,8 +6,7 @@ _unit = _this select 0; if !(local _unit) exitWith {}; -diag_log "running respawn"; -[_unit] call FUNC(init); +[_unit, true] call FUNC(init); //Reset captive status for respawning unit if (!(_unit getVariable ["ACE_isUnconscious", false])) then { diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf index fa6aa357c2..0147b99204 100644 --- a/addons/medical/functions/fnc_init.sqf +++ b/addons/medical/functions/fnc_init.sqf @@ -13,21 +13,24 @@ #include "script_component.hpp" -private ["_unit", "_allUsedMedication", "_logs"]; +private ["_unit", "_allUsedMedication", "_logs", "_forceNew"]; _unit = _this select 0; +_forceNew = if (count _this > 1) then {_this select 1} else {false}; -_unit setVariable [QGVAR(pain), 0, true]; -_unit setVariable [QGVAR(morphine), 0, true]; -_unit setVariable [QGVAR(bloodVolume), 100, true]; +if (!(isnil {_unit getvariable QGVAR(triageLevel)}) && !_forceNew) exitwith {}; + +_unit setVariable [QGVAR(pain), 0]; +_unit setVariable [QGVAR(morphine), 0]; +_unit setVariable [QGVAR(bloodVolume), 100]; // tourniquets -_unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; +_unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; // wounds and injuries -_unit setvariable [QGVAR(openWounds), [], true]; -_unit setvariable [QGVAR(bandagedWounds), [], true]; -_unit setVariable [QGVAR(internalWounds), [], true]; +_unit setvariable [QGVAR(openWounds), []]; +_unit setvariable [QGVAR(bandagedWounds), []]; +_unit setVariable [QGVAR(internalWounds), []]; _unit setvariable [QGVAR(lastUniqueWoundID), 1]; // vitals @@ -40,8 +43,8 @@ _unit setVariable [QGVAR(peripheralResistance), 100]; _unit setVariable [QGVAR(fractures), []]; // triage card and logs -_unit setvariable [QGVAR(triageLevel), 0, true]; -_unit setvariable [QGVAR(triageCard), [], true]; +_unit setvariable [QGVAR(triageLevel), 0]; +_unit setvariable [QGVAR(triageCard), []]; // IVs _unit setVariable [QGVAR(salineIVVolume), 0]; @@ -49,21 +52,21 @@ _unit setVariable [QGVAR(plasmaIVVolume), 0]; _unit setVariable [QGVAR(bloodIVVolume), 0]; // damage storage -_unit setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true]; +_unit setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; // airway -_unit setvariable [QGVAR(airwayStatus), 100, true]; -_unit setVariable [QGVAR(airwayOccluded), false, true]; -_unit setvariable [QGVAR(airwayCollapsed), false, true]; +_unit setvariable [QGVAR(airwayStatus), 100]; +_unit setVariable [QGVAR(airwayOccluded), false]; +_unit setvariable [QGVAR(airwayCollapsed), false]; // generic medical admin -_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(isBleeding), false, true]; -_unit setvariable [QGVAR(hasPain), false, true]; -_unit setvariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives), true]; +_unit setvariable [QGVAR(addedToUnitLoop), false]; +_unit setvariable [QGVAR(inCardiacArrest), false]; +_unit setVariable ["ACE_isUnconscious", false]; +_unit setvariable [QGVAR(hasLostBlood), false]; +_unit setvariable [QGVAR(isBleeding), false]; +_unit setvariable [QGVAR(hasPain), false]; +_unit setvariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives)]; // medication _allUsedMedication = _unit getVariable [QGVAR(allUsedMedication), []]; @@ -74,9 +77,9 @@ _unit setVariable [QGVAR(allUsedMedication), []]; _logs = _unit getvariable [QGVAR(allLogs), []]; { - _unit setvariable [_x, nil, true]; + _unit setvariable [_x, nil]; } foreach _logs; -_unit setvariable [QGVAR(allLogs), [], true]; +_unit setvariable [QGVAR(allLogs), []]; // items [{ From d1a09ae7fc1429fe5d69d5d797110395b3aa51ea Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 17 Apr 2015 23:15:41 +0200 Subject: [PATCH 20/28] fixed vehicle crashes for adv --- addons/medical/functions/fnc_handleDamage.sqf | 6 ++++++ addons/medical/functions/fnc_handleDamage_advanced.sqf | 2 ++ addons/medical/functions/fnc_handleDamage_caching.sqf | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index 1632a8f55b..c13818bbcd 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -57,6 +57,12 @@ if (GVAR(level) >= 2) 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 ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)} && {_selection in ["", "head", "body"]}) then { if ([_unit] call FUNC(setDead)) then { _damageReturn = 1; diff --git a/addons/medical/functions/fnc_handleDamage_advanced.sqf b/addons/medical/functions/fnc_handleDamage_advanced.sqf index ba0eb8af24..8bd0267d3f 100644 --- a/addons/medical/functions/fnc_handleDamage_advanced.sqf +++ b/addons/medical/functions/fnc_handleDamage_advanced.sqf @@ -33,10 +33,12 @@ if (isNull _sourceOfDamage && {_typeOfProjectile == ""} && {vehicle _unit == _un }; _typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage); _part = [_selectionName] call FUNC(selectionNameToNumber); +if (_part < 0) exitwith {}; _hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; // Sorting out the damage _damageBodyParts = _unit getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; + _damageBodyParts set [_part, (_damageBodyParts select _part) + _newDamage]; _unit setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; diff --git a/addons/medical/functions/fnc_handleDamage_caching.sqf b/addons/medical/functions/fnc_handleDamage_caching.sqf index 98b2373c74..95d750843d 100644 --- a/addons/medical/functions/fnc_handleDamage_caching.sqf +++ b/addons/medical/functions/fnc_handleDamage_caching.sqf @@ -38,7 +38,7 @@ if (_selectionName in _hitSelections) then { // Check for vehicle crash if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _source} && {_projectile == ""} && {_selectionName == ""}) then { - if (missionNamespace getvariable [QGVAR(allowVehicleCrashDamage), true]) then { + if (GVAR(enableVehicleCrashes)) then { _selectionName = _hitSelections select (floor(random(count _hitSelections))); _projectile = "vehiclecrash"; }; From 22456a4301f89e45f1c4734f45922b3bd0ecd1e0 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sat, 18 Apr 2015 19:49:29 +0200 Subject: [PATCH 21/28] use pain instead --- addons/medical/functions/fnc_init.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf index 0147b99204..a9e3625c2b 100644 --- a/addons/medical/functions/fnc_init.sqf +++ b/addons/medical/functions/fnc_init.sqf @@ -18,7 +18,7 @@ private ["_unit", "_allUsedMedication", "_logs", "_forceNew"]; _unit = _this select 0; _forceNew = if (count _this > 1) then {_this select 1} else {false}; -if (!(isnil {_unit getvariable QGVAR(triageLevel)}) && !_forceNew) exitwith {}; +if (!(isnil {_unit getvariable QGVAR(pain)}) && !_forceNew) exitwith {}; _unit setVariable [QGVAR(pain), 0]; _unit setVariable [QGVAR(morphine), 0]; From 8a7b3a1b334de2ee6108d63865c47ff6ec7e44e9 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 19 Apr 2015 13:08:28 +0200 Subject: [PATCH 22/28] Removed damage thresholds from basic medical --- addons/medical/functions/fnc_handleDamage_basic.sqf | 6 ------ 1 file changed, 6 deletions(-) diff --git a/addons/medical/functions/fnc_handleDamage_basic.sqf b/addons/medical/functions/fnc_handleDamage_basic.sqf index 6e343b127a..aa9c2f61df 100644 --- a/addons/medical/functions/fnc_handleDamage_basic.sqf +++ b/addons/medical/functions/fnc_handleDamage_basic.sqf @@ -63,12 +63,6 @@ if (_selectionName in GVAR(SELECTIONS)) then { _newDamage = _damage - (_unit getHitPointDamage (GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selectionName))); }; -if ([_unit] call EFUNC(common,isPlayer)) then { - _newDamage = _newDamage / (GVAR(playerDamageThreshold) max 0.01); -} else { - _newDamage = _newDamage / (GVAR(AIDamageThreshold) max 0.01); -}; - _damage = _damage - _newDamage; From f6bbeb6bd6778977aa66983845b096e84c390f76 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 19 Apr 2015 17:28:47 +0200 Subject: [PATCH 23/28] switched back to old init method --- addons/medical/XEH_init.sqf | 5 ++- addons/medical/XEH_respawn.sqf | 2 +- addons/medical/functions/fnc_init.sqf | 51 +++++++++++++-------------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/addons/medical/XEH_init.sqf b/addons/medical/XEH_init.sqf index f3fb2b1e93..0ded7d471f 100644 --- a/addons/medical/XEH_init.sqf +++ b/addons/medical/XEH_init.sqf @@ -4,4 +4,7 @@ private ["_unit"]; _unit = _this select 0; _unit addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]; -[_unit] call FUNC(init); + +if (local _unit) then { + [_unit] call FUNC(init); +}; diff --git a/addons/medical/XEH_respawn.sqf b/addons/medical/XEH_respawn.sqf index 5047f0026c..ac6cc2d6ef 100644 --- a/addons/medical/XEH_respawn.sqf +++ b/addons/medical/XEH_respawn.sqf @@ -6,7 +6,7 @@ _unit = _this select 0; if !(local _unit) exitWith {}; -[_unit, true] call FUNC(init); +[_unit] call FUNC(init); //Reset captive status for respawning unit if (!(_unit getVariable ["ACE_isUnconscious", false])) then { diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf index a9e3625c2b..d01a63b3a5 100644 --- a/addons/medical/functions/fnc_init.sqf +++ b/addons/medical/functions/fnc_init.sqf @@ -16,22 +16,19 @@ private ["_unit", "_allUsedMedication", "_logs", "_forceNew"]; _unit = _this select 0; -_forceNew = if (count _this > 1) then {_this select 1} else {false}; -if (!(isnil {_unit getvariable QGVAR(pain)}) && !_forceNew) exitwith {}; - -_unit setVariable [QGVAR(pain), 0]; -_unit setVariable [QGVAR(morphine), 0]; -_unit setVariable [QGVAR(bloodVolume), 100]; +_unit setVariable [QGVAR(pain), 0, true]; +_unit setVariable [QGVAR(morphine), 0, true]; +_unit setVariable [QGVAR(bloodVolume), 100, true]; // tourniquets -_unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; +_unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; // wounds and injuries -_unit setvariable [QGVAR(openWounds), []]; -_unit setvariable [QGVAR(bandagedWounds), []]; -_unit setVariable [QGVAR(internalWounds), []]; -_unit setvariable [QGVAR(lastUniqueWoundID), 1]; +_unit setvariable [QGVAR(openWounds), [], true]; +_unit setvariable [QGVAR(bandagedWounds), [], true]; +_unit setVariable [QGVAR(internalWounds), [], true]; +_unit setvariable [QGVAR(lastUniqueWoundID), 1, true]; // vitals _unit setVariable [QGVAR(heartRate), 80]; @@ -40,19 +37,19 @@ _unit setvariable [QGVAR(bloodPressure), [80, 120]]; _unit setVariable [QGVAR(peripheralResistance), 100]; // fractures -_unit setVariable [QGVAR(fractures), []]; +_unit setVariable [QGVAR(fractures), [], true]; // triage card and logs -_unit setvariable [QGVAR(triageLevel), 0]; -_unit setvariable [QGVAR(triageCard), []]; +_unit setvariable [QGVAR(triageLevel), 0, true]; +_unit setvariable [QGVAR(triageCard), [], true]; // IVs -_unit setVariable [QGVAR(salineIVVolume), 0]; -_unit setVariable [QGVAR(plasmaIVVolume), 0]; -_unit setVariable [QGVAR(bloodIVVolume), 0]; +_unit setVariable [QGVAR(salineIVVolume), 0, true]; +_unit setVariable [QGVAR(plasmaIVVolume), 0, true]; +_unit setVariable [QGVAR(bloodIVVolume), 0, true]; // damage storage -_unit setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; +_unit setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true]; // airway _unit setvariable [QGVAR(airwayStatus), 100]; @@ -60,26 +57,26 @@ _unit setVariable [QGVAR(airwayOccluded), false]; _unit setvariable [QGVAR(airwayCollapsed), false]; // generic medical admin -_unit setvariable [QGVAR(addedToUnitLoop), false]; -_unit setvariable [QGVAR(inCardiacArrest), false]; -_unit setVariable ["ACE_isUnconscious", false]; -_unit setvariable [QGVAR(hasLostBlood), false]; -_unit setvariable [QGVAR(isBleeding), false]; -_unit setvariable [QGVAR(hasPain), false]; -_unit setvariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives)]; +_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(isBleeding), false, true]; +_unit setvariable [QGVAR(hasPain), false, true]; +_unit setvariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives), true]; // medication _allUsedMedication = _unit getVariable [QGVAR(allUsedMedication), []]; { _unit setvariable [_x select 0, nil]; } foreach _allUsedMedication; -_unit setVariable [QGVAR(allUsedMedication), []]; +_unit setVariable [QGVAR(allUsedMedication), [], true]; _logs = _unit getvariable [QGVAR(allLogs), []]; { _unit setvariable [_x, nil]; } foreach _logs; -_unit setvariable [QGVAR(allLogs), []]; +_unit setvariable [QGVAR(allLogs), [], true]; // items [{ From 17899db086726ce830e79abd4f3a363e512f53c1 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 19 Apr 2015 19:49:56 +0200 Subject: [PATCH 24/28] added some missing privates --- addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf index 02626ff1fe..29bc6dc4d3 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf @@ -15,7 +15,7 @@ #include "script_component.hpp" -private ["_target", "_bandage", "_part", "_selectionName", "_openWounds", "_config", "_effectiveness","_mostEffectiveInjury", "_mostEffectiveSpot", "_woundEffectivenss", "_mostEffectiveInjury", "_impact", "_exit"]; +private ["_target", "_bandage", "_part", "_selectionName", "_openWounds", "_config", "_effectiveness","_mostEffectiveInjury", "_mostEffectiveSpot", "_woundEffectivenss", "_mostEffectiveInjury", "_impact", "_exit", "_specificClass", "_classID", "_effectivenessFound"]; _target = _this select 0; _bandage = _this select 1; _selectionName = _this select 2; From 8be7ccaab7989b717b6559f87816d59c71428a0e Mon Sep 17 00:00:00 2001 From: Glowbal Date: Mon, 20 Apr 2015 21:37:30 +0200 Subject: [PATCH 25/28] setting for moving unit from group on unconscious --- addons/medical/ACE_Settings.hpp | 10 +++++++--- addons/medical/functions/fnc_setUnconscious.sqf | 4 +++- addons/medical/functions/fnc_unconsciousPFH.sqf | 8 ++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index 0270bee89b..e7f60a14e8 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -79,16 +79,16 @@ class ACE_Settings { displayName = "$STR_ACE_Medical_litterSimulationDetail"; description = "$STR_ACE_Medical_litterSimulationDetail_Desc"; typeName = "SCALAR"; - + value = 3; values[] = {"Off", "Low", "Medium", "High", "Ultra"}; _values[] = { 0, 50, 100, 1000, 5000 }; - + isClientSettable = 1; }; class GVAR(litterCleanUpDelay) { typeName = "SCALAR"; - value = 0; + value = 0; }; class GVAR(medicSetting_PAK) { typeName = "SCALAR"; @@ -139,4 +139,8 @@ class ACE_Settings { typeName = "BOOL"; value = 0; }; + class GVAR(moveUnitsFromGroupOnUnconscious) { + typeName = "BOOL"; + value = 0; + }; }; diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index ef9ccb246d..e527215c51 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -73,7 +73,9 @@ _unit setUnitPos "DOWN"; // So the AI does not get stuck, we are moving the unit to a temp group on its own. //Unconscious units shouldn't be put in another group #527: -// [_unit, true, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); +if (GVAR(moveUnitsFromGroupOnUnconscious)) then { + [_unit, true, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); +}; [_unit, QGVAR(unconscious), true] call EFUNC(common,setCaptivityStatus); [_unit, [_unit] call EFUNC(common,getDeathAnim), 1, true] call EFUNC(common,doAnimation); diff --git a/addons/medical/functions/fnc_unconsciousPFH.sqf b/addons/medical/functions/fnc_unconsciousPFH.sqf index 406d0278c1..1d7558e5fc 100644 --- a/addons/medical/functions/fnc_unconsciousPFH.sqf +++ b/addons/medical/functions/fnc_unconsciousPFH.sqf @@ -24,6 +24,9 @@ _hasMovedOut = _args select 5; _parachuteCheck = _args select 6; if (!alive _unit) exitwith { + if (GVAR(moveUnitsFromGroupOnUnconscious)) then { + [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); + }; [_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus); [_unit, false] call EFUNC(common,disableAI); //_unit setUnitPos _originalPos; @@ -60,8 +63,9 @@ if !(_unit getvariable ["ACE_isUnconscious",false]) exitwith { // Swhich the unit back to its original group //Unconscious units shouldn't be put in another group #527: - // [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); - + if (GVAR(moveUnitsFromGroupOnUnconscious)) then { + [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); + }; [_unit, false] call EFUNC(common,disableAI); _unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP) From 90cf882e026fd310000b9598963c15dcf23ab8d1 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Mon, 20 Apr 2015 21:58:27 +0200 Subject: [PATCH 26/28] Using setvar instead of event sync again --- addons/medical/script_component.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical/script_component.hpp b/addons/medical/script_component.hpp index bac6744bc1..939a811a41 100644 --- a/addons/medical/script_component.hpp +++ b/addons/medical/script_component.hpp @@ -11,4 +11,4 @@ #include "\z\ace\addons\main\script_macros.hpp" -#define USE_WOUND_EVENT_SYNC true +#define USE_WOUND_EVENT_SYNC false From 842bfe0b98360874e1c78354f469045549b19789 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Mon, 20 Apr 2015 22:00:11 +0200 Subject: [PATCH 27/28] enabled advanced wounds setting --- .../medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf index 29bc6dc4d3..2884503599 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf @@ -92,8 +92,7 @@ if (USE_WOUND_EVENT_SYNC) then { }; // Handle the reopening of bandaged wounds if (_impact > 0 && {GVAR(enableAdvancedWounds)}) then { -// TODO temp disabled until bandaged wounds are supported by event sync. -// [_target, _impact, _part, _mostEffectiveSpot, _mostEffectiveInjury, _bandage] call FUNC(handleBandageOpening); + [_target, _impact, _part, _mostEffectiveSpot, _mostEffectiveInjury, _bandage] call FUNC(handleBandageOpening); }; // If all wounds have been bandaged, we will reset all damage to 0, so the unit is not showing any blood on the model anymore. From f7719f0e0ae7a8564881dba89ae7022a5cc4520c Mon Sep 17 00:00:00 2001 From: Glowbal Date: Mon, 20 Apr 2015 22:08:31 +0200 Subject: [PATCH 28/28] tab --- addons/medical/functions/fnc_actionLoadUnit.sqf | 4 ++-- addons/medical/functions/fnc_handleLocal.sqf | 10 +++++----- addons/medical/functions/fnc_treatment_failure.sqf | 4 ++-- addons/medical/functions/fnc_treatment_success.sqf | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/medical/functions/fnc_actionLoadUnit.sqf b/addons/medical/functions/fnc_actionLoadUnit.sqf index 5606f15d19..990467521a 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 FUNC(dropObject_carry); }; if ([_target] call FUNC(isBeingDragged)) then { - [_caller, _target] call FUNC(dropObject); + [_caller, _target] call FUNC(dropObject); }; _vehicle = [_caller, _target] call EFUNC(common,loadPerson); diff --git a/addons/medical/functions/fnc_handleLocal.sqf b/addons/medical/functions/fnc_handleLocal.sqf index 98b390b51a..f79c1c3a6d 100644 --- a/addons/medical/functions/fnc_handleLocal.sqf +++ b/addons/medical/functions/fnc_handleLocal.sqf @@ -24,12 +24,12 @@ if (_local) then { }; if ((_unit getvariable ["ACE_isUnconscious",false]) && {count (_unit getvariable [QGVAR(unconsciousArguments), []]) >= 7}) then { - private "_arguments"; - _arguments = (_unit getvariable [QGVAR(unconsciousArguments), []]); - _arguments set [ 3, time]; + private "_arguments"; + _arguments = (_unit getvariable [QGVAR(unconsciousArguments), []]); + _arguments set [ 3, time]; - [DFUNC(unconsciousPFH), 0.1, _arguments ] call CBA_fnc_addPerFrameHandler; + [DFUNC(unconsciousPFH), 0.1, _arguments ] call CBA_fnc_addPerFrameHandler; - _unit setvariable [QGVAR(unconsciousArguments), nil, true]; + _unit setvariable [QGVAR(unconsciousArguments), nil, true]; }; }; diff --git a/addons/medical/functions/fnc_treatment_failure.sqf b/addons/medical/functions/fnc_treatment_failure.sqf index fe8bafb0c7..33712956a0 100644 --- a/addons/medical/functions/fnc_treatment_failure.sqf +++ b/addons/medical/functions/fnc_treatment_failure.sqf @@ -36,9 +36,9 @@ _caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; _weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnTreatment), ""]); if (_weaponSelect != "") then { - _caller selectWeapon _weaponSelect; + _caller selectWeapon _weaponSelect; } else { - _caller action ["SwitchWeapon", _caller, _caller, 99]; + _caller action ["SwitchWeapon", _caller, _caller, 99]; }; { diff --git a/addons/medical/functions/fnc_treatment_success.sqf b/addons/medical/functions/fnc_treatment_success.sqf index 6822f674c7..66406a180a 100644 --- a/addons/medical/functions/fnc_treatment_success.sqf +++ b/addons/medical/functions/fnc_treatment_success.sqf @@ -34,9 +34,9 @@ _caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; _weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnTreatment), ""]); if (_weaponSelect != "") then { - _caller selectWeapon _weaponSelect; + _caller selectWeapon _weaponSelect; } else { - _caller action ["SwitchWeapon", _caller, _caller, 99]; + _caller action ["SwitchWeapon", _caller, _caller, 99]; }; // Record specific callback