ACE3/addons/medical/functions/fnc_setWeaponsCorrectUnconscious.sqf

39 lines
997 B
Plaintext
Raw Normal View History

2015-01-16 23:21:47 +00:00
/**
* fn_setWeaponsCorrectUnconscious.sqf
* @Descr: Ensures the weapon of a unit is selected correctly for the unconscious state. Prefents wierd animation behaviour
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: void
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit"];
_unit = _this select 0;
if ((vehicle _unit) isKindOf "StaticWeapon") then {
2015-01-18 19:09:19 +00:00
moveOut _unit;
unassignVehicle _unit;
//unassignVehicle _unit;
//_unit action ["eject", vehicle _unit];
2015-01-16 23:21:47 +00:00
};
if (vehicle _unit == _unit) then {
2015-01-18 19:09:19 +00:00
if (currentWeapon _unit == secondaryWeapon _unit) then {
reload _unit;
};
2015-01-16 23:21:47 +00:00
};
if (animationState _unit in ["ladderriflestatic","laddercivilstatic"]) then {
2015-01-18 19:09:19 +00:00
_unit action ["ladderOff", (nearestBuilding _unit)];
2015-01-16 23:21:47 +00:00
};
if (vehicle _unit == _unit) then {
2015-01-18 19:09:19 +00:00
if (currentWeapon _unit == secondaryWeapon _unit) then {
_unit selectWeapon (primaryWeapon _unit);
_unit switchMove "";
_unit playmoveNow "";
};
2015-01-16 23:21:47 +00:00
};