mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'medical-rewrite' of https://github.com/KoffeinFlummi/ACE3 into medical-rewrite
This commit is contained in:
commit
e7c0c78e5d
@ -16,18 +16,18 @@ _part = _this select 1;
|
||||
_withDamage = if (count _this > 2) then { _this select 2} else {0};
|
||||
|
||||
if (!alive _unit) exitwith {true};
|
||||
|
||||
if (_part < 0 || _part > 5) exitwith {};
|
||||
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]];
|
||||
//_damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_Players), GVAR(damageThreshold_Players), GVAR(damageThreshold_Players) * 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(damageThreshold_AI), GVAR(damageThreshold_AI), GVAR(damageThreshold_AI) * 1.7]];
|
||||
};
|
||||
|
||||
_damageBodyPart = ((_unit getvariable [QGVAR(bodyPartStatus),[0,0,0,0,0,0]]) select _part) + _withDamage;
|
||||
_damageBodyPart = ((_unit getvariable [QGVAR(bodyPartStatus),[0, 0, 0, 0, 0, 0]]) select _part) + _withDamage;
|
||||
|
||||
// Check if damage to body part is higher as damage head
|
||||
if (_part == 0) exitwith {
|
||||
|
@ -26,7 +26,7 @@ _projectile = _this select 4;
|
||||
|
||||
if !(local _unit) exitWith {nil};
|
||||
|
||||
if !([_unit] call FUNC(hasMedicalEnabled)) exitwith {systemChat format["Has no medical enabled: %1", _unit];};
|
||||
if !([_unit] call FUNC(hasMedicalEnabled)) exitwith {};
|
||||
|
||||
if (typeName _projectile == "OBJECT") then {
|
||||
_projectile = typeOf _projectile;
|
||||
@ -38,24 +38,20 @@ _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"];
|
||||
if !(_selection in (_hitSelections + [""])) exitWith {0};
|
||||
|
||||
_damageReturn = _damage;
|
||||
|
||||
_damageReturn = (_this select 2);
|
||||
if (GVAR(level) == 0) then {
|
||||
_damageReturn = (_this + [_damageReturn]) call FUNC(handleDamage_basic);
|
||||
};
|
||||
|
||||
if (_damageReturn < 0.01) exitWith {0};
|
||||
|
||||
if (GVAR(level) >= 1) then {
|
||||
[_unit, _selectionName, _damage, _source, _projectile, _damageReturn] call FUNC(handleDamage_caching);
|
||||
[_unit, _selection, _damage, _source, _projectile, _damageReturn] call FUNC(handleDamage_caching);
|
||||
|
||||
if (_damageReturn > 0.9) then {
|
||||
_hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"];
|
||||
_newDamage = _damage - (damage _unit);
|
||||
if (_selectionName in _hitSelections) then {
|
||||
_newDamage = _damage - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selectionName)));
|
||||
if (_selection in _hitSelections) then {
|
||||
_newDamage = _damage - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selection)));
|
||||
};
|
||||
if ([_unit, [_selectionName] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)) then {
|
||||
if ([_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)) then {
|
||||
if ([_unit] call FUNC(setDead)) then {
|
||||
_damageReturn = 1;
|
||||
};
|
||||
|
@ -33,10 +33,10 @@ _highestPossibleSpot = -1;
|
||||
_highestPossibleDamage = 0;
|
||||
_allPossibleInjuries = [];
|
||||
{
|
||||
/*_classType = _x select 0;
|
||||
_classType = _x select 0;
|
||||
_selections = _x select 1;
|
||||
_bloodLoss = _x select 2;
|
||||
_pain = _x select 3;*/
|
||||
_pain = _x select 3;
|
||||
_minDamage = _x select 4;
|
||||
if (_damage >= _minDamage) then {
|
||||
if ("All" in _selections || _selectionName in _selections) then {
|
||||
@ -51,7 +51,6 @@ _allPossibleInjuries = [];
|
||||
|
||||
// No possible wounds available for this damage type or damage amount.
|
||||
if (_highestPossibleSpot < 0) exitwith {
|
||||
|
||||
// It appears we are dealing with an unknown type of damage.
|
||||
if (count _allInjuriesForDamageType == 0) then {
|
||||
|
||||
@ -74,8 +73,8 @@ _woundsCreated = [];
|
||||
};
|
||||
}foreach (_injuryTypeInfo select 0);
|
||||
|
||||
_unit setvariable [GVAR(openWounds), _openWounds];
|
||||
_unit setvariable[QGVAR(lastUniqueWoundID), _woundID, true];
|
||||
_unit setvariable [QGVAR(openWounds), _openWounds];
|
||||
_unit setvariable [QGVAR(lastUniqueWoundID), _woundID, true];
|
||||
|
||||
{
|
||||
["medical_propagateWound", [_unit, _x]] call EFUNC(common,globalEvent);
|
||||
|
@ -18,7 +18,7 @@ _injuriesRootConfig = (configFile >> "ACE_Medical_Advanced" >> "Injuries");
|
||||
_allTypes = ["stab", "grenade", "bullet", "explosive", "shell", "punch", "vehiclecrash", "backblast", "falling", "bite", "ropeburn"];
|
||||
|
||||
_allFoundDamageTypes = [];
|
||||
_configDamageTypes = (_injuryRouteConfig >> "damageTypes");
|
||||
_configDamageTypes = (_injuriesRootConfig >> "damageTypes");
|
||||
for "_i" from 0 to (count _configDamageTypes -1) /* step +1 */ do {
|
||||
if (isClass(_configDamageTypes select _i)) then {
|
||||
_allFoundDamageTypes pushback (configName (_configDamageTypes select _i));
|
||||
|
@ -25,7 +25,7 @@ if (!local _unit) exitwith {
|
||||
[[_unit, _force], QUOTE(DFUNC(setDead)), _unit, false] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
};
|
||||
|
||||
if (missionName getVariable [QGVAR(enableRevive), false]) exitwith {
|
||||
if (missionNamespace getVariable [QGVAR(enableRevive), false]) exitwith {
|
||||
// TODO Implement the revive state
|
||||
};
|
||||
|
||||
|
@ -32,7 +32,7 @@ if (!local _unit) exitwith {
|
||||
[_unit, ObjNull, [0,0,0]] call EFUNC(common,carryObj);
|
||||
|
||||
// Set the unit in the unconscious state.
|
||||
_unit setvariable ["ACE_isUnconscious",true,true];
|
||||
_unit setvariable ["ACE_isUnconscious", true, true];
|
||||
_unit setUnconscious true;
|
||||
|
||||
// If a unit has the launcher out, it will sometimes start selecting the primairy weapon while unconscious,
|
||||
@ -58,21 +58,13 @@ if (vehicle _unit == _unit) then {
|
||||
_animState = animationState _unit;
|
||||
_originalPos = unitPos _unit;
|
||||
|
||||
// Handle the on screen effects
|
||||
if (isPlayer _unit) then {
|
||||
//[] call EFUNC(common,closeAllDialogs_f);
|
||||
//[true] call FUNC(effectBlackOut);
|
||||
//["unconscious", true] call EFUNC(common,setDisableUserInputStatus);
|
||||
//[false] call EFUNC(common,setVolume_f);
|
||||
} else {
|
||||
//_unit setUnitPos "DOWN";
|
||||
//[_unit, true] call EFUNC(common,disableAI_F);
|
||||
};
|
||||
_unit setUnitPos "DOWN";
|
||||
[_unit, true] call EFUNC(common,disableAI);
|
||||
|
||||
// So the AI does not get stuck, we are moving the unit to a temp group on its own.
|
||||
[_unit, true, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide);
|
||||
|
||||
_captiveSwitch = false; // [_unit, true] call EFUNC(common,setCaptiveSwitch);
|
||||
_captiveSwitch = [_unit, true] call EFUNC(common,setCaptiveSwitch);
|
||||
[_unit, [_unit] call EFUNC(common,getDeathAnim), 1, true] call EFUNC(common,doAnimation);
|
||||
|
||||
_startingTime = time;
|
||||
@ -113,21 +105,15 @@ _minWaitingTime = (round(random(10)+5));
|
||||
if (!_hasMovedOut) then {
|
||||
// Reset the unit back to the previous captive state.
|
||||
if (_captiveSwitch) then {
|
||||
// [_unit, false] call EFUNC(common,setCaptiveSwitch);
|
||||
[_unit, false] call EFUNC(common,setCaptiveSwitch);
|
||||
};
|
||||
|
||||
// Swhich the unit back to its original group
|
||||
[_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide);
|
||||
|
||||
// Reset any visual and audio effects for players, or enable everything again for AI.
|
||||
if (isPlayer _unit) then {
|
||||
//[false] call FUNC(effectBlackOut);
|
||||
//[true] call EFUNC(common,setVolume_f);
|
||||
//["unconscious", false] call EFUNC(common,setDisableUserInputStatus);
|
||||
} else {
|
||||
//[_unit, false] call EFUNC(common,disableAI_F);
|
||||
//_unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP)
|
||||
};
|
||||
[_unit, false] call EFUNC(common,disableAI_F);
|
||||
_unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP)
|
||||
|
||||
_unit setUnconscious false;
|
||||
|
||||
// ensure this statement runs only once
|
||||
|
Loading…
Reference in New Issue
Block a user