mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added isMedic, isMedicalVehicle, isInMedicalFacility and hasTourniquetAppliedTo functions.
This commit is contained in:
parent
b9213e8abc
commit
1781629c13
@ -44,6 +44,10 @@ PREP(onTreatmentCompleted);
|
|||||||
PREP(reactionToDamage);
|
PREP(reactionToDamage);
|
||||||
PREP(useItem);
|
PREP(useItem);
|
||||||
PREP(hasItem);
|
PREP(hasItem);
|
||||||
|
PREP(hasTourniquetAppliedTo);
|
||||||
|
PREP(isMedic);
|
||||||
|
PREP(isInMedicalFacility);
|
||||||
|
PREP(isMedicalVehicle);
|
||||||
|
|
||||||
GVAR(injuredUnitCollection) = [];
|
GVAR(injuredUnitCollection) = [];
|
||||||
call FUNC(parseConfigForInjuries);
|
call FUNC(parseConfigForInjuries);
|
||||||
|
21
addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf
Normal file
21
addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Author: Glowbal
|
||||||
|
* Check if unit has a tourniquet applied to the specified bodypart
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: The Unit <OBJECT>
|
||||||
|
* 1: SelectionName <STRING>
|
||||||
|
*
|
||||||
|
* ReturnValue:
|
||||||
|
* Has tourniquet applied <BOOL>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_target", "_selectionName"];
|
||||||
|
_target = _this select 0;
|
||||||
|
_selectionName = _this select 1;
|
||||||
|
|
||||||
|
(((_target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]) select ([_selectionName] call FUNC(selectionNameToNumber))) > 0);
|
54
addons/medical/functions/fnc_isInMedicalFacility.sqf
Normal file
54
addons/medical/functions/fnc_isInMedicalFacility.sqf
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Author: Glowbal
|
||||||
|
* Checks if a unit is in a designated medical facility
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: The Unit <OBJECT>
|
||||||
|
*
|
||||||
|
* ReturnValue:
|
||||||
|
* Is in medical facility <BOOL>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_unit","_eyePos","_objects","_isInBuilding","_medicalFacility"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
|
||||||
|
_eyePos = eyePos _unit;
|
||||||
|
_isInBuilding = false;
|
||||||
|
|
||||||
|
_medicalFacility =
|
||||||
|
[
|
||||||
|
"TK_GUE_WarfareBFieldhHospital_Base_EP1",
|
||||||
|
"TK_GUE_WarfareBFieldhHospital_EP1",
|
||||||
|
"TK_WarfareBFieldhHospital_Base_EP1",
|
||||||
|
"TK_WarfareBFieldhHospital_EP1",
|
||||||
|
"US_WarfareBFieldhHospital_Base_EP1",
|
||||||
|
"US_WarfareBFieldhHospital_EP1",
|
||||||
|
"MASH_EP1",
|
||||||
|
"MASH",
|
||||||
|
"Land_A_Hospital",
|
||||||
|
"CDF_WarfareBFieldhHospital",
|
||||||
|
"GUE_WarfareBFieldhHospital",
|
||||||
|
"INS_WarfareBFieldhHospital",
|
||||||
|
"RU_WarfareBFieldhHospital",
|
||||||
|
"USMC_WarfareBFieldhHospital"
|
||||||
|
];
|
||||||
|
|
||||||
|
_objects = (lineIntersectsWith [_unit modelToWorld [0, 0, (_eyePos select 2)], _unit modelToWorld [0, 0, (_eyePos select 2) +10], _unit]);
|
||||||
|
{
|
||||||
|
if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitwith {
|
||||||
|
_isInBuilding = true;
|
||||||
|
};
|
||||||
|
}foreach _objects;
|
||||||
|
if (!_isInBuilding) then {
|
||||||
|
_objects = position _unit nearObjects 7.5;
|
||||||
|
{
|
||||||
|
if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitwith {
|
||||||
|
_isInBuilding = true;
|
||||||
|
};
|
||||||
|
}foreach _objects;
|
||||||
|
};
|
||||||
|
_isInBuilding;
|
34
addons/medical/functions/fnc_isMedic.sqf
Normal file
34
addons/medical/functions/fnc_isMedic.sqf
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Author: Glowbal
|
||||||
|
* Check if a unit is any medical class
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: The Unit <OBJECT>
|
||||||
|
* 1: Class <NUMBER> <OPTIONAL>
|
||||||
|
*
|
||||||
|
* ReturnValue:
|
||||||
|
* Is in of medic class <BOOL>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_unit","_class","_return"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
_medicN = if (count _this > 1) then {_this select 1} else {1};
|
||||||
|
|
||||||
|
if (isnil QGVAR(setting_advancedMedicRoles)) exitwith {
|
||||||
|
true;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (GVAR(setting_advancedMedicRoles)) then {
|
||||||
|
_class = _unit getvariable [QGVAR(medicClass), 0];
|
||||||
|
if (_class >= _medicN) then {
|
||||||
|
_return = true;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
_return = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
_return;
|
19
addons/medical/functions/fnc_isMedicalVehicle.sqf
Normal file
19
addons/medical/functions/fnc_isMedicalVehicle.sqf
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Author: Glowbal
|
||||||
|
* Check if vehicle is a medical vehicle
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: The Vehicle <OBJECT>
|
||||||
|
*
|
||||||
|
* ReturnValue:
|
||||||
|
* Is in of medic class <BOOL>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_veh"];
|
||||||
|
_veh = _this select 0;
|
||||||
|
|
||||||
|
if !(_veh getvariable [QGVAR(isMedicalVehicle), true]) exitwith {false}; // exit in case the false is set.
|
||||||
|
((getNumber(configFile >> "CfgVehicles" >> typeOf _veh >> QGVAR(isMedicalVehicle)) == 1) || (_veh getvariable [QGVAR(isMedicalVehicle), false]));
|
Loading…
Reference in New Issue
Block a user