Merge pull request #2681 from acemod/vehDetachLocalfix

Attach getIn/Out run on local unit
This commit is contained in:
PabstMirror 2015-10-06 13:49:58 -05:00
commit 39b838c7ab
2 changed files with 10 additions and 5 deletions

View File

@ -17,11 +17,11 @@
*/
#include "script_component.hpp"
if (!isServer) exitWith {};
params ["", "", "_unit"];
TRACE_1("params",_unit);
if (!local _unit) exitWith {};
private ["_attachedList"];
_attachedList = _unit getVariable [QGVAR(attached), []];
@ -29,9 +29,14 @@ if ((count _attachedList) == 0) exitWith {};
(_attachedList select 0) params ["_xObject"];
if (!isNull _xObject) then {
TRACE_1("detaching and moving attached light",_xObject);
detach _xObject;
_xObject setPos ((getPos _unit) vectorAdd [0, 0, -1000]);
[{deleteVehicle (_this select 0)}, [_xObject], 2] call EFUNC(common,waitAndExecute);
[{
params ["_detachedLight"];
TRACE_1("delayed delete",_detachedLight);
deleteVehicle _detachedLight;
}, [_xObject], 2] call EFUNC(common,waitAndExecute);
(_attachedList select 0) set [0, objNull];
};

View File

@ -17,11 +17,11 @@
*/
#include "script_component.hpp"
if (!isServer) exitWith {};
params ["", "", "_unit"];
TRACE_1("params",_unit);
if (!local _unit) exitWith {};
private ["_attachedList"];
_attachedList = _unit getVariable [QGVAR(attached), []];