2015-03-15 16:27:21 +00:00
|
|
|
/*
|
|
|
|
* Author: PabstMirror
|
|
|
|
* Handles the inventory opening.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Container <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Handeled <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [player, car] call ACE_VehicleLock_fnc_onOpenInventory;
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-04 03:11:45 +00:00
|
|
|
params ["_unit", "_container"];
|
2015-08-07 18:24:47 +00:00
|
|
|
TRACE_2("params",_unit,_container);
|
2015-03-15 16:27:21 +00:00
|
|
|
|
|
|
|
//Only check for player:
|
|
|
|
if (_unit != ace_player) exitWith {false};
|
|
|
|
|
2015-04-17 20:45:00 +00:00
|
|
|
private "_handeled";
|
2015-03-15 16:27:21 +00:00
|
|
|
_handeled = false;
|
|
|
|
|
|
|
|
if (GVAR(LockVehicleInventory) && //if setting not enabled
|
|
|
|
{(vehicle ace_player) == ace_player} && //Player dismounted
|
|
|
|
{(_container isKindOf "Car") || (_container isKindOf "Tank") || (_container isKindOf "Helicopter")} && //container is a lockable veh
|
|
|
|
{(locked _container) in [2,3]} && //Vehicle is locked
|
|
|
|
{!([ace_player, _container] call FUNC(hasKeyForVehicle))} //player doesn't have key
|
|
|
|
) then {
|
|
|
|
//Give feedback that vehicle is locked
|
|
|
|
playSound "ACE_Sound_Click";
|
|
|
|
//don't open the vehicles inventory
|
|
|
|
_handeled = true;
|
2016-01-17 03:58:59 +00:00
|
|
|
|
2016-01-19 14:31:52 +00:00
|
|
|
// As of 1.54 the action needs to be delayed a frame to work, which used not to be the case
|
2016-01-17 03:58:59 +00:00
|
|
|
[{
|
|
|
|
TRACE_1("delaying a frame", ace_player);
|
2016-01-19 14:31:52 +00:00
|
|
|
//Just opens a dummy groundContainer (so the player can still see their own inventory)
|
2016-01-17 03:58:59 +00:00
|
|
|
ACE_player action ["Gear", objNull];
|
|
|
|
}, []] call EFUNC(common,execNextFrame);
|
2015-03-15 16:27:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_handeled
|