ACE3/addons/medical_treatment/functions/fnc_getStitchTime.sqf
Kyle Mckay 02365609b5
Medical - Change medical to use hashmaps for wound storage (#8926)
* Refactor medical to use hashmaps for wound storage

- We most frequently want to access wounds by body part, so this makes
  that a constant time lookup.
- The body part index is no longer stored in every wound since it's
  inherent in the wound storage.
- Using body part names as the keys of the hashmap to improve code
  clarity (no more magic numbers).

closes #6468

* Add deserilization migration from old wound arrays

Will migrate from old form array wound storage to the new hashmap
strucutre during deserlization. This is relevant for communities piping
medical state out to a database or similar between sessions.

* fix issue with suture stitching

* change version number in comment

---------

Co-authored-by: Salluci <salluci.lovi@gmail.com>
2023-06-24 08:11:56 +03:00

29 lines
576 B
Plaintext

#include "script_component.hpp"
/*
* Author: kymckay
* Calculates the Surgical Kit treatment time based on the amount of stitchable wounds.
*
* Arguments:
* 0: Medic (not used) <OBJECT>
* 1: Patient <OBJECT>
*
* Return Value:
* Treatment Time <NUMBER>
*
* Example:
* [player, cursorObject] call ace_medical_treatment_fnc_getStitchTime
*
* Public: No
*/
params ["", "_patient"];
private _stitchableTotal = 0;
{
_stitchableTotal = _stitchableTotal + count _y;
} forEach (_patient call FUNC(getStitchableWounds));
_stitchableTotal * GVAR(woundStitchTime)