diff --git a/addons/medical_damage/XEH_PREP.hpp b/addons/medical_damage/XEH_PREP.hpp index 1ae4e2f34c3..2d47c290fe5 100644 --- a/addons/medical_damage/XEH_PREP.hpp +++ b/addons/medical_damage/XEH_PREP.hpp @@ -1,3 +1,4 @@ +PREP(debug_explosiveTest); PREP(determineIfFatal); PREP(getTypeOfDamage); PREP(handleIncapacitation); diff --git a/addons/medical_damage/functions/fnc_debug_explosiveTest.sqf b/addons/medical_damage/functions/fnc_debug_explosiveTest.sqf new file mode 100644 index 00000000000..7ffd899ee18 --- /dev/null +++ b/addons/medical_damage/functions/fnc_debug_explosiveTest.sqf @@ -0,0 +1,63 @@ +#include "script_component.hpp" +/* + * Author: Pterolatypus + * Testing function that spawns AI units in a spiral around the given point and optionally spawns a projectile at the center + * Used for observing the effects of explosive munitions + * + * Arguments: + * 0: Center position, format PositionAGL + * 1: Distance to spawn units + * 0: Min (default: 1) + * 1: Max (default: 10) + * 2: Step (default: 1) + * 2: Unit class to spawn (default: "B_Soldier_F") + * 3: Ammo class to spawn, "" or nil to skip (default: "") + * 4: Delay between unit placement and ammo spawning in seconds (default: 1) + * 5: Function to run on each unit that is spawned (optional) params [_unit, _center, _ammoClass] + * + * ReturnValue: + * Nothing + * + * Example: + * [position player, [20, 80, 5]] call ace_medical_damage_fnc_debug_explosiveTest + * + * Public: No + */ +params [ + "_center", + ["_distances", []], + ["_unitClass", "B_Soldier_F"], + ["_ammoClass", ""], + ["_delay", 1], + "_initCode" +]; + +_distances params [["_min", 1], ["_max", 10], ["_step", 1]]; + +if (isNil "_center") exitwith {}; + +_max = _max max _min; +private _nSteps = 0 max ceil ((_max - _min) / _step); +private _angleStep = 360 / (_nSteps + 1); + +for "_distance" from _min to _max step _step do { + private _i = (_distance - _min) / _step; + private _angle = _i * _angleStep; + private _offset = [_distance * sin _angle, _distance * cos _angle, 0]; + private _position = _center vectorAdd _offset; + private _unit = (createGroup west) createUnit [_unitClass, _position, [], 0, "CAN_COLLIDE"]; + if !(isNil "_initCode") then { + [_unit, _center, _ammoClass] call _initCode; + }; +}; + +// spawn the ammo above the ground falling. necessary for shells, doesn't cause problems for grenades etc. +if (_ammoClass != "") then { + [{ + params ["_ammoClass", "_center"]; + private _position = _center vectorAdd [0, 0, 5]; + private _obj = _ammoClass createVehicle _position; + _object setVectorDirAndUp [[0, 0, -1], [0, 1, 0]]; + _obj setVelocity [0, 0, -20]; + }, [_ammoClass, _center], _delay] call CBA_fnc_waitAndExecute; +}; \ No newline at end of file diff --git a/addons/medical_damage/functions/fnc_handleIncapacitation.sqf b/addons/medical_damage/functions/fnc_handleIncapacitation.sqf index 4e87e749df1..e76b0bee62a 100644 --- a/addons/medical_damage/functions/fnc_handleIncapacitation.sqf +++ b/addons/medical_damage/functions/fnc_handleIncapacitation.sqf @@ -23,13 +23,14 @@ private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0, _bodyPartDamage params ["_headDamage", "_bodyDamage", "_leftArmDamage", "_rightArmDamage", "_leftLegDamage", "_rightLegDamage"]; // Exclude non penetrating body damage +/* { _x params ["", "_bodyPartN", "_amountOf", "", "_damage"]; if (_bodyPartN == 1 && {_damage < PENETRATION_THRESHOLD}) then { _bodyDamage = _bodyDamage - (_amountOf * _damage); }; } forEach GET_OPEN_WOUNDS(_unit); - +*/ private _damageThreshold = GET_DAMAGE_THRESHOLD(_unit); if ((_headDamage > _damageThreshold / 2) || {_bodyDamage > _damageThreshold} || {(_painLevel >= PAIN_UNCONSCIOUS) && {random 1 < EGVAR(medical,painUnconsciousChance)}}) then { diff --git a/addons/medical_damage/functions/fnc_woundsHandlerBurning.sqf b/addons/medical_damage/functions/fnc_woundsHandlerBurning.sqf index 66d6d976084..afb7dc1ddda 100644 --- a/addons/medical_damage/functions/fnc_woundsHandlerBurning.sqf +++ b/addons/medical_damage/functions/fnc_woundsHandlerBurning.sqf @@ -31,7 +31,7 @@ params ["_unit", "_allDamages", "_typeOfDamage"]; private _newDamage = _storedDamage + _damage; // schedule a task to convert stored damage to wounds after 1s - // because the task resets stored damage to zero, if it isn't currently zero that means there is a task already waiting + // the task resets stored damage to zero, so if it isn't currently zero that means there is a task already waiting if (_storedDamage == 0 && _newDamage > 0) then { [{ params ["_unit", "_bodyPart", "_typeOfDamage"];