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

Medical - Improve adjustment calcs / wound blood loss / medications #6910

Merged
merged 2 commits into from
Apr 27, 2019

Conversation

PabstMirror
Copy link
Contributor

@PabstMirror PabstMirror commented Mar 31, 2019

Fix pain not reducing over time (_unit setVariable [QEGVAR(medical_status,pain))

Add helper funcs for adding adjustments
lets us skip if (_value != 0 && {_maxTimeInSystem > 0}) then { checking each run, also skip a max

fix removal from arrays, as nil didn't work

x = [1,2,3];
x set [1, nil];
x = x - [nil]

[1,any,3]

Edit:
this PR also

  • Adds GET_WOUND_BLEEDING getVar,
    On any change in wound bleeding (openWound or tourniquite change), we update that var.
    This improves the speed of GET_BLOOD_LOSS function
    It also prevents isBleeding from switching to false when entering cardiac arrest.
    ToDo: merge into medical_ai PR

  • moves #include "\z\ace\addons\medical_engine\script_macros_medical.hpp" up, so we can use debug macros in medical_engine instead of changing them in 11 different modules

@PabstMirror PabstMirror added the kind/bug-fix Release Notes: **FIXED:** label Mar 31, 2019
@PabstMirror PabstMirror added this to the Medical Rewrite milestone Mar 31, 2019
Copy link
Member

@TheMagnetar TheMagnetar left a comment

Choose a reason for hiding this comment

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

If I understood this correctly, pain decreases over time no matter what. I tend to agree with: #5511

@@ -53,7 +53,7 @@ if (_hemorrhage != GET_HEMORRHAGE(_unit)) then {

private _bloodLoss = GET_BLOOD_LOSS(_unit);
if (_bloodLoss > 0) then {
_unit setVariable [QGVAR(bloodloss), _bloodLoss, _syncValues];
_unit setVariable [QGVAR(bloodloss), _bloodLoss, _syncValues]; // ToDo: nothing uses this, remove?
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it should be used to enter unconscious state due to blood loss?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#define GET_BLOOD_LOSS(unit) ([unit] call EFUNC(medical_status,getBloodLoss))
that function has fairly complex calcs, and is called in 10 different places
so maybe we could swap it to use the setVar

Copy link
Member

Choose a reason for hiding this comment

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

I remember this is something I noticed way back too. If I remember right, I determined that that function was probably intended for the vitals loop only and everywhere else was probably meant to be reading the variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See 7a87aad
We can calculate wound blood loss only on events that would change it

@PabstMirror PabstMirror changed the title Medical - Add setter funcs for adjustments Medical - Improve adjustment calcs / wound blood loss Apr 2, 2019
@PabstMirror PabstMirror changed the title Medical - Improve adjustment calcs / wound blood loss Medical - Improve adjustment calcs / wound blood loss / medications Apr 8, 2019
@PabstMirror
Copy link
Contributor Author

This PR now also reworks the medication system vars
Replacing VAR_HEART_RATE_ADJ, VAR_PAIN_SUPP_ADJ, VAR_PERIPH_RES_ADJ and the unimplemented allUsedMedication arrays with a single medication array

Array isn't modified unless a medication is added or falls off, so there should be less syncing overall

Reimplents overdose (ace_medical_treatment_fnc_onMedicationUsage)

@PabstMirror
Copy link
Contributor Author

Before: ace_medical_vitals_Vitals_counter: Average: 0.652908s / 2696 = 0.242177ms
After: ace_medical_vitals_Vitals_counter: Average: 0.609032s / 3422 = 0.177975ms

fix func descriptions

Calc wound blood loss on events

reorder includes so scritpmacroMed has global effect

trivial optimization for getCardiacOutput

Fix var

Fix wounds not reopening (nil _category)

Fix surgical kit inherting canBandage conditional

debug hitpoints

Update ACE_Medical_Treatment_Actions.hpp

Use woundBleeding for IS_BLEEDING macro

rework medication vars

comments

Reset var in init / fullHeal

Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf

Co-Authored-By: PabstMirror <pabstmirror@gmail.com>
Co-Authored-By: PabstMirror <pabstmirror@gmail.com>
@PabstMirror PabstMirror merged commit 847d2d4 into master Apr 27, 2019
@commy2 commy2 deleted the vitalsWork branch April 27, 2019 19:18
BaerMitUmlaut pushed a commit that referenced this pull request Aug 5, 2019
…6910)

* Improve adjustment calcs / wound blood loss / medications

fix func descriptions

Calc wound blood loss on events

reorder includes so scritpmacroMed has global effect

trivial optimization for getCardiacOutput

Fix var

Fix wounds not reopening (nil _category)

Fix surgical kit inherting canBandage conditional

debug hitpoints

Update ACE_Medical_Treatment_Actions.hpp

Use woundBleeding for IS_BLEEDING macro

rework medication vars

comments

Reset var in init / fullHeal

Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf

Co-Authored-By: PabstMirror <pabstmirror@gmail.com>

* Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf

Co-Authored-By: PabstMirror <pabstmirror@gmail.com>
@PabstMirror PabstMirror modified the milestones: Medical Rewrite, 3.13.0 Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug-fix Release Notes: **FIXED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants