mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Implemented useItems for treatment (basic and adv)
Will remove items on treatment start. Add again on treatmentFailure. Based upon consumeItem config setting.
This commit is contained in:
parent
038ed5f23e
commit
05389e7e25
@ -26,10 +26,6 @@ class CfgVehicles {
|
||||
description = "What is the medical simulation level?";
|
||||
typeName = "NUMBER";
|
||||
class values {
|
||||
class disable {
|
||||
name = "Disabled";
|
||||
value = 0;
|
||||
};
|
||||
class normal {
|
||||
name = "Basic";
|
||||
value = 1;
|
||||
@ -43,11 +39,11 @@ class CfgVehicles {
|
||||
};
|
||||
class enableFor {
|
||||
displayName = "Enabled for";
|
||||
description = "Select what units the medical system will be enabled for";
|
||||
description = "Select what units the medical system will be enabled for (Adv only)";
|
||||
typeName = "NUMBER";
|
||||
class values {
|
||||
class playableUnits {
|
||||
name = "Players only";
|
||||
name = "Players only.";
|
||||
value = 0;
|
||||
default = 1;
|
||||
};
|
||||
@ -60,19 +56,19 @@ class CfgVehicles {
|
||||
// TODO Disabled until the features are implemented
|
||||
/*class enableAirway {
|
||||
displayName = "Enable Airway";
|
||||
description = "Enable Advanced medical Airway";
|
||||
description = "Enable Advanced medical Airway (Adv only)";
|
||||
typeName = "BOOL";
|
||||
defaultValue = 0;
|
||||
};
|
||||
class enableFractures {
|
||||
displayName = "Enable Fractures";
|
||||
description = "Enable Advanced medical Fractures";
|
||||
description = "Enable Advanced medical Fractures (Adv only)";
|
||||
typeName = "BOOL";
|
||||
defaultValue = 0;
|
||||
};*/
|
||||
class enableAdvancedWounds {
|
||||
displayName = "Enable Advanced wounds";
|
||||
description = "Allow reopening of bandaged wounds?";
|
||||
description = "Allow reopening of bandaged wounds? (Adv only)";
|
||||
typeName = "BOOL";
|
||||
defaultValue = 0;
|
||||
};
|
||||
|
@ -26,8 +26,6 @@ _projectile = _this select 4;
|
||||
|
||||
if !(local _unit) exitWith {nil};
|
||||
|
||||
if !([_unit] call FUNC(hasMedicalEnabled)) exitwith {};
|
||||
|
||||
if (typeName _projectile == "OBJECT") then {
|
||||
_projectile = typeOf _projectile;
|
||||
_this set [4, _projectile];
|
||||
@ -38,11 +36,17 @@ _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"];
|
||||
if !(_selection in (_hitSelections + [""])) exitWith {0};
|
||||
|
||||
_damageReturn = _damage;
|
||||
if (GVAR(level) == 1) then {
|
||||
if (GVAR(level) < 2) then {
|
||||
_damageReturn = _this call FUNC(handleDamage_basic);
|
||||
};
|
||||
|
||||
if (GVAR(level) >= 2) then {
|
||||
if !([_unit] call FUNC(hasMedicalEnabled)) exitwith {
|
||||
// Because of the config changes, we cannot properly disable the medical system for a unit.
|
||||
// lets use basic for the time being..
|
||||
_this call FUNC(handleDamage_basic);
|
||||
};
|
||||
|
||||
[_unit, _selection, _damage, _source, _projectile] call FUNC(handleDamage_caching);
|
||||
|
||||
if (_damageReturn > 0.9) then {
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller", "_target", "_selectionName", "_className", "_config", "_availableLevels", "_medicRequired", "_items", "_locations", "_return", "_callbackSuccess", "_callbackFailure", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return"];
|
||||
private ["_caller", "_target", "_selectionName", "_className", "_config", "_availableLevels", "_medicRequired", "_items", "_locations", "_return", "_callbackSuccess", "_callbackFailure", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_selectionName = _this select 2;
|
||||
@ -71,6 +71,10 @@ if ("All" in _locations) then {
|
||||
|
||||
if !(_return) exitwith {false};
|
||||
|
||||
_usersOfItems = [];
|
||||
if (getNumber (_config >> "itemConsumed") > 0) then {
|
||||
_usersOfItems = ([_caller, _target, _items] call FUNC(useItems)) select 1;
|
||||
};
|
||||
|
||||
// Parse the config for the progress callback
|
||||
_callbackProgress = getText (_config >> "callbackProgress");
|
||||
@ -115,7 +119,7 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then {
|
||||
_treatmentTime = getNumber (_config >> "treatmentTime");
|
||||
[
|
||||
_treatmentTime,
|
||||
[_caller, _target, _selectionName, _className, _items],
|
||||
[_caller, _target, _selectionName, _className, _items, _usersOfItems],
|
||||
DFUNC(treatment_success),
|
||||
DFUNC(treatment_failure),
|
||||
getText (_config >> "displayNameProgress"),
|
||||
@ -140,5 +144,4 @@ if (_displayText != "") then {
|
||||
["displayTextStructured", [_caller], [[_displayText, [_caller] call EFUNC(common,getName), [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent);
|
||||
};
|
||||
|
||||
|
||||
true;
|
||||
|
@ -25,18 +25,18 @@ _className = _this select 3;
|
||||
_items = _this select 4;
|
||||
_specificSpot = if (count _this > 5) then {_this select 5} else {-1};
|
||||
|
||||
if (count _items == 0) exitwith {};
|
||||
|
||||
if ([_caller, _target, _items] call FUNC(useItems)) then {
|
||||
[[_target, _className, _selectionName, _specificSpot], QUOTE(DFUNC(treatmentAdvanced_bandageLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
/* {
|
||||
if (_x != "") then {
|
||||
[_target, _x] call FUNC(addToTriageCard);
|
||||
};
|
||||
}foreach _items;*/
|
||||
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
[_target, "activity", "STR_ACE_MEDICAL_ACTIVITY_bandagedPatient", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
if !([_target] call FUNC(hasMedicalEnabled)) exitwith {
|
||||
_this call FUNC(treatmentBasic_bandage);
|
||||
};
|
||||
|
||||
[[_target, _className, _selectionName, _specificSpot], QUOTE(DFUNC(treatmentAdvanced_bandageLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
/* {
|
||||
if (_x != "") then {
|
||||
[_target, _x] call FUNC(addToTriageCard);
|
||||
};
|
||||
}foreach _items;*/
|
||||
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
[_target, "activity", "STR_ACE_MEDICAL_ACTIVITY_bandagedPatient", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
|
||||
true;
|
||||
|
@ -24,18 +24,15 @@ _selectionName = _this select 2;
|
||||
_className = _this select 3;
|
||||
_items = _this select 4;
|
||||
|
||||
if (count _items == 0) exitwith {};
|
||||
[[_target, _className], QUOTE(DFUNC(treatmentAdvanced_medicationLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
|
||||
if ([_caller, _target, _items] call FUNC(useItems)) then {
|
||||
[[_target, _className], QUOTE(DFUNC(treatmentAdvanced_medicationLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
{
|
||||
if (_x != "") then {
|
||||
[_target, _x] call FUNC(addToTriageCard);
|
||||
};
|
||||
}foreach _items;
|
||||
{
|
||||
if (_x != "") then {
|
||||
[_target, _x] call FUNC(addToTriageCard);
|
||||
};
|
||||
}foreach _items;
|
||||
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
[_target, "activity", "STR_ACE_MEDICAL_ACTIVITY_usedItem", [[_caller] call EFUNC(common,getName), _className]] call FUNC(addToLog);
|
||||
};
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
[_target, "activity", "STR_ACE_MEDICAL_ACTIVITY_usedItem", [[_caller] call EFUNC(common,getName), _className]] call FUNC(addToLog);
|
||||
|
||||
true;
|
||||
|
@ -26,10 +26,8 @@ _items = _this select 4;
|
||||
|
||||
if (count _items == 0) exitwith {};
|
||||
|
||||
if ([_caller, _target, _items] call FUNC(useItems)) then {
|
||||
_removeItem = _items select 0;
|
||||
[[_target, _removeItem], QUOTE(DFUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
[_target, _removeItem] call FUNC(addToTriageCard);
|
||||
[_target, "activity", "STR_ACE_MEDICAL_ACTIVITY_gaveIV", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
};
|
||||
_removeItem = _items select 0;
|
||||
[[_target, _removeItem], QUOTE(DFUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
[_target, _removeItem] call FUNC(addToTriageCard);
|
||||
[_target, "activity", "STR_ACE_MEDICAL_ACTIVITY_gaveIV", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
|
@ -39,12 +39,11 @@ if ((_tourniquets select _part) > 0) exitwith {
|
||||
false;
|
||||
};
|
||||
|
||||
if ([_caller, _target, _items] call FUNC(useItems)) then {
|
||||
_removeItem = _items select 0;
|
||||
[[_target, _removeItem], QUOTE(DFUNC(treatmentTourniquetLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
[_target, _removeItem] call FUNC(addToTriageCard);
|
||||
[_target, "activity", "STR_ACE_MEDICAL_ACTIVITY_appliedTourniquet", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
};
|
||||
_removeItem = _items select 0;
|
||||
[[_target, _removeItem], QUOTE(DFUNC(treatmentTourniquetLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent;
|
||||
[_target, _removeItem] call FUNC(addToTriageCard);
|
||||
[_target, "activity", "STR_ACE_MEDICAL_ACTIVITY_appliedTourniquet", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
|
||||
|
||||
true;
|
||||
|
@ -17,13 +17,14 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller", "_target","_selectionName","_className","_config","_callback"];
|
||||
private ["_caller", "_target","_selectionName","_className","_config","_callback", "_usersOfItems"];
|
||||
|
||||
_args = _this select 0;
|
||||
_caller = _args select 0;
|
||||
_target = _args select 1;
|
||||
_selectionName = _args select 2;
|
||||
_className = _args select 3;
|
||||
_usersOfItems = _args select 5;
|
||||
|
||||
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
|
||||
_caller removeWeapon "ACE_FakePrimaryWeapon";
|
||||
@ -31,7 +32,9 @@ if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
|
||||
[_caller, _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""], 1] call EFUNC(common,doAnimation);
|
||||
_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil];
|
||||
|
||||
// @todo remove item?
|
||||
{
|
||||
(_x select 0) addItem (_x select 1);
|
||||
}foreach _usersOfItems;
|
||||
|
||||
// Record specific callback
|
||||
_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
|
||||
@ -46,4 +49,4 @@ if (isNil _callback) then {
|
||||
_callback = missionNamespace getvariable _callback;
|
||||
};
|
||||
|
||||
_args call _callback
|
||||
_args call _callback;
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller", "_target","_selectionName","_className","_config","_callback"];
|
||||
|
||||
_args = _this select 0;
|
||||
_caller = _args select 0;
|
||||
_target = _args select 1;
|
||||
@ -31,8 +30,6 @@ if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
|
||||
[_caller, _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""], 1] call EFUNC(common,doAnimation);
|
||||
_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil];
|
||||
|
||||
// @todo remove item
|
||||
|
||||
// Record specific callback
|
||||
_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
|
||||
if (GVAR(level) >= 2) then {
|
||||
@ -46,4 +43,4 @@ if (isNil _callback) then {
|
||||
_callback = missionNamespace getvariable _callback;
|
||||
};
|
||||
|
||||
_args call _callback
|
||||
_args call _callback;
|
||||
|
@ -26,20 +26,20 @@ if (isnil QGVAR(setting_allowSharedEquipment)) then {
|
||||
|
||||
if (GVAR(setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitwith {
|
||||
[[_patient, _item], QUOTE(EFUNC(common,useItem)), _patient] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
true;
|
||||
[true, _patient];
|
||||
};
|
||||
|
||||
if ([_medic, _item] call EFUNC(common,hasItem)) exitwith {
|
||||
[[_medic, _item], QUOTE(EFUNC(common,useItem)), _medic] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
true;
|
||||
[true, _medic];
|
||||
};
|
||||
|
||||
_return = false;
|
||||
_return = [false, objNull];
|
||||
if ([vehicle _medic] call FUNC(isMedicalVehicle) && {vehicle _medic != _medic}) then {
|
||||
_crew = crew vehicle _medic;
|
||||
{
|
||||
if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith {
|
||||
_return = true;
|
||||
_return = [true, _x];
|
||||
[[_x, _item], QUOTE(EFUNC(common,useItem)), _x] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
};
|
||||
}foreach _crew;
|
||||
|
@ -15,21 +15,26 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_medic", "_patient", "_items"];
|
||||
private ["_medic", "_patient", "_items", "_itemUsedInfo", "_itemsUsedBy"];
|
||||
_medic = _this select 0;
|
||||
_patient = _this select 1;
|
||||
_items = _this select 2;
|
||||
|
||||
_itemsUsedBy = [];
|
||||
{
|
||||
// handle a one of type use item
|
||||
if (typeName _x == "ARRAY") then {
|
||||
{
|
||||
if ([_medic, _patient, _x] call FUNC(useItem)) exitwith {};
|
||||
_itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem);
|
||||
if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]};
|
||||
}foreach _x;
|
||||
};
|
||||
|
||||
// handle required item
|
||||
if (typeName _x == "STRING") then {
|
||||
[_medic, _patient, _x] call FUNC(useItem);
|
||||
_itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem);
|
||||
if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]};
|
||||
};
|
||||
}foreach _items;
|
||||
|
||||
[count _items == count _itemsUsedBy, _itemsUsedBy];
|
||||
|
Loading…
Reference in New Issue
Block a user