mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Attach-use waitAndExecute
This commit is contained in:
parent
1c074e8096
commit
69893a7e99
@ -4,5 +4,4 @@ PREP(attach);
|
||||
PREP(canAttach);
|
||||
PREP(canDetach);
|
||||
PREP(detach);
|
||||
PREP(detachDelayFix);
|
||||
PREP(openAttachUI);
|
@ -12,7 +12,7 @@ Return Value:
|
||||
none
|
||||
*/
|
||||
|
||||
private ["_unit", "_itemName", "_count", "_attachedItem"];
|
||||
private ["_unit", "_itemName", "_count", "_attachedItem", "_fnc_detachDelay"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_itemName = _unit getVariable [QGVAR(ItemName), ""];
|
||||
@ -33,7 +33,12 @@ if (_itemName == "B_IR_Grenade" or _itemName == "O_IR_Grenade" or _itemName == "
|
||||
detach _attachedItem;
|
||||
_attachedItem setPos [getPos _unit select 0, getPos _unit select 1, ((getPos _unit select 2) - 1000)];
|
||||
// Delete attached item after 0.5 seconds
|
||||
[FUNC(detachFix), 0.5, [_attachedItem, (time + 0.5)]] call CBA_fnc_addPerFrameHandler;
|
||||
systemChat "wait";
|
||||
_fnc_detachDelay = {
|
||||
systemChat "deleting";
|
||||
deleteVehicle (_this select 0);
|
||||
};
|
||||
[_fnc_detachDelay, [_attachedItem], 0.5, 0] call EFUNC(common,waitAndExecute);
|
||||
} else {
|
||||
// Delete attached item
|
||||
deleteVehicle _attachedItem;
|
||||
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
Author: Pabst Mirror
|
||||
|
||||
Description:
|
||||
Waits then deletes the object. Fixes IR_Grenade's effect not disapearing.
|
||||
|
||||
Parameters:
|
||||
0: ARRAY - [OBJECT - item, NUMBER - time to wait until]
|
||||
1: NUMBER - CBA's PerFrameHandler ID
|
||||
*/
|
||||
|
||||
_attachedItem = (_this select 0) select 0;
|
||||
_waitUntilTime = (_this select 0) select 1;
|
||||
|
||||
if (time < _waitUntilTime) exitWith {};
|
||||
|
||||
deleteVehicle _attachedItem;
|
||||
|
||||
//Remove the frame handler
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
Loading…
Reference in New Issue
Block a user