Fixed advancedLocal treatment function. Now also selects primary weapon of caller when performing treatment.

This commit is contained in:
Thomas Kooi 2015-01-22 22:25:59 +01:00
parent e7ebcbe3fb
commit b173b21c51
2 changed files with 14 additions and 12 deletions

View File

@ -36,12 +36,13 @@ if ([_caller] call FUNC(isSetTreatmentMutex)) exitwith {
if (!([_caller, _target, _removeItem] call FUNC(hasEquipment)) && _removeItem != "") exitwith { if (!([_caller, _target, _removeItem] call FUNC(hasEquipment)) && _removeItem != "") exitwith {
[_caller, false] call FUNC(treatmentMutex); [_caller, false] call FUNC(treatmentMutex);
false;
}; };
if (primaryWeapon _caller == "") then { if (primaryWeapon _caller == "") then {
_caller addWeapon "ACE_FakePrimaryWeapon"; _caller addWeapon "ACE_FakePrimaryWeapon";
}; };
_caller selectWeapon (primaryWeapon _unit); _caller selectWeapon (primaryWeapon _caller);
// TODO make dynamic // TODO make dynamic
switch (toLower _category) do { switch (toLower _category) do {

View File

@ -1,5 +1,5 @@
/** /**
* fn_heal.sqf * fnc_handleTreatment_Action_AdvancedLocal.sqf
* @Descr: N/A * @Descr: N/A
* @Author: Glowbal * @Author: Glowbal
* *
@ -19,26 +19,27 @@ _prevAnim = _this select 4;
// TODO old code, has to be replaced by something more dynamic. // TODO old code, has to be replaced by something more dynamic.
_attributes = switch (_removeItem) do { _attributes = switch (_removeItem) do {
case "cse_blood_iv": {["cse_bloodIVVolume",1000,"Blood IV"]}; case "ACE_blood_iv": {[QGVAR(bloodIVVolume),1000,"Blood IV"]};
case "cse_saline_iv": {["cse_salineIVVolume",1000,"Saline IV"]}; case "ACE_saline_iv": {[QGVAR(salineIVVolume),1000,"Saline IV"]};
case "cse_plasma_iv": {["cse_plasmaIVVolume",1000,"Plasma IV"]}; case "ACE_plasma_iv": {[QGVAR(plasmaIVVolume),1000,"Plasma IV"]};
case "cse_blood_iv_500": {["cse_bloodIVVolume",500,"Blood IV"]}; case "ACE_blood_iv_500": {[QGVAR(bloodIVVolume),500,"Blood IV"]};
case "cse_saline_iv_500": {["cse_salineIVVolume",500,"Saline IV"]}; case "ACE_saline_iv_500": {[QGVAR(salineIVVolume),500,"Saline IV"]};
case "cse_plasma_iv_500": {["cse_plasmaIVVolume",500,"Plasma IV"]}; case "ACE_plasma_iv_500": {[QGVAR(plasmaIVVolume),500,"Plasma IV"]};
case "cse_blood_iv_250": {["cse_bloodIVVolume",250,"Blood IV"]}; case "ACE_blood_iv_250": {[QGVAR(bloodIVVolume),250,"Blood IV"]};
case "cse_saline_iv_250": {["cse_salineIVVolume",250,"Saline IV"]}; case "ACE_saline_iv_250": {[QGVAR(salineIVVolume),250,"Saline IV"]};
case "cse_plasma_iv_250": {["cse_plasmaIVVolume",250,"Plasma IV"]}; case "ACE_plasma_iv_250": {[QGVAR(plasmaIVVolume),250,"Plasma IV"]};
default {[]}; default {[]};
}; };
if (count _attributes > 1) then { if (count _attributes > 1) then {
_value = [_target,(_attributes select 0)] call EFUNC(common,getDefinedVariable); _value = [_target,(_attributes select 0)] call EFUNC(common,getDefinedVariable);
_value = _value + (_attributes select 1); _value = _value + (_attributes select 1);
[_target,(_attributes select 0),_value] call EFUNC(common,setDefinedVariable); [_target,(_attributes select 0),_value] call EFUNC(common,setDefinedVariable);
// TODO localization // TODO localization
[_target,"treatment",format["%1 has given %4 a %2(%3ml)",[_caller] call cse_fnc_getName,_attributes select 2,_attributes select 1,_target]] call FUNC(addActivityToLog); [_target,"treatment",format["%1 has given %4 a %2(%3ml)",[_caller] call EFUNC(common,getName),_attributes select 2,_attributes select 1,_target]] call FUNC(addActivityToLog);
[_target,_removeItem] call FUNC(addToTriageList); [_target,_removeItem] call FUNC(addToTriageList);
}; };