mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #1602 from acemod/medicalFallingFix2
[Adv. Medical] Improved falling damage
This commit is contained in:
commit
e0bb3c0a4e
@ -328,6 +328,7 @@ class ACE_Medical_Advanced {
|
|||||||
class Large {
|
class Large {
|
||||||
name = CSTRING(Wounds_Abrasion_Large);
|
name = CSTRING(Wounds_Abrasion_Large);
|
||||||
minDamage = 0.3;
|
minDamage = 0.3;
|
||||||
|
maxDamage = 0.5;
|
||||||
bleedingRate = 0.0002;
|
bleedingRate = 0.0002;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_unit", "_selectionName","_damage", "_source","_projectile","_hitSelections","_hitPoints","_newDamage","_cache_hitpoints","_cache_projectiles","_cache_params","_cache_damages"];
|
private ["_unit", "_selectionName", "_damage", "_source", "_projectile", "_hitSelections", "_hitPoints", "_impactVelocity", "_newDamage", "_cache_hitpoints", "_cache_projectiles", "_cache_params", "_cache_damages"];
|
||||||
_unit = _this select 0;
|
_unit = _this select 0;
|
||||||
_selectionName = _this select 1;
|
_selectionName = _this select 1;
|
||||||
_damage = _this select 2;
|
_damage = _this select 2;
|
||||||
@ -46,21 +46,29 @@ if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isN
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// From AGM medical:
|
// Handle falling damage
|
||||||
// Exclude falling damage to everything other than legs; reduce structural damage.
|
_impactVelocity = (velocity _unit) select 2;
|
||||||
if (((velocity _unit) select 2 < -5) && {(vehicle _unit == _unit)}) then {
|
if (_impactVelocity < -5 && {vehicle _unit == _unit}) then {
|
||||||
_unit setVariable [QGVAR(isFalling), true];
|
_unit setVariable [QGVAR(isFalling), true];
|
||||||
|
_unit setVariable [QGVAR(impactVelocity), _impactVelocity];
|
||||||
|
};
|
||||||
|
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";
|
_projectile = "falling";
|
||||||
_this set [4, "falling"];
|
_this set [4, "falling"];
|
||||||
};
|
};
|
||||||
if (_unit getVariable [QGVAR(isFalling), false] && {!(_selectionName in ["", "leg_l", "leg_r"])}) exitWith {0};
|
|
||||||
if (_unit getVariable [QGVAR(isFalling), false]) then {
|
|
||||||
if (_selectionName == "") then {
|
|
||||||
_selectionName = ["leg_l", "leg_r"] select (floor(random 2));
|
|
||||||
};
|
|
||||||
_this set [1, _selectionName];
|
|
||||||
_newDamage = _newDamage * 0.7;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Finished with the current frame, reset variables
|
// Finished with the current frame, reset variables
|
||||||
// Note: sometimes handleDamage spans over 2 or even 3 frames.
|
// Note: sometimes handleDamage spans over 2 or even 3 frames.
|
||||||
@ -95,7 +103,7 @@ if (_selectionName != "") then {
|
|||||||
private ["_index","_otherDamage"];
|
private ["_index","_otherDamage"];
|
||||||
_index = _cache_projectiles find _projectile;
|
_index = _cache_projectiles find _projectile;
|
||||||
// Check if the current projectile has already been handled once
|
// Check if the current projectile has already been handled once
|
||||||
if (_index >= 0) exitwith {
|
if (_index >= 0 && {_projectile != "falling"}) exitwith {
|
||||||
_cache_damages = _unit getVariable QGVAR(cachedDamages);
|
_cache_damages = _unit getVariable QGVAR(cachedDamages);
|
||||||
// Find the previous damage this projectile has done
|
// Find the previous damage this projectile has done
|
||||||
_otherDamage = (_cache_damages select _index);
|
_otherDamage = (_cache_damages select _index);
|
||||||
|
Loading…
Reference in New Issue
Block a user