-
Notifications
You must be signed in to change notification settings - Fork 740
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Medical - Add API for getting unit wounds (#10544)
- Loading branch information
1 parent
fd28405
commit 6ddd020
Showing
4 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: LinkIsGrim | ||
* Returns a copy of unit's bandaged wounds on a body part. | ||
* | ||
* Arguments: | ||
* 0: Unit <OBJECT> | ||
* 1: Body Part <STRING> | ||
* | ||
* Return Value: | ||
* Wounds <ARRAY of ARRAY>: | ||
* 0: Wound Class ID <NUMBER> | ||
* 1: Wound Bandaged Amount <NUMBER> | ||
* 2: Wound Bleeding Coef <NUMBER> | ||
* 3: Wound Damage <NUMBER> | ||
* | ||
* Example: | ||
* [player, "head"] call ace_medical_fnc_getBandagedWounds | ||
* | ||
* Public: Yes | ||
*/ | ||
|
||
params [["_unit", objNull, [objNull]], ["_bodyPart", "", [""]]]; | ||
|
||
if (isNull _unit) exitWith { | ||
ERROR("getBandagedWounds - null unit"); | ||
|
||
[] | ||
}; | ||
|
||
if !(_unit isKindOf "CAManBase") exitWith { | ||
ERROR_2("getBandagedWounds - unit %1 is not child of CAManBase - type %2",_unit,typeOf _unit); | ||
|
||
[] | ||
}; | ||
|
||
_bodyPart = toLowerANSI _bodyPart; | ||
|
||
if !(_bodyPart in ALL_BODY_PARTS) exitWith { | ||
ERROR_2("getBandagedWounds - invalid body part %1, expected one of %2",_bodyPart,ALL_BODY_PARTS); | ||
|
||
[] | ||
}; | ||
|
||
private _bandagedWounds = []; | ||
|
||
{ | ||
_bandagedWounds pushBack +_x; // manual deep copy so modification doesn't affect unit state | ||
} forEach (GET_OPEN_WOUNDS(_patient) getOrDefault [_bodyPart, []]); | ||
|
||
_bandagedWounds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: LinkIsGrim | ||
* Returns a copy of unit's open wounds on a body part. | ||
* | ||
* Arguments: | ||
* 0: Unit <OBJECT> | ||
* 1: Body Part <STRING> | ||
* | ||
* Return Value: | ||
* Wounds <ARRAY of ARRAY>: | ||
* 0: Wound Class ID <NUMBER> | ||
* 1: Wound Open Amount <NUMBER> | ||
* 2: Wound Bleeding Coef <NUMBER> | ||
* 3: Wound Damage <NUMBER> | ||
* | ||
* Example: | ||
* [player, "head"] call ace_medical_fnc_getOpenWounds | ||
* | ||
* Public: Yes | ||
*/ | ||
|
||
params [["_unit", objNull, [objNull]], ["_bodyPart", "", [""]]]; | ||
|
||
if (isNull _unit) exitWith { | ||
ERROR("getOpenWounds - null unit"); | ||
|
||
[] | ||
}; | ||
|
||
if !(_unit isKindOf "CAManBase") exitWith { | ||
ERROR_2("getOpenWounds - unit %1 is not child of CAManBase - type %2",_unit,typeOf _unit); | ||
|
||
[] | ||
}; | ||
|
||
_bodyPart = toLowerANSI _bodyPart; | ||
|
||
if !(_bodyPart in ALL_BODY_PARTS) exitWith { | ||
ERROR_2("getOpenWounds - invalid body part %1, expected one of %2",_bodyPart,ALL_BODY_PARTS); | ||
|
||
[] | ||
}; | ||
|
||
private _openWounds = []; | ||
|
||
{ | ||
_x params ["", "_xAmount"]; | ||
if (_xAmount > 0) then { // bandaged wounds are open wounds with count 0, skip those | ||
_openWounds pushBack +_x; // manual deep copy so modification doesn't affect unit state | ||
}; | ||
} forEach (GET_OPEN_WOUNDS(_patient) getOrDefault [toLowerANSI _bodyPart, []]); | ||
|
||
_openWounds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: LinkIsGrim | ||
* Returns a copy of unit's stitched wounds on a body part. | ||
* | ||
* Arguments: | ||
* 0: Unit <OBJECT> | ||
* 1: Body Part <STRING> | ||
* | ||
* Return Value: | ||
* Wounds <ARRAY of ARRAY>: | ||
* 0: Wound Class ID <NUMBER> | ||
* 1: Wound Stitched Amount <NUMBER> | ||
* 2: Wound Bleeding Coef <NUMBER> | ||
* 3: Wound Damage <NUMBER> | ||
* | ||
* Example: | ||
* [player, "head"] call ace_medical_fnc_getStitchedWounds | ||
* | ||
* Public: Yes | ||
*/ | ||
|
||
params [["_unit", objNull, [objNull]], ["_bodyPart", "", [""]]]; | ||
|
||
if (isNull _unit) exitWith { | ||
ERROR("getStitchedWounds - null unit"); | ||
|
||
[] | ||
}; | ||
|
||
if !(_unit isKindOf "CAManBase") exitWith { | ||
ERROR_2("getStitchedWounds - unit %1 is not child of CAManBase - type %2",_unit,typeOf _unit); | ||
|
||
[] | ||
}; | ||
|
||
_bodyPart = toLowerANSI _bodyPart; | ||
|
||
if !(_bodyPart in ALL_BODY_PARTS) exitWith { | ||
ERROR_2("getStitchedWounds - invalid body part %1, expected one of %2",_bodyPart,ALL_BODY_PARTS); | ||
|
||
[] | ||
}; | ||
|
||
private _stitchedWounds = []; | ||
|
||
{ | ||
_stitchedWounds pushBack +_x; // manual deep copy so modification doesn't affect unit state | ||
} forEach (GET_STITCHED_WOUNDS(_patient) getOrDefault [toLowerANSI _bodyPart, []]); | ||
|
||
_stitchedWounds |