don't drop if inside a vehicle

This commit is contained in:
commy2 2020-01-11 19:29:33 +01:00
parent b736928259
commit 353feb6400
2 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,4 @@
PREP(throwWeapon);
PREP(fallDown);
PREP(getRandomAnimation);
PREP(throwWeapon);

View File

@ -1,7 +1,8 @@
#include "script_component.hpp"
/*
* Author: commy2
* Makes the unit throw their currently selected weapon. Unit must be local.
* Makes the unit throw their currently selected weapon.
* Unit must be local and not inside a vehicle or attached to another object.
*
* Arguments:
* 0: unit <OBJECT>
@ -20,7 +21,7 @@
params ["_unit"];
private _weapon = currentWeapon _unit;
if (_weapon isEqualTo "") exitWith {objNull};
if (!isNull objectParent _unit || _weapon isEqualTo "") exitWith {objNull};
private _data = weaponsItems _unit select {_x select 0 == _weapon} select 0;