mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
add initial implementation of drowning and collision damage handling
This commit is contained in:
parent
209d10065b
commit
7de1a7bc6c
@ -1,14 +1,21 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Handle drowning damage to unit
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit for which the hitpoint damage will be sorted out <OBJECT>
|
||||
* 1: new damage <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_newDamage"];
|
||||
|
||||
private ["_selection", "_totalDamage"];
|
||||
|
||||
_selection = "head";
|
||||
|
||||
_totalDamage = (_unit getHit _selection) + _newDamage;
|
||||
|
||||
_unit setHit [_selection, _totalDamage];
|
||||
|
||||
systemChat format ["drowning: %1", _this];
|
||||
// At the moment we will just not do anything
|
||||
// We reserve this until a later stage
|
||||
// A unit will automatically die once oxygen has ran out anyway
|
||||
|
@ -1,14 +1,63 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Handle fall damage to unit
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit for which the hitpoint damage will be sorted out <OBJECT>
|
||||
* 1: new damage <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_newDamage"];
|
||||
|
||||
private ["_totalDamageL", "_totalDamageR"];
|
||||
private _part = ["leg_l"] call FUNC(selectionNameToNumber);
|
||||
private _part2 = ["leg_r"] call FUNC(selectionNameToNumber);
|
||||
|
||||
_totalDamageL = (_unit getHitPointDamage "HitLeftLeg") + _newDamage;
|
||||
_totalDamageR = (_unit getHitPointDamage "HitRightLeg") + _newDamage;
|
||||
// Store the new damage values in our damageBodyParts store
|
||||
private _damageBodyParts = _unit getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]];
|
||||
_damageBodyParts set [_part, (_damageBodyParts select _part) + _newDamage];
|
||||
_damageBodyParts set [_part2, (_damageBodyParts select _part2) + _newDamage];
|
||||
_unit setVariable [QGVAR(bodyPartStatus), _damageBodyParts];
|
||||
|
||||
_unit setHitPointDamage ["HitLeftLeg", _totalDamageL];
|
||||
_unit setHitPointDamage ["HitRightLeg", _totalDamageR];
|
||||
// our unconscious calculation for selection damages
|
||||
if (alive _unit && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
||||
// If it reaches this, we can assume that the hit did not kill this unit, as this function is called some time after the damage has been passed.
|
||||
if ([_unit, _part, _newDamage * 1.3] call FUNC(determineIfFatal)) then {
|
||||
[_unit, true, 0.5+random(10)] call FUNC(setUnconscious);
|
||||
} else {
|
||||
if ([_unit, _part2, _newDamage * 1.3] call FUNC(determineIfFatal)) then {
|
||||
[_unit, true, 0.5+random(10)] call FUNC(setUnconscious);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemChat format ["falling: %1", _this];
|
||||
if (GVAR(level) > 1) then { // advanced medical is enabled
|
||||
[_unit, "leg_l", _newDamage, "", "falling"] call FUNC(handleDamage_assignWounds); // cover both left and right legs
|
||||
[_unit, "leg_r", _newDamage, "", "falling"] call FUNC(handleDamage_assignWounds);
|
||||
} else {
|
||||
// New pain values
|
||||
_pain = _unit getVariable [QGVAR(pain), 0];
|
||||
_pain = _pain + (_newDamage / 4) * (1 - (_unit getVariable [QGVAR(morphine), 0]));
|
||||
_unit setVariable [QGVAR(pain), _pain min 1, true];
|
||||
};
|
||||
|
||||
// Store the hitpoint values so blood ends up on the unit textures
|
||||
_unit setVariable [QGVAR(bodyPartStatus), _damageBodyParts, true];
|
||||
TRACE_2("ACE_DEBUG: HandleSelectionDamage Broadcast value here", _unit, _unit getVariable QGVAR(bodyPartStatus));
|
||||
|
||||
EXPLODE_6_PVT(_damageBodyParts,_headDamage,_torsoDamage,_handsDamageR,_handsDamageL,_legsDamageR,_legsDamageL);
|
||||
_unit setHitPointDamage ["hitHead", _headDamage min 0.95];
|
||||
_unit setHitPointDamage ["hitBody", _torsoDamage min 0.95];
|
||||
_unit setHitPointDamage ["hitHands", (_handsDamageR + _handsDamageL) min 0.95];
|
||||
_unit setHitPointDamage ["hitLegs", (_legsDamageR + _legsDamageL) min 0.95];
|
||||
|
||||
{
|
||||
private _hitPointName = [_unit, _x, true] call FUNC(translateSelections);
|
||||
_unit setHitPointDamage [_hitPointName, (_damageBodyParts select _foreachIndex) min 0.95];
|
||||
}foreach GVAR(SELECTIONS);
|
||||
|
@ -18,9 +18,6 @@
|
||||
|
||||
params ["_unit", "_selection", "_newDamage", "_projectile"];
|
||||
|
||||
// private _totalDamage = (_unit getHit _selection) + _newDamage;
|
||||
systemChat format["handleSelectionDamage: %1", _this];
|
||||
|
||||
private _part = [_selection] call FUNC(selectionNameToNumber);
|
||||
if (_part < 0) exitwith {systemchat format["Selection name part is below 0"]};
|
||||
|
||||
@ -38,7 +35,6 @@ if (alive _unit && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
||||
};
|
||||
|
||||
if (GVAR(level) > 1) then { // advanced medical is enabled
|
||||
systemChat format["LEVEL OF MEDICAL SYSTEM IS ADVANCED"];
|
||||
_typeOfDamage = [_projectile] call FUNC(getTypeOfDamage); // Get the exact type of damage
|
||||
[_unit, _selection, _newDamage, _projectile, _typeOfDamage] call FUNC(handleDamage_assignWounds);
|
||||
|
||||
@ -53,7 +49,6 @@ if (GVAR(level) > 1) then { // advanced medical is enabled
|
||||
// [_unit,_selectionName,_newDamage,_sourceOfDamage, _typeOfDamage] call FUNC(handleDamage_internalInjuries);
|
||||
//};
|
||||
} else {
|
||||
systemChat format["LEVEL OF MEDICAL SYSTEM IS BASIC"];
|
||||
// New pain values
|
||||
_pain = _unit getVariable [QGVAR(pain), 0];
|
||||
_pain = _pain + (_newDamage / 4) * (1 - (_unit getVariable [QGVAR(morphine), 0]));
|
||||
|
Loading…
Reference in New Issue
Block a user