Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle fire damage into larger chunks #4223

Merged
merged 1 commit into from
Sep 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions addons/medical/functions/fnc_handleDamage_advanced.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
* 3: Shooter <OBJECT>
* 4: Projectile <STRING>
* 5: Hit part index of the hit point <NUMBER>
* 6: Current damage to be returned <NUMBER>
*
* //On 1.63 dev:
* 6: Shooter? <OBJECT>
* 7: Current damage to be returned <NUMBER>
*
Expand All @@ -23,12 +20,23 @@

#include "script_component.hpp"

params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfProjectile", "_hitPointNumber", "_newDamage"];
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfProjectile", "_hitPointNumber", "", "_newDamage"];

//Temp fix for 1.63 handleDamage changes
if (_newDamage isEqualType objNull) then {
_newDamage = _this select 7;
};
// For burning damage we will get a ton of very small hits of damage; they are too small to create any wounds
// Save them up in a variable and run when it is over a noticable amount

if ((_typeOfProjectile == "") && {_newDamage < 0.15} && {
Copy link
Contributor

@thojkooi thojkooi Aug 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that fire is the only damage source that matches this condition? iirc falling also gives you an empty projectile string. Same with being driven over and a few other cases.

And would it matter if we match those here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only kicks in for damage < 0.15 and I think most physx damage should be more than that, but can't guarentee.

The core problem is that we are increasing bodyPartStatus without adding new wounds.
Without wounds, the damage can't be healed, because bandageLocal does:
if (count _openWounds == 0) exitWith {false}; // nothing to do here!

I could try to do the fix there; so that GVAR(healHitPointAfterAdvBandage) or basic medical can still heal the hitpoints even if there are no wounds?

_newDamage = _newDamage + (_unit getVariable [QGVAR(trivialDamage), 0]);
if (_newDamage > 0.15) then {
// if the new sum is large enough, reset variable and continue with it added in
_unit setVariable [QGVAR(trivialDamage), 0];
false
} else {
// otherwise just save the new sum into the variable and exit
_unit setVariable [QGVAR(trivialDamage), _newDamage];
true // exit
};
}) exitWith {};

private _part = [_selectionName] call FUNC(selectionNameToNumber);
if (_part < 0) exitWith {};
Expand Down
2 changes: 2 additions & 0 deletions addons/medical/functions/fnc_handleDamage_wounds.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"];
TRACE_6("ACE_DEBUG: HandleDamage Called",_unit, _selectionName, _damage, _shooter, _typeOfProjectile,_typeOfDamage);

if (_typeOfDamage == "") then {_typeOfDamage = "unknown";};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is necessary here, it's also necessary in the sqf fallback method for wounds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fallback already does this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, my bad. Awesome! 👍


// Administration for open wounds and ids
private _openWounds = _unit getVariable[QGVAR(openWounds), []];
private _woundID = _unit getVariable[QGVAR(lastUniqueWoundID), 1];
Expand Down