mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fixes and removal of duplicate code
This commit is contained in:
@ -22,7 +22,7 @@ _bloodPressure = if (!alive _target) then {
|
|||||||
} else {
|
} else {
|
||||||
[_target] call FUNC(getBloodPressure)
|
[_target] call FUNC(getBloodPressure)
|
||||||
};
|
};
|
||||||
_bloodPressure params ["_bloodPressureLow", "_bloodPressureLow"];
|
_bloodPressure params ["_bloodPressureHigh", "_bloodPressureLow"];
|
||||||
_output = "";
|
_output = "";
|
||||||
_logOutPut = "";
|
_logOutPut = "";
|
||||||
if ([_caller] call FUNC(isMedic)) then {
|
if ([_caller] call FUNC(isMedic)) then {
|
||||||
|
@ -39,7 +39,7 @@ _litter = getArray (_config >> "litter");
|
|||||||
|
|
||||||
_createLitter = {
|
_createLitter = {
|
||||||
private["_position", "_direction"];
|
private["_position", "_direction"];
|
||||||
params ["_unit", "_litter"];
|
params ["_unit", "_litterClass"];
|
||||||
// @TODO: handle carriers over water
|
// @TODO: handle carriers over water
|
||||||
// For now, don't spawn litter if we are over water to avoid floating litter
|
// For now, don't spawn litter if we are over water to avoid floating litter
|
||||||
if(surfaceIsWater (getPos _unit)) exitWith { false };
|
if(surfaceIsWater (getPos _unit)) exitWith { false };
|
||||||
@ -55,7 +55,7 @@ _createLitter = {
|
|||||||
|
|
||||||
// Create the litter, and timeout the event based on the cleanup delay
|
// Create the litter, and timeout the event based on the cleanup delay
|
||||||
// The cleanup delay for events in MP is handled by the server side
|
// The cleanup delay for events in MP is handled by the server side
|
||||||
[QGVAR(createLitter), [_litterClass,_position,_direction], 0] call EFUNC(common,syncedEvent);
|
[QGVAR(createLitter), [_litterClass, _position, _direction], 0] call EFUNC(common,syncedEvent);
|
||||||
|
|
||||||
true
|
true
|
||||||
};
|
};
|
||||||
@ -65,7 +65,7 @@ _createdLitter = [];
|
|||||||
if (typeName _x == "ARRAY") then {
|
if (typeName _x == "ARRAY") then {
|
||||||
if (count _x < MIN_ENTRIES_LITTER_CONFIG) exitwith {};
|
if (count _x < MIN_ENTRIES_LITTER_CONFIG) exitwith {};
|
||||||
|
|
||||||
params ["_selection", "_litterCondition", "_litterOptions"];
|
_x params ["_selection", "_litterCondition", "_litterOptions"];
|
||||||
|
|
||||||
if (toLower _selection in [toLower _selectionName, "all"]) then { // in is case sensitve. We can be forgiving here, so lets use toLower.
|
if (toLower _selection in [toLower _selectionName, "all"]) then { // in is case sensitve. We can be forgiving here, so lets use toLower.
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
// Exit for basic medical
|
// Exit for basic medical
|
||||||
if (GVAR(level) < 2) exitWith {};
|
if (GVAR(level) < 2) exitWith {};
|
||||||
private ["_target", "_show", "_selectionN", "_amountOfGeneric", "_bandagedwounds", "_logCtrl", "_part", "_partText", "_pointDamage", "_severity", "_total", "_totalIvVolume", "_triageStatus", "_type"];
|
private ["_amountOfGeneric", "_bandagedwounds", "_logCtrl", "_part", "_partText", "_pointDamage", "_severity", "_total", "_totalIvVolume", "_triageStatus", "_type"];
|
||||||
params ["_target", ["_target", true], ["_selectionN", 0]];
|
params ["_target", ["_show", true], ["_selectionN", 0]];
|
||||||
|
|
||||||
GVAR(currentSelectedSelectionN) = if (typeName _selectionN == "SCALAR") then {_selectionN} else {0};
|
GVAR(currentSelectedSelectionN) = if (typeName _selectionN == "SCALAR") then {_selectionN} else {0};
|
||||||
GVAR(displayPatientInformationTarget) = if (_show) then {_target} else {ObjNull};
|
GVAR(displayPatientInformationTarget) = if (_show) then {_target} else {ObjNull};
|
||||||
@ -203,7 +203,7 @@ if (_show) then {
|
|||||||
_logs = _target getvariable [QGVAR(logFile_Activity), []];
|
_logs = _target getvariable [QGVAR(logFile_Activity), []];
|
||||||
{
|
{
|
||||||
// [_message,_moment,_type, _arguments]
|
// [_message,_moment,_type, _arguments]
|
||||||
_x params ["_message", "_moment", "_arguments"];
|
_x params ["_message", "_moment", "_type", "_arguments"];
|
||||||
if (isLocalized _message) then {
|
if (isLocalized _message) then {
|
||||||
_message = localize _message;
|
_message = localize _message;
|
||||||
};
|
};
|
||||||
|
@ -31,79 +31,46 @@ if (typeName _projectile == "OBJECT") then {
|
|||||||
if !(_selection in (GVAR(SELECTIONS) + [""])) exitWith {0};
|
if !(_selection in (GVAR(SELECTIONS) + [""])) exitWith {0};
|
||||||
|
|
||||||
// Exit if we disable damage temporarily
|
// Exit if we disable damage temporarily
|
||||||
_damageOld = damage _unit;
|
if !(_unit getVariable [QGVAR(allowDamage), true]) exitWith {
|
||||||
if (_selection in GVAR(SELECTIONS)) then {
|
_damageOld = damage _unit;
|
||||||
_damageOld = _unit getHit _selection;
|
if (_selection in GVAR(SELECTIONS)) then {
|
||||||
|
_damageOld = _unit getHit _selection;
|
||||||
|
};
|
||||||
|
_damageOld;
|
||||||
};
|
};
|
||||||
if !(_unit getVariable [QGVAR(allowDamage), true]) exitWith {_damageOld};
|
|
||||||
|
|
||||||
// Get return damage
|
// Get return damage
|
||||||
_damageReturn = _damage;
|
_damageReturn = _damage;
|
||||||
if (GVAR(level) < 2) then {
|
|
||||||
_newDamage = _this call FUNC(handleDamage_basic2);
|
|
||||||
_projectile = _this select 4;
|
|
||||||
_typeOfDamage = [_projectile] call FUNC(getTypeOfDamage);
|
|
||||||
|
|
||||||
_typeIndex = (GVAR(allAvailableDamageTypes) find _typeOfDamage);
|
_newDamage = _this call FUNC(handleDamage_caching);
|
||||||
_minLethalDamage = 0.01;
|
// handleDamage_caching may have modified the projectile string
|
||||||
if (_typeIndex >= 0) then {
|
_typeOfDamage = [_projectile] call FUNC(getTypeOfDamage);
|
||||||
_minLethalDamage = GVAR(minLethalDamages) select _typeIndex;
|
|
||||||
|
_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 _shooter} && {_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 _shooter} && {_projectile == ""} && {_selection == ""}) then {
|
if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)}) then {
|
||||||
if (GVAR(enableVehicleCrashes)) then {
|
if ((_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)])) exitwith {
|
||||||
_selection = GVAR(SELECTIONS) select (floor(random(count GVAR(SELECTIONS))));
|
_damageReturn = 0.9;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
if ([_unit] call FUNC(setDead)) then {
|
||||||
if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)}) then {
|
_damageReturn = 1;
|
||||||
if ((_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)])) exitwith {
|
|
||||||
_damageReturn = 0.9;
|
|
||||||
};
|
|
||||||
if ([_unit] call FUNC(setDead)) then {
|
|
||||||
_damageReturn = 1;
|
|
||||||
} else {
|
|
||||||
_damageReturn = _damageReturn min 0.89;
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
_damageReturn = _damageReturn min 0.89;
|
_damageReturn = _damageReturn min 0.89;
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if !([_unit] call FUNC(hasMedicalEnabled)) exitwith {
|
_damageReturn = _damageReturn min 0.89;
|
||||||
// Because of the config changes, we cannot properly disable the medical system for a unit.
|
|
||||||
// lets use basic for the ACE_time being..
|
|
||||||
_damageReturn = _this call FUNC(handleDamage_basic);
|
|
||||||
};
|
|
||||||
_newDamage = _this call FUNC(handleDamage_caching);
|
|
||||||
// handleDamage_caching may have modified the projectile string
|
|
||||||
_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 _shooter} && {_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)}) then {
|
|
||||||
if ((_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)])) exitwith {
|
|
||||||
_damageReturn = 0.9;
|
|
||||||
};
|
|
||||||
if ([_unit] call FUNC(setDead)) then {
|
|
||||||
_damageReturn = 1;
|
|
||||||
} else {
|
|
||||||
_damageReturn = _damageReturn min 0.89;
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
_damageReturn = _damageReturn min 0.89;
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
[_unit] call FUNC(addToInjuredCollection);
|
[_unit] call FUNC(addToInjuredCollection);
|
||||||
|
|
||||||
if (_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)]) exitWith {
|
if (_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)]) exitWith {
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_typeOfProjectile", "_part", "_damageBodyParts", "_hitPoints"];
|
private ["_typeOfProjectile", "_part", "_damageBodyParts", "_hitPoints"];
|
||||||
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_newDamage"];
|
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfProjectile", "_newDamage"];
|
||||||
|
|
||||||
// Most likely taking exessive fire damage. Lets exit.
|
// Most likely taking exessive fire damage. Lets exit.
|
||||||
if (isNull _sourceOfDamage && {_typeOfProjectile == ""} && {vehicle _unit == _unit} && {(_selectionName == "head" || isBurning _unit)}) exitwith {};
|
if (isNull _sourceOfDamage && {_typeOfProjectile == ""} && {vehicle _unit == _unit} && {(_selectionName == "head" || isBurning _unit)}) exitwith {};
|
||||||
@ -35,7 +35,11 @@ _damageBodyParts set [_part, (_damageBodyParts select _part) + _newDamage];
|
|||||||
_unit setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true];
|
_unit setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true];
|
||||||
|
|
||||||
_typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage);
|
_typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage);
|
||||||
[_unit, _selectionName, _newDamage, _typeOfProjectile, _typeOfDamage] call FUNC(handleDamage_assignWounds);
|
|
||||||
|
|
||||||
|
systemChat format["ASSIGNING INJURIES: %1", _unit];
|
||||||
|
|
||||||
|
[_unit, _selectionName, _newDamage, _typeOfProjectile, _typeOfDamage] call FUNC(handleDamage_wounds); //FUNC(handleDamage_assignWounds);
|
||||||
|
|
||||||
// TODO Disabled until implemented fully
|
// TODO Disabled until implemented fully
|
||||||
//if (GVAR(enableAirway)) then {
|
//if (GVAR(enableAirway)) then {
|
||||||
|
@ -3,12 +3,6 @@
|
|||||||
* Cache a handleDamage call to execute it 3 frames later
|
* Cache a handleDamage call to execute it 3 frames later
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit That Was Hit <OBJECT>
|
|
||||||
* 1: Name Of Hit Selection <STRING>
|
|
||||||
* 2: Amount Of Damage <NUMBER>
|
|
||||||
* 3: Shooter <OBJECT>
|
|
||||||
* 4: Projectile <STRING>
|
|
||||||
* 5: Current damage to be returned <NUMBER>
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* <nil>
|
* <nil>
|
||||||
@ -18,151 +12,29 @@
|
|||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_unit", "_selectionName", "_damage", "_source", "_projectile", "_hitSelections", "_hitPoints", "_impactVelocity", "_newDamage", "_cache_hitpoints", "_cache_projectiles", "_cache_params", "_cache_damages"];
|
private ["_damageBodyParts", "_cache_params", "_cache_damages"];
|
||||||
_unit = _this select 0;
|
params ["_target"];
|
||||||
_selectionName = _this select 1;
|
|
||||||
_damage = _this select 2;
|
|
||||||
_source = _this select 3;
|
|
||||||
_projectile = _this select 4;
|
|
||||||
|
|
||||||
_hitSelections = GVAR(SELECTIONS);
|
_damageBodyParts = _target getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]];
|
||||||
_hitPoints = GVAR(HITPOINTS);
|
_cache_params = _target getVariable [QGVAR(cachedHandleDamageParams), []];
|
||||||
|
_cache_damages = _target getVariable QGVAR(cachedDamages);
|
||||||
|
|
||||||
// Calculate change in damage.
|
{
|
||||||
_newDamage = _damage - (damage _unit);
|
_x params ["_unit","_selectionName","_amountOfDamage","_sourceOfDamage","_typeOfProjectile","_typeOfDamage"];
|
||||||
if (_selectionName in _hitSelections) then {
|
if !(isNull _sourceOfDamage && {_typeOfProjectile == ""} && {vehicle _unit == _unit} && {(_selectionName == "head" || isBurning _unit)}) then {
|
||||||
_newDamage = _damage - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selectionName)));
|
_part = [_selectionName] call FUNC(selectionNameToNumber);
|
||||||
};
|
if (_part < 0) exitwith {};
|
||||||
|
_damageBodyParts set [_part, (_damageBodyParts select _part) + (_cache_damages select _foreachIndex)];
|
||||||
//_damage = _damage + _newDamage;
|
|
||||||
|
|
||||||
// Check for vehicle crash
|
|
||||||
if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _source} && {_projectile == ""} && {_selectionName == ""}) then {
|
|
||||||
if (GVAR(enableVehicleCrashes)) then {
|
|
||||||
_selectionName = _hitSelections select (floor(random(count _hitSelections)));
|
|
||||||
_projectile = "vehiclecrash";
|
|
||||||
_this set [1, _selectionName];
|
|
||||||
_this set [4, _projectile];
|
|
||||||
};
|
};
|
||||||
};
|
}foreach _cache_params;
|
||||||
|
_target setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true];
|
||||||
|
|
||||||
// Handle falling damage
|
EXPLODE_6_PVT(_damageBodyParts,_headDamage,_torsoDamage,_handsDamageR,_handsDamageL,_legsDamageR,_legsDamageL);
|
||||||
_impactVelocity = (velocity _unit) select 2;
|
_target setHitPointDamage ["hitHead", _headDamage min 0.95];
|
||||||
if (_impactVelocity < -5 && {vehicle _unit == _unit}) then {
|
_target setHitPointDamage ["hitBody", _torsoDamage min 0.95];
|
||||||
_unit setVariable [QGVAR(isFalling), true];
|
_target setHitPointDamage ["hitHands", (_handsDamageR + _handsDamageL) min 0.95];
|
||||||
_unit setVariable [QGVAR(impactVelocity), _impactVelocity];
|
_target setHitPointDamage ["hitLegs", (_legsDamageR + _legsDamageL) min 0.95];
|
||||||
};
|
|
||||||
if (_unit getVariable [QGVAR(isFalling), false]) then {
|
|
||||||
if !(_selectionName in ["", "leg_l", "leg_r"]) then {
|
|
||||||
if (_selectionName == "body") then {
|
|
||||||
_newDamage = _newDamage * abs(_unit getVariable [QGVAR(impactVelocity), _impactVelocity]) / 50;
|
|
||||||
} else {
|
|
||||||
_newDamage = _newDamage * 0.5;
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
if (_selectionName == "") then {
|
|
||||||
_selectionName = ["leg_l", "leg_r"] select (floor(random 2));
|
|
||||||
_this set [1, _selectionName];
|
|
||||||
};
|
|
||||||
_newDamage = _newDamage * 0.7;
|
|
||||||
};
|
|
||||||
_projectile = "falling";
|
|
||||||
_this set [4, "falling"];
|
|
||||||
};
|
|
||||||
|
|
||||||
// Finished with the current frame, reset variables
|
{
|
||||||
// Note: sometimes handleDamage spans over 2 or even 3 frames.
|
_target setHitPointDamage [_x, (_damageBodyParts select _foreachIndex) min 0.95];
|
||||||
if (diag_frameno > (_unit getVariable [QGVAR(frameNo_damageCaching), -3]) + 2) then {
|
}foreach GVAR(HITPOINTS);
|
||||||
_unit setVariable [QGVAR(frameNo_damageCaching), diag_frameno];
|
|
||||||
|
|
||||||
// handle the cached damages 3 frames later
|
|
||||||
[{
|
|
||||||
params ["_args", "_id"];
|
|
||||||
_args params ["_target", "_frameNo"];
|
|
||||||
|
|
||||||
if (diag_frameno > _frameNo + 2) then {
|
|
||||||
_target setDamage 0;
|
|
||||||
|
|
||||||
_cache_params = _target getVariable [QGVAR(cachedHandleDamageParams), []];
|
|
||||||
_cache_damages = _target getVariable QGVAR(cachedDamages);
|
|
||||||
_damageBodyParts = _target getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]];
|
|
||||||
{
|
|
||||||
_x params ["_unit","_selectionName","_amountOfDamage","_sourceOfDamage","_typeOfProjectile","_typeOfDamage"];
|
|
||||||
if !(isNull _sourceOfDamage && {_typeOfProjectile == ""} && {vehicle _unit == _unit} && {(_selectionName == "head" || isBurning _unit)}) then {
|
|
||||||
_part = [_selectionName] call FUNC(selectionNameToNumber);
|
|
||||||
if (_part < 0) exitwith {};
|
|
||||||
_damageBodyParts set [_part, (_damageBodyParts select _part) + (_cache_damages select _foreachIndex)];
|
|
||||||
};
|
|
||||||
}foreach _cache_params;
|
|
||||||
_unit setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true];
|
|
||||||
|
|
||||||
EXPLODE_6_PVT(_damageBodyParts,_headDamage,_torsoDamage,_handsDamageR,_handsDamageL,_legsDamageR,_legsDamageL);
|
|
||||||
_target setHitPointDamage ["hitHead", _headDamage min 0.95];
|
|
||||||
_target setHitPointDamage ["hitBody", _torsoDamage min 0.95];
|
|
||||||
_target setHitPointDamage ["hitHands", (_handsDamageR + _handsDamageL) min 0.95];
|
|
||||||
_target setHitPointDamage ["hitLegs", (_legsDamageR + _legsDamageL) min 0.95];
|
|
||||||
|
|
||||||
{
|
|
||||||
_target setHitPointDamage [_x, (_damageBodyParts select _foreachIndex) min 0.95];
|
|
||||||
}foreach GVAR(HITPOINTS);
|
|
||||||
[_id] call cba_fnc_removePerFrameHandler;
|
|
||||||
};
|
|
||||||
}, 0, [_unit, diag_frameno] ] call CBA_fnc_addPerFrameHandler;
|
|
||||||
|
|
||||||
_unit setVariable [QGVAR(cachedProjectiles), []];
|
|
||||||
_unit setVariable [QGVAR(cachedHitPoints), []];
|
|
||||||
_unit setVariable [QGVAR(cachedDamages), []];
|
|
||||||
_unit setVariable [QGVAR(cachedHandleDamageParams), []];
|
|
||||||
};
|
|
||||||
|
|
||||||
// Caching of the damage events
|
|
||||||
if (_selectionName != "") then {
|
|
||||||
_cache_projectiles = _unit getVariable QGVAR(cachedProjectiles);
|
|
||||||
private ["_index","_otherDamage"];
|
|
||||||
_index = _cache_projectiles find _projectile;
|
|
||||||
// Check if the current projectile has already been handled once
|
|
||||||
if (_index >= 0 && {_projectile != "falling"}) exitwith {
|
|
||||||
_cache_damages = _unit getVariable QGVAR(cachedDamages);
|
|
||||||
// Find the previous damage this projectile has done
|
|
||||||
_otherDamage = (_cache_damages select _index);
|
|
||||||
|
|
||||||
// Take the highest damage of the two
|
|
||||||
if (_newDamage > _otherDamage) then {
|
|
||||||
_cache_params = _unit getVariable QGVAR(cachedHandleDamageParams);
|
|
||||||
_cache_hitpoints = _unit getVariable QGVAR(cachedHitPoints);
|
|
||||||
|
|
||||||
private ["_hitPoint", "_restore"];
|
|
||||||
// Restore the damage before the previous damage was processed
|
|
||||||
_hitPoint = _cache_hitpoints select _index;
|
|
||||||
_restore = ((_unit getHitPointDamage _hitPoint) - _otherDamage) max 0;
|
|
||||||
_unit setHitPointDamage [_hitPoint, _restore];
|
|
||||||
|
|
||||||
_cache_hitpoints set [_index, (_hitPoints select (_hitSelections find _selectionName))];
|
|
||||||
_cache_damages set [_index, _newDamage];
|
|
||||||
_cache_params set[_index, _this];
|
|
||||||
|
|
||||||
_unit setVariable [QGVAR(cachedProjectiles), _cache_projectiles];
|
|
||||||
_unit setVariable [QGVAR(cachedHitPoints), _cache_hitpoints];
|
|
||||||
_unit setVariable [QGVAR(cachedDamages), _cache_damages];
|
|
||||||
_unit setVariable [QGVAR(cachedHandleDamageParams), _cache_params];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
_cache_hitpoints = _unit getVariable QGVAR(cachedHitPoints);
|
|
||||||
_cache_damages = _unit getVariable QGVAR(cachedDamages);
|
|
||||||
_cache_params = _unit getVariable QGVAR(cachedHandleDamageParams);
|
|
||||||
|
|
||||||
// This is an unhandled projectile
|
|
||||||
_cache_projectiles pushBack _projectile;
|
|
||||||
_cache_hitpoints pushBack (_hitPoints select (_hitSelections find _selectionName));
|
|
||||||
_cache_damages pushBack _newDamage;
|
|
||||||
_cache_params pushBack _this;
|
|
||||||
|
|
||||||
// Store the new cached values
|
|
||||||
_unit setVariable [QGVAR(cachedProjectiles), _cache_projectiles];
|
|
||||||
_unit setVariable [QGVAR(cachedHitPoints), _cache_hitpoints];
|
|
||||||
_unit setVariable [QGVAR(cachedDamages), _cache_damages];
|
|
||||||
_unit setVariable [QGVAR(cachedHandleDamageParams), _cache_params];
|
|
||||||
};
|
|
||||||
|
|
||||||
_newDamage;
|
|
||||||
|
@ -79,15 +79,17 @@ if (diag_frameno > (_unit getVariable [QGVAR(frameNo_damageCaching), -3]) + 2) t
|
|||||||
if (diag_frameno > _frameno + 2) then {
|
if (diag_frameno > _frameno + 2) then {
|
||||||
_unit setDamage 0;
|
_unit setDamage 0;
|
||||||
|
|
||||||
_cache_params = _unit getVariable [QGVAR(cachedHandleDamageParams), []];
|
if (GVAR(level) < 2 || {!([_unit] call FUNC(hasMedicalEnabled))}) then {
|
||||||
_cache_damages = _unit getVariable QGVAR(cachedDamages);
|
[_unit] call FUNC(handleDamage_basic2);
|
||||||
{
|
} else {
|
||||||
_params = _x + [_cache_damages select _foreachIndex];
|
_cache_params = _unit getVariable [QGVAR(cachedHandleDamageParams), []];
|
||||||
_params call FUNC(handleDamage_advanced);
|
_cache_damages = _unit getVariable QGVAR(cachedDamages);
|
||||||
} foreach _cache_params;
|
{
|
||||||
|
_params = _x + [_cache_damages select _foreachIndex];
|
||||||
[_unit] call FUNC(handleDamage_advancedSetDamage);
|
_params call FUNC(handleDamage_advanced);
|
||||||
|
} foreach _cache_params;
|
||||||
|
[_unit] call FUNC(handleDamage_advancedSetDamage);
|
||||||
|
};
|
||||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
}, 0, [_unit, diag_frameno] ] call CBA_fnc_addPerFrameHandler;
|
}, 0, [_unit, diag_frameno] ] call CBA_fnc_addPerFrameHandler;
|
||||||
|
@ -20,11 +20,15 @@
|
|||||||
private ["_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd", "_bloodLoss", "_bodyPartNToAdd", "_classType", "_damageLevels", "_foundIndex", "_i", "_injury", "_maxDamage", "_pain", "_painLevel", "_selections", "_toAddClassID", "_woundsCreated"];
|
private ["_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd", "_bloodLoss", "_bodyPartNToAdd", "_classType", "_damageLevels", "_foundIndex", "_i", "_injury", "_maxDamage", "_pain", "_painLevel", "_selections", "_toAddClassID", "_woundsCreated"];
|
||||||
params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"];
|
params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"];
|
||||||
|
|
||||||
|
systemChat format["input: %1", _this];
|
||||||
|
diag_log format["input: %1", _this];
|
||||||
|
|
||||||
// Administration for open wounds and ids
|
// Administration for open wounds and ids
|
||||||
_openWounds = _unit getvariable[QGVAR(openWounds), []];
|
_openWounds = _unit getvariable[QGVAR(openWounds), []];
|
||||||
_woundID = _unit getvariable[QGVAR(lastUniqueWoundID), 1];
|
_woundID = _unit getvariable[QGVAR(lastUniqueWoundID), 1];
|
||||||
|
|
||||||
_extensionOutput = "ace_medical" callExtension format ["HandleDamageWounds,%1,%2,%3,%4", _selectionName, _damage, _typeOfDamage, _woundID];
|
_extensionOutput = "ace_medical" callExtension format ["HandleDamageWounds,%1,%2,%3,%4", _selectionName, _damage, _typeOfDamage, _woundID];
|
||||||
|
systemChat format["EXTENSION OUTPUT: %1", _extensionOutput];
|
||||||
|
|
||||||
_painToAdd = 0;
|
_painToAdd = 0;
|
||||||
_woundsCreated = [];
|
_woundsCreated = [];
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
params ["_caller", "_target", "_selectionName", "_className", "_items", ["_specificSpot", -1]];
|
params ["_caller", "_target", "_selectionName", "_className", "_items", "", ["_specificSpot", -1]];
|
||||||
|
|
||||||
if !([_target] call FUNC(hasMedicalEnabled)) exitwith {
|
if !([_target] call FUNC(hasMedicalEnabled)) exitwith {
|
||||||
_this call FUNC(treatmentBasic_bandage);
|
_this call FUNC(treatmentBasic_bandage);
|
||||||
|
@ -40,7 +40,8 @@ _effectivenessFound = -1;
|
|||||||
_mostEffectiveInjury = _openWounds select 0;
|
_mostEffectiveInjury = _openWounds select 0;
|
||||||
_exit = false;
|
_exit = false;
|
||||||
{
|
{
|
||||||
params ["", "_classID", "_partX"];
|
_x params ["", "_classID", "_partX"];
|
||||||
|
diag_log format["OPENWOUND: %1", _x];
|
||||||
// Only parse injuries that are for the selected bodypart.
|
// Only parse injuries that are for the selected bodypart.
|
||||||
if (_partX == _part) then {
|
if (_partX == _part) then {
|
||||||
_woundEffectivenss = _effectiveness;
|
_woundEffectivenss = _effectiveness;
|
||||||
@ -56,6 +57,7 @@ _exit = false;
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
diag_log format["_specificClass: %1 vs classId %2", _specificClass, _classID];
|
||||||
if (_specificClass == _classID) exitwith {
|
if (_specificClass == _classID) exitwith {
|
||||||
_effectivenessFound = _woundEffectivenss;
|
_effectivenessFound = _woundEffectivenss;
|
||||||
_mostEffectiveSpot = _foreachIndex;
|
_mostEffectiveSpot = _foreachIndex;
|
||||||
|
Reference in New Issue
Block a user