Fixed tourniquet treatment actions.

This commit is contained in:
Thomas Kooi 2015-01-18 23:58:10 +01:00
parent 5745408647
commit a890400c55
4 changed files with 52 additions and 122 deletions

View File

@ -10,34 +10,53 @@
#include "script_component.hpp"
private ["_caller","_unit","_part","_selectionName","_removeItem","_tourniquets"];
_unit = _this select 0;
_caller = _this select 1;
private ["_caller","_target","_part","_selectionName","_removeItem","_tourniquets"];
_caller = _this select 0;
_target = _this select 1;
_selectionName = _this select 2;
[_caller,"You attempt to remove a tourniquet"] call EFUNC(common,sendHintTo);
if (call FUNC(isSetTreatmentMutex)) exitwith {["MUTEX HAS BEEN SET - EXITING"] call EFUNC(common,debug);};
[_caller,"set"] call FUNC(treatmentMutex);
if ([_caller] call FUNC(isSetTreatmentMutex)) exitwith {["MUTEX HAS BEEN SET - EXITING"] call EFUNC(common,debug);};
[_caller,true] call FUNC(treatmentMutex);
_part = [_selectionName] call FUNC(getBodyPartNumber);
_tourniquets = [_target,QGVAR(tourniquets)] call EFUNC(common,getDefinedVariable);
if !([_unit, _selectionName] call FUNC(hasTourniquetAppliedTo)) exitwith {
[_caller,"release"] call FUNC(treatmentMutex);
if ((_tourniquets select _part) == 0) exitwith {
[_caller, false] call FUNC(treatmentMutex);
[_caller,"There is no tourniquet on this body part!"] call EFUNC(common,sendHintTo);
};
if (vehicle _caller == _caller && (vehicle _unit == _unit)) then {
if (vehicle _caller == _caller && (vehicle _target == _target)) then {
[_caller,"AinvPknlMstpSlayWrflDnon_medic", 1] call EFUNC(common,doAnimation);
};
GVAR(ORIGINAL_POSITION_PLAYER) = getPos _caller;
if !([5,{((vehicle player != player) ||((getPos player) distance GVAR(ORIGINAL_POSITION_PLAYER)) < 1)}, {},{hint "Action aborted. You moved away";}] call EFUNC(gui,loadingBar)) exitwith {
[_caller,"release"] call FUNC(treatmentMutex);
};
_part = [_selectionName] call FUNC(getBodyPartNumber);
_tourniquets = [_unit,QGVAR(tourniquets)] call EFUNC(common,getDefinedVariable);
_tourniquets set[_part,0];
[_unit,QGVAR(tourniquets),_tourniquets] call EFUNC(common,setDefinedVariable);
_caller addMagazine "ACE_tourniquet";
[_caller,"release"] call FUNC(treatmentMutex);
_caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller];
[2.5,
{((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1))}, // the condition
{
private ["_caller","_target", "_selectionName", "_part","_tourniquets"];
_caller = _this select 0;
_target = _this select 1;
_selectionName = _this select 2;
_part = [_selectionName] call FUNC(getBodyPartNumber);
_tourniquets = [_target,QGVAR(tourniquets)] call EFUNC(common,getDefinedVariable);
_tourniquets set[_part,0];
[_target,QGVAR(tourniquets),_tourniquets] call EFUNC(common,setDefinedVariable);
_caller addItem "ACE_tourniquet";
[_caller,false] call FUNC(treatmentMutex);
[_target,"treatment",format["%1 removed a tourniquet on %2",[_caller] call EFUNC(common,getName),_selectionName]] call FUNC(addActivityToLog);
[_caller,false] call FUNC(treatmentMutex);
}, // on success
{
[(_this select 0), "STR_ACE_CANCELED", ["STR_ACE_ACTION_CANCELED","STR_ACE_YOU_MOVED_AWAY"]] call EFUNC(gui,sendDisplayInformationTo);
[(_this select 0),false] call FUNC(treatmentMutex);
}, // on failure
[_caller, _target, _selectionName] // arguments
] call EFUNC(gui,loadingBar);
[_unit,"treatment",format["%1 removed a tourniquet on %2",[_caller] call EFUNC(common,getName),_selectionName]] call FUNC(addActivityToLog);

View File

@ -16,6 +16,8 @@ _target = _this select 1;
_selectionName = _this select 2;
_removeItem = _this select 3;
systemChat format["fnc_handleTreatment_Action_tourniquet %1", _this];
_part = [_selectionName] call FUNC(getBodyPartNumber);
if (_part == 0 || _part == 1) exitwith {
[_caller,"You cannot apply a CAT on this body part!"] call EFUNC(common,sendHintTo);
@ -31,6 +33,6 @@ if ((_tourniquets select _part) > 0) exitwith {
};
[_caller, _unit,_removeItem] call FUNC(useEquipment);
[[_caller, _target, _selectionName, _removeItem], QUOTE(FUNC(tourniquetLocal)), _unit] call EFUNC(common,execRemoteFnc);
[[_caller, _target, _selectionName, _removeItem], QUOTE(FUNC(handleTreatment_Action_TourniquetLocal)), _unit] call EFUNC(common,execRemoteFnc);
true

View File

@ -31,8 +31,17 @@ if (vehicle _caller == _caller && (vehicle _target == _target) && !(stance _call
};
if (ACE_player == _caller) then {
[_caller, "STR_ACE_BANDAGING", "STR_ACE_APPLY_BANDAGE", 0, [[_target] call EFUNC(common,getName), _selectionName]] call EFUNC(gui,sendDisplayMessageTo);
switch (_removeItem) do {
case "ACE_tourniquet": {
};
case "ACE_splint": {
};
default {
[_caller, "STR_ACE_BANDAGING", "STR_ACE_APPLY_BANDAGE", 0, [[_target] call EFUNC(common,getName), _selectionName]] call EFUNC(gui,sendDisplayMessageTo);
};
};
// Displaying the treatment icon action
[QGVAR(treatmentIconID), true, QUOTE(PATHTOF(data\icons\bandage_fracture_small.paa)), [1,1,1,1]] call EFUNC(gui,displayIcon);
};
@ -55,7 +64,7 @@ if (isnil QGVAR(setting_bandageWaitingTime)) then {
switch (_removeItem) do {
case "ACE_tourniquet": {
[_caller, _target, _selectionName, _removeItem] call FUNC(handleTreatment_Action_Tourniquet);
[_caller, _target, _selectionName, _removeItem] call FUNC(handleTreatment_Action_tourniquet);
};
case "ACE_splint": {
// TODO implement splints

View File

@ -1,100 +0,0 @@
fnc_actionCarryUnit.sqf
fnc_ActioncheckBloodPressure.sqf
fnc_ActionCheckBloodPressureLocal.sqf
fnc_ActionCheckPulse.sqf
fnc_actionCheckPulseLocal.sqf
fnc_actionCheckResponse.sqf
fnc_actionDragUnit.sqf
fnc_actionDropUnit.sqf
fnc_actionLoadUnit.sqf
fnc_actionPlaceInBodyBag.sqf
fnc_actionRemoveTourniquet.sqf
fnc_actionUnloadUnit.sqf
fnc_addActivityToLog.sqf
fnc_addHeartRateAdjustment.sqf
fnc_addOpenWounds.sqf
fnc_addToInjuredCollection.sqf
fnc_addToQuickViewLog.sqf
fnc_addToTriageList.sqf
fnc_addTreatmentOption.sqf
fnc_canAccessMedicalEquipment.sqf
fnc_canPutInBodyBag.sqf
fnc_determineIfFatal.sqf
fnc_determineIfUnconscious.sqf
fnc_fromNumberToBodyPart.sqf
fnc_getActivityLog.sqf
fnc_getBloodLoss.sqf
fnc_getBloodPressure.sqf
fnc_getBloodVolumeChange.sqf
fnc_getBodyPartNumber.sqf
fnc_getCardiacOutput.sqf
fnc_getCurrentSelectedInjuryData.sqf
fnc_getHeartRateChange.sqf
fnc_getNewDamageBodyPart.sqf
fnc_getQuickViewLog.sqf
fnc_getSelectedBodyPart.sqf
fnc_getTreatmentOptions.sqf
fnc_getTriageList.sqf
fnc_getTriageStatus.sqf
fnc_getTypeOfDamage.sqf
fnc_handleBandageOpening.sqf
fnc_handleDamage.sqf
fnc_handleDisplayEffects.sqf
fnc_handleHeal.sqf
fnc_handleReactionHit.sqf
fnc_handleTreatment.sqf
fnc_handleTreatment_Action_AdvancedLocal.sqf
fnc_handleTreatment_Action_AirwayLocal.sqf
fnc_handleTreatment_Action_BandageLocal.sqf
fnc_handleTreatment_Action_CPR.sqf
fnc_handleTreatment_Action_CPRLocal.sqf
fnc_handleTreatment_Action_fullHeal.sqf
fnc_handleTreatment_Action_fullHealLocal.sqf
fnc_handleTreatment_Action_MedicationLocal.sqf
fnc_handleTreatment_Action_Stitching.sqf
fnc_handleTreatment_Action_tourniquet.sqf
fnc_handleTreatment_Action_tourniquetLocal.sqf
fnc_handleTreatment_Category_Advanced.sqf
fnc_handleTreatment_Category_Airway.sqf
fnc_handleTreatment_Category_Bandaging.sqf
fnc_handleTreatment_Category_Medication.sqf
fnc_handleUI_DisplayOptions.sqf
fnc_handleUI_dropDownTriageCard.sqf
fnc_handleUnitVitals.sqf
fnc_hasEquipment.sqf
fnc_hasMedicalEnabled.sqf
fnc_hasOpenWounds.sqf
fnc_increasePain.sqf
fnc_initalizeModuleCMS.sqf
fnc_inMedicalFacility.sqf
fnc_isMedic.sqf
fnc_isMedicalVehicle.sqf
fnc_isSetTreatmentMutex.sqf
fnc_moduleAssignMedicalEquipment.sqf
fnc_moduleAssignMedicalFacility.sqf
fnc_moduleAssignMedicalVehicle.sqf
fnc_moduleAssignMedicRoles.sqf
fnc_onInitForUnit.sqf
fnc_onInjury_assignAirwayStatus.sqf
fnc_onInjury_assignFractures.sqf
fnc_onInjury_assignOpenWounds.sqf
fnc_onKilled.sqf
fnc_onLocal.sqf
fnc_onMenuOpen.sqf
fnc_onTreatmentCompleted.sqf
fnc_onUnconscious.sqf
fnc_openMenu.sqf
fnc_playInjuredSound.sqf
fnc_setCardiacArrest.sqf
fnc_setDamageBodyPart.sqf
fnc_setDead.sqf
fnc_setMedicRole.sqf
fnc_setTriageStatus.sqf
fnc_treatmentMutex.sqf
fnc_updateActivityLog.sqf
fnc_updateBodyImg.sqf
fnc_updateIcons.sqf
fnc_updateUIInfo.sqf
fnc_useEquipment.sqf
print.txt
script_component.hpp