mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added use and has item functions for medical
This commit is contained in:
parent
c2b8e9031f
commit
b9213e8abc
@ -42,6 +42,8 @@ PREP(addToTriageCard);
|
||||
PREP(actionPlaceInBodyBag);
|
||||
PREP(onTreatmentCompleted);
|
||||
PREP(reactionToDamage);
|
||||
PREP(useItem);
|
||||
PREP(hasItem);
|
||||
|
||||
GVAR(injuredUnitCollection) = [];
|
||||
call FUNC(parseConfigForInjuries);
|
||||
|
44
addons/medical/functions/fnc_hasItem.sqf
Normal file
44
addons/medical/functions/fnc_hasItem.sqf
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Check if the item is present between the patient and the medic
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Medic <OBJECT>
|
||||
* 1: Patient <OBJECT>
|
||||
* 2: Item <STRING>
|
||||
*
|
||||
* ReturnValue:
|
||||
* <NIL>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_medic", "_patient", "_item", "_return"];
|
||||
_medic = _this select 0;
|
||||
_patient = _this select 1;
|
||||
_item = _this select 2;
|
||||
|
||||
if (isnil QGVAR(setting_allowSharedEquipment)) then {
|
||||
GVAR(setting_allowSharedEquipment) = true;
|
||||
};
|
||||
if (GVAR(setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitwith {
|
||||
true;
|
||||
};
|
||||
|
||||
if ([_medic, _item] call EFUNC(common,hasItem)) exitwith {
|
||||
true;
|
||||
};
|
||||
|
||||
_return = false;
|
||||
if ([vehicle _medic] call FUNC(isMedicalVehicle) && {(vehicle _medic != _medic)}) then {
|
||||
_crew = crew vehicle _medic;
|
||||
{
|
||||
if ([_x, _medic] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith {
|
||||
_return = true;
|
||||
};
|
||||
}foreach _crew;
|
||||
};
|
||||
|
||||
_return;
|
@ -26,7 +26,7 @@ _items = _this select 4;
|
||||
|
||||
if (count _items == 0) exitwith {};
|
||||
|
||||
if ([_caller, _target, _items] call FUNC(useEquipment)) then {
|
||||
if ([_caller, _target, _items] call FUNC(useItem)) then {
|
||||
[[_target, _className], QUOTE(FUNC(treatmentBandageLocal)), _target] call EFUNC(common,execRemoteFnc);
|
||||
{
|
||||
if (_x != "") then {
|
||||
|
@ -26,7 +26,7 @@ _items = _this select 4;
|
||||
|
||||
if (count _items == 0) exitwith {};
|
||||
|
||||
if ([_caller, _target, _items] call FUNC(useEquipment)) then {
|
||||
if ([_caller, _target, _items] call FUNC(useItem)) then {
|
||||
[[_target, _className], QUOTE(FUNC(treatmentMedicationLocal)), _target] call EFUNC(common,execRemoteFnc);
|
||||
{
|
||||
if (_x != "") then {
|
||||
|
@ -26,7 +26,7 @@ _items = _this select 4;
|
||||
|
||||
if (count _items == 0) exitwith {};
|
||||
|
||||
if ([_caller, _target, _items] call FUNC(useEquipment)) then {
|
||||
if ([_caller, _target, _items] call FUNC(useItem)) then {
|
||||
_removeItem = _items select 0;
|
||||
[[_target, _removeItem], QUOTE(FUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc);
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
|
@ -38,7 +38,7 @@ if ((_tourniquets select _part) > 0) exitwith {
|
||||
false;
|
||||
};
|
||||
|
||||
if ([_caller, _target, _items] call FUNC(useEquipment)) then {
|
||||
if ([_caller, _target, _items] call FUNC(useItem)) then {
|
||||
_removeItem = _items select 0;
|
||||
[[_target, _removeItem], QUOTE(FUNC(treatmentTourniquetLocal)), _target] call EFUNC(common,execRemoteFnc);
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
|
48
addons/medical/functions/fnc_useItem.sqf
Normal file
48
addons/medical/functions/fnc_useItem.sqf
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Use Equipment if any is available. Priority: 1) Medic, 2) Patient. If in vehicle: 3) Crew
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Medic <OBJECT>
|
||||
* 1: Patient <OBJECT>
|
||||
* 2: Item <STRING>
|
||||
*
|
||||
* ReturnValue:
|
||||
* <NIL>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_medic", "_patient", "_item", "_return","_crew"];
|
||||
_medic = _this select 0;
|
||||
_patient = _this select 1;
|
||||
_item = _this select 2;
|
||||
|
||||
if (isnil QGVAR(setting_allowSharedEquipment)) then {
|
||||
GVAR(setting_allowSharedEquipment) = true;
|
||||
};
|
||||
|
||||
if (GVAR(setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitwith {
|
||||
[[_patient, _item], QUOTE(EFUNC(common,useItem)), _patient] call EFUNC(common,execRemoteFnc);
|
||||
true;
|
||||
};
|
||||
|
||||
if ([_medic, _item] call EFUNC(common,hasItem)) exitwith {
|
||||
[[_medic, _item], QUOTE(EFUNC(common,useItem)), _medic] call EFUNC(common,execRemoteFnc);
|
||||
true;
|
||||
};
|
||||
|
||||
_return = false;
|
||||
if ([vehicle _medic] call FUNC(isMedicalVehicle) && {vehicle _medic != _medic}) then {
|
||||
_crew = crew vehicle _medic;
|
||||
{
|
||||
if ([_x, _medic] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith {
|
||||
_return = true;
|
||||
[[_x, _item], QUOTE(EFUNC(common,useItem)), _x] call EFUNC(common,execRemoteFnc);
|
||||
};
|
||||
}foreach _crew;
|
||||
};
|
||||
|
||||
_return;
|
Loading…
Reference in New Issue
Block a user