diff --git a/addons/circulation/functions/fnc_updateHeartRate.sqf b/addons/circulation/functions/fnc_updateHeartRate.sqf index 6a8a75579..4302dd0fe 100644 --- a/addons/circulation/functions/fnc_updateHeartRate.sqf +++ b/addons/circulation/functions/fnc_updateHeartRate.sqf @@ -39,13 +39,9 @@ if IN_CRDC_ARRST(_unit) then { private _meanBP = (2/3) * _bloodPressureH + (1/3) * _bloodPressureL; private _painLevel = GET_PAIN_PERCEIVED(_unit); - private _targetBP = 107; - if (_bloodVolume < BLOOD_VOLUME_CLASS_2_HEMORRHAGE) then { - _targetBP = _targetBP * (_bloodVolume / DEFAULT_BLOOD_VOLUME); - }; - _targetHR = DEFAULT_HEART_RATE; if (_bloodVolume < BLOOD_VOLUME_CLASS_3_HEMORRHAGE) then { + private _targetBP = 107 * (_bloodVolume / DEFAULT_BLOOD_VOLUME); _targetHR = _heartRate * (_targetBP / (45 max _meanBP)); }; if (_painLevel > 0.2) then { diff --git a/addons/gui/functions/fnc_menuPFH.sqf b/addons/gui/functions/fnc_menuPFH.sqf index e469fa9fe..ee3949318 100644 --- a/addons/gui/functions/fnc_menuPFH.sqf +++ b/addons/gui/functions/fnc_menuPFH.sqf @@ -24,6 +24,7 @@ if !( closeDialog 0; // Show hint if distance condition failed if ((ACE_player distance ACEGVAR(medical_gui,target) > ACEGVAR(medical_gui,maxDistance)) && {vehicle ACE_player != vehicle ACEGVAR(medical_gui,target)}) then { + if (((getPosATL ACEGVAR(medical_gui,target)) # 2) < -9) exitWith {}; // handle dragging corpse/clone [[ACELSTRING(medical,DistanceToFar), ACEGVAR(medical_gui,target) call ACEFUNC(common,getName)], 2] call ACEFUNC(common,displayTextStructured); }; }; @@ -62,4 +63,4 @@ private _quickView = ACEGVAR(medical_gui,target) getVariable [MED_LOG_VARNAME("q [_ctrlQuickView, _quickView] call ACEFUNC(medical_gui,updateLogList); // Update triage status -[_display, ACEGVAR(medical_gui,target)] call ACEFUNC(medical_gui,updateTriageStatus); \ No newline at end of file +[_display, ACEGVAR(medical_gui,target)] call ACEFUNC(medical_gui,updateTriageStatus); diff --git a/addons/misc/functions/fnc_canCheckDogtag.sqf b/addons/misc/functions/fnc_canCheckDogtag.sqf index b05f43fe5..fd3d9dd17 100644 --- a/addons/misc/functions/fnc_canCheckDogtag.sqf +++ b/addons/misc/functions/fnc_canCheckDogtag.sqf @@ -20,6 +20,7 @@ params ["", "_target"]; if (isNull _target) exitWith {false}; -// check if disabled for faction -if ([ACEGVAR(dogtags,disabledFactions) getVariable faction _target] param [0, false]) exitWith {false}; -true +// Check if disabled for faction +if ((faction _target) in ACEGVAR(dogtags,disabledFactions)) exitWith {false}; + +!(_target call EFUNC(common,isAwake)) diff --git a/addons/misc/functions/fnc_carryObject.sqf b/addons/misc/functions/fnc_carryObject.sqf index d76d38b90..b6a2a0b30 100644 --- a/addons/misc/functions/fnc_carryObject.sqf +++ b/addons/misc/functions/fnc_carryObject.sqf @@ -20,6 +20,12 @@ params ["_unit", "_target"]; TRACE_2("params",_unit,_target); +// If in ViV cargo, unload it first +// Warn user if it failed to unload (shouldn't happen) +if (!isNull isVehicleCargo _target && {!(objNull setVehicleCargo _target)}) then { + WARNING_1("ViV Unload Failed %1",_target); +}; + // Get attachTo offset and direction private _position = _target getVariable [QACEGVAR(dragging,carryPosition), [0, 0, 0]]; private _direction = _target getVariable [QACEGVAR(dragging,carryDirection), 0]; @@ -47,9 +53,6 @@ if (_target isKindOf "CAManBase") then { [QACEGVAR(common,setDir), [_target, _direction], _target] call CBA_fnc_targetEvent; -_unit setVariable [QACEGVAR(dragging,isCarrying), true, true]; -_unit setVariable [QACEGVAR(dragging,carriedObject), _target, true]; - // Add drop action _unit setVariable [QACEGVAR(dragging,releaseActionID), [ _unit, "DefaultAction", @@ -60,19 +63,18 @@ _unit setVariable [QACEGVAR(dragging,releaseActionID), [ // Add anim changed EH [_unit, "AnimChanged", ACEFUNC(dragging,handleAnimChanged), [_unit]] call CBA_fnc_addBISEventHandler; -// Check everything -[ACEFUNC(dragging,carryObjectPFH), 0.5, [_unit, _target, CBA_missionTime]] call CBA_fnc_addPerFrameHandler; - -// Reset current dragging height -ACEGVAR(dragging,currentHeightChange) = 0; - // Prevent UAVs from firing private _UAVCrew = _target call ACEFUNC(common,getVehicleUAVCrew); if (_UAVCrew isNotEqualTo []) then { { - _target deleteVehicleCrew _x; + [_x, true] call ACEFUNC(common,disableAiUAV); } forEach _UAVCrew; - _target setVariable [QACEGVAR(dragging,isUAV), true, true]; + _target setVariable [QACEGVAR(dragging,isUAV), _UAVCrew, true]; }; + +// Check everything +[ACEFUNC(cdragging,carryObjectPFH), 0.5, [_unit, _target, CBA_missionTime]] call CBA_fnc_addPerFrameHandler; + +[QACEGVAR(dragging,startedCarry), [_unit, _target]] call CBA_fnc_localEvent; diff --git a/addons/misc/functions/fnc_treatment.sqf b/addons/misc/functions/fnc_treatment.sqf index dd3a927cb..8fb36e982 100644 --- a/addons/misc/functions/fnc_treatment.sqf +++ b/addons/misc/functions/fnc_treatment.sqf @@ -97,7 +97,7 @@ if (_medic isNotEqualTo player || {!_isInZeus}) then { }; // Determine the animation length - private _animDuration = ACEGVAR(medical_treatment,animDurations) getVariable _medicAnim; + private _animDuration = ACEGVAR(medical_treatment,animDurations) get toLowerANSI _medicAnim; if (isNil "_animDuration") then { WARNING_2("animation [%1] for [%2] has no duration defined",_medicAnim,_classname); _animDuration = 10; diff --git a/addons/misc/functions/fnc_updateDamageEffects.sqf b/addons/misc/functions/fnc_updateDamageEffects.sqf index 8459acf35..a7aac87ee 100644 --- a/addons/misc/functions/fnc_updateDamageEffects.sqf +++ b/addons/misc/functions/fnc_updateDamageEffects.sqf @@ -71,7 +71,7 @@ if (!_isLimping && {ACEGVAR(medical,limping) > 0}) then { (_xAmountOf > 0) && {_xDamage > LIMPING_DAMAGE_THRESHOLD_DEFAULT} // select _causeLimping from woundDetails - && {(ACEGVAR(medical_damage,woundDetails) get (_xClassID / 10)) select 3} + && {(ACEGVAR(medical_damage,woundDetails) get (floor (_xClassID / 10))) select 3} ) exitWith { TRACE_1("limping because of wound",_x); _isLimping = true; diff --git a/addons/misc/functions/fnc_useItem.sqf b/addons/misc/functions/fnc_useItem.sqf index 05dd798e3..74abae626 100644 --- a/addons/misc/functions/fnc_useItem.sqf +++ b/addons/misc/functions/fnc_useItem.sqf @@ -70,20 +70,22 @@ if (GVAR(allowSharedVehicleEquipment) > 0 && _vehicleCondition) then { { private _origin = _x; - if(_forEachIndex != _vehicleIndex) then { // Remove unit item + if (_forEachIndex != _vehicleIndex) then { // Remove unit item private _originItems = [_origin, 0] call ACEFUNC(common,uniqueItems); // Item { if (_x in _originItems) then { _origin removeItem _x; - [_origin, _x] breakOut "Main"; + [_origin, _x, true] breakOut "Main"; }; } forEach _items; _originItems = [_origin, 2] call ACEFUNC(common,uniqueItems); // Magazine { if (_x in _originItems) then { + private _magsStart = count magazines _unit; [_origin, _x] call ACEFUNC(common,adjustMagazineAmmo); - [_origin, _x] breakOut "Main"; + private _magsEnd = count magazines _unit; + [_unit, _x, (_magsEnd < _magsStart)] breakOut "Main"; }; } forEach _items; } else { // Remove vehicle item @@ -91,7 +93,7 @@ if (GVAR(allowSharedVehicleEquipment) > 0 && _vehicleCondition) then { { if (_x in _originItems) then { _origin addItemCargoGlobal [_x, -1]; - [_origin, _x] breakOut "Main"; + [_origin, _x, false] breakOut "Main"; }; } forEach _items; @@ -99,7 +101,7 @@ if (GVAR(allowSharedVehicleEquipment) > 0 && _vehicleCondition) then { { if (_x in _originItems) then { [_origin, _x] call ACEFUNC(common,adjustMagazineAmmo); - [_origin, _x] breakOut "Main"; + [_origin, _x, false] breakOut "Main"; }; } forEach _items; }; diff --git a/addons/pharma/functions/fnc_medicationLocal.sqf b/addons/pharma/functions/fnc_medicationLocal.sqf index a56be5e26..6d78425ae 100644 --- a/addons/pharma/functions/fnc_medicationLocal.sqf +++ b/addons/pharma/functions/fnc_medicationLocal.sqf @@ -20,6 +20,9 @@ // todo: move this macro to script_macros_medical.hpp? #define MORPHINE_PAIN_SUPPRESSION 0.6 +// 0.2625 = 0.6/0.8 * 0.35 +// 0.6 = basic medication morph. pain suppr., 0.8 = adv. medication morph. pain suppr., 0.35 = adv. medication painkillers. pain suppr. +#define PAINKILLERS_PAIN_SUPPRESSION 0.2625 params ["_patient", "_bodyPart", "_classname"]; TRACE_3("medicationLocal",_patient,_bodyPart,_classname); @@ -47,6 +50,10 @@ if !(ACEGVAR(medical_treatment,advancedMedication)) exitWith { [QACEGVAR(medical,WakeUp), _patient] call CBA_fnc_localEvent; }; }; + case "Painkillers": { + private _painSuppress = GET_PAIN_SUPPRESS(_patient); + _patient setVariable [VAR_PAIN_SUPP, (_painSuppress + PAINKILLERS_PAIN_SUPPRESSION) min 1, true]; + }; }; }; TRACE_1("Running treatmentMedicationLocal with Advanced configuration for",_patient); diff --git a/addons/pharma/functions/fnc_tourniquetRemove.sqf b/addons/pharma/functions/fnc_tourniquetRemove.sqf index 135824569..e15a5e54b 100644 --- a/addons/pharma/functions/fnc_tourniquetRemove.sqf +++ b/addons/pharma/functions/fnc_tourniquetRemove.sqf @@ -26,7 +26,9 @@ private _partIndex = ALL_BODY_PARTS find toLower _bodyPart; private _tourniquets = GET_TOURNIQUETS(_patient); if (_tourniquets select _partIndex == 0) exitWith { - [ACELSTRING(medical_treatment,noTourniquetOnBodyPart), 1.5] call ACEFUNC(common,displayTextStructured); + if (_medic == ACE_player) then { + [ACELSTRING(medical_treatment,noTourniquetOnBodyPart), 1.5] call ACEFUNC(common,displayTextStructured); + }; }; _tourniquets set [_partIndex, 0]; @@ -39,8 +41,15 @@ TRACE_1("clearConditionCaches: tourniquetRemove",_nearPlayers); [QACEGVAR(interact_menu,clearConditionCaches), [], _nearPlayers] call CBA_fnc_targetEvent; // Add tourniquet item to medic or patient -private _receiver = [_patient, _medic, _medic] select ACEGVAR(medical_treatment,allowSharedEquipment); -[_receiver, "ACE_tourniquet"] call ACEFUNC(common,addToInventory); +if (_medic call ACEFUNC(common,isPlayer)) then { + private _receiver = [_patient, _medic, _medic] select ACEGVAR(medical_treatment,allowSharedEquipment); + [_receiver, "ACE_tourniquet"] call ACEFUNC(common,addToInventory); +} else { + // If the medic is AI, only return tourniquet if enabled + if (missionNamespace getVariable [QACEGVAR(medical_ai,requireItems), 0] > 0) then { + [_medic, "ACE_tourniquet"] call ACEFUNC(common,addToInventory); + }; +}; // Handle occluded medications that were blocked due to tourniquet private _occludedMedications = _patient getVariable [QACEGVAR(medical,occludedMedications), []]; diff --git a/addons/vitals/functions/fnc_handleUnitVitals.sqf b/addons/vitals/functions/fnc_handleUnitVitals.sqf index 5d71ec414..ab40c8e42 100644 --- a/addons/vitals/functions/fnc_handleUnitVitals.sqf +++ b/addons/vitals/functions/fnc_handleUnitVitals.sqf @@ -41,7 +41,7 @@ private _temperature = 37; private _baroPressure = 760; if (EGVAR(hypothermia,hypothermiaActive)) then { - // Enviromental Impact (Altitude, Temperature, Pressure) + // Enviromental Impact (Altitude, Temperature, Pressure) private _altitude = (getPosASL _unit) select 2; private _altitudeTempImpact = switch (true) do { case (_altitude >= 10): { abs(_altitude/153) * -1 }; //For every 1000 meters of elevation gain, temperature decreases by ~6.5 degrees celsius @@ -50,7 +50,7 @@ if (EGVAR(hypothermia,hypothermiaActive)) then { }; _baroPressure = 760 * exp((-(_altitude)) / 8400); - _temperature = [_unit, _altitudeTempImpact, _bloodVolume, _deltaT, _syncValues] call FUNC(handleTemperatureFunction); + _temperature = [_unit, _altitudeTempImpact, _bloodVolume, _deltaT, _syncValues] call FUNC(handleTemperatureFunction); }; // Set variables for synchronizing information across the net