Skip to content

Commit

Permalink
Merge pull request #2000 from acemod/treatmentResetWeaponMode
Browse files Browse the repository at this point in the history
Treatment reset weapon mode
  • Loading branch information
thojkooi committed Aug 8, 2015
2 parents 94be0d9 + 710135a commit be00f7f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion addons/medical/functions/fnc_treatment.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ if (_caller == _target) then {
_callerAnim = [getText (_config >> "animationCallerSelf"), getText (_config >> "animationCallerSelfProne")] select (stance _caller == "PRONE");
};

_caller setvariable [QGVAR(selectedWeaponOnTreatment), currentWeapon _caller];
_caller setvariable [QGVAR(selectedWeaponOnTreatment), (weaponState _caller)];

// Cannot use secondairy weapon for animation
if (currentWeapon _caller == secondaryWeapon _caller) then {
Expand Down
11 changes: 8 additions & 3 deletions addons/medical/functions/fnc_treatment_failure.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,14 @@ if (vehicle _caller == _caller) then {
};
_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil];

_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnTreatment), ""]);
if (_weaponSelect != "") then {
_caller selectWeapon _weaponSelect;
_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnTreatment), []]);
if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") && {_previousWeapon in (weapons _caller)}}) then {
for "_index" from 0 to 99 do {
_caller action ["SwitchWeapon", _caller, _caller, _index];
//Just check weapon, muzzle and mode (ignore ammo in case they were reloading)
if (((weaponState _caller) select [0,3]) isEqualTo (_weaponSelect select [0,3])) exitWith {TRACE_1("Restoring", (weaponState _caller));};
if ((weaponState _caller) isEqualTo ["","","","",0]) exitWith {ERROR("weaponState not found");};
};
} else {
_caller action ["SwitchWeapon", _caller, _caller, 99];
};
Expand Down
11 changes: 8 additions & 3 deletions addons/medical/functions/fnc_treatment_success.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ if (vehicle _caller == _caller) then {
};
_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil];

_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnTreatment), ""]);
if (_weaponSelect != "") then {
_caller selectWeapon _weaponSelect;
_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnTreatment), []]);
if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") && {_previousWeapon in (weapons _caller)}}) then {
for "_index" from 0 to 99 do {
_caller action ["SwitchWeapon", _caller, _caller, _index];
//Just check weapon, muzzle and mode (ignore ammo in case they were reloading)
if (((weaponState _caller) select [0,3]) isEqualTo (_weaponSelect select [0,3])) exitWith {TRACE_1("Restoring", (weaponState _caller));};
if ((weaponState _caller) isEqualTo ["","","","",0]) exitWith {ERROR("weaponState not found");};
};
} else {
_caller action ["SwitchWeapon", _caller, _caller, 99];
};
Expand Down

0 comments on commit be00f7f

Please sign in to comment.