From d7e43ce28ec33ffe617798d2e9ccbecf2bed5175 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 22 Mar 2015 12:39:26 +0100 Subject: [PATCH 01/10] First draft --- addons/modules/$PBOPREFIX$ | 1 + addons/modules/CfgEventHandlers.hpp | 13 ++++++ addons/modules/XEH_postInit.sqf | 44 +++++++++++++++++++ addons/modules/XEH_preInit.sqf | 8 ++++ addons/modules/config.cpp | 28 ++++++++++++ addons/modules/functions/fnc_moduleInit.sqf | 19 ++++++++ addons/modules/functions/script_component.hpp | 1 + addons/modules/script_component.hpp | 12 +++++ 8 files changed, 126 insertions(+) create mode 100644 addons/modules/$PBOPREFIX$ create mode 100644 addons/modules/CfgEventHandlers.hpp create mode 100644 addons/modules/XEH_postInit.sqf create mode 100644 addons/modules/XEH_preInit.sqf create mode 100644 addons/modules/config.cpp create mode 100644 addons/modules/functions/fnc_moduleInit.sqf create mode 100644 addons/modules/functions/script_component.hpp create mode 100644 addons/modules/script_component.hpp diff --git a/addons/modules/$PBOPREFIX$ b/addons/modules/$PBOPREFIX$ new file mode 100644 index 0000000000..39789fcaba --- /dev/null +++ b/addons/modules/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\blank \ No newline at end of file diff --git a/addons/modules/CfgEventHandlers.hpp b/addons/modules/CfgEventHandlers.hpp new file mode 100644 index 0000000000..82d1c55d10 --- /dev/null +++ b/addons/modules/CfgEventHandlers.hpp @@ -0,0 +1,13 @@ + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + + +class Extended_PostInit_EventHandlers { + class _ACE_modules { // using a _ so it is the first postInit to be executed + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; diff --git a/addons/modules/XEH_postInit.sqf b/addons/modules/XEH_postInit.sqf new file mode 100644 index 0000000000..72599b7cdc --- /dev/null +++ b/addons/modules/XEH_postInit.sqf @@ -0,0 +1,44 @@ + +#include "script_component.hpp" + +// TODO This is a basic and limited implementation that mimics some of the functionality from the A3 module framework, but not all of it. +// We have to execute this in the postInit XEH because on object init, the parameters of the modules are not yet available. They are if we execute it at the start of postInit execution. +{ + [_x] call { + private ["_logic", "_logicType", "_config", "_isGlobal", "_isDisposable", "_isPersistent","_function"]; + _logic = _this select 0; + _logicType = typeof _logic; + _logic hideobject true; + + if (_logic getvariable [QGVAR(initalized), false]) exitwith {}; + _config = (configFile >> "CfgVehicles" >> _logicType); + if !(isClass _config) exitwith {}; + + // isGlobal = 1; + _isGlobal = getNumber (_config >> "isGlobal") > 0; + _isDisposable = getNumber (_config >> "isDisposable") > 0; + _isPersistent = getNumber (_config >> "isPersistent") > 0 || getnumber (_config >> "isGlobal") > 1; + _function = getText (_config >> "function"); + if (isnil _function) then { + _function = compile _function; + } else { + _function = missionNamespace getvariable _function; + }; + + if (_isGlobal) then { + [_logic, [], true] call _function; + } else { + if (isServer) then { + [_logic, [], true] call _function; + }; + }; + + if !(_isPersistent) then { + _logic setvariable [QGVAR(initalized), true]; + }; + + if (_isDisposable) then { + deleteVehicle _logic; + }; + }; +}foreach GVAR(moduleInitCollection); diff --git a/addons/modules/XEH_preInit.sqf b/addons/modules/XEH_preInit.sqf new file mode 100644 index 0000000000..a8b9bd061e --- /dev/null +++ b/addons/modules/XEH_preInit.sqf @@ -0,0 +1,8 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(moduleInit); +GVAR(moduleInitCollection) = []; + +ADDON = true; diff --git a/addons/modules/config.cpp b/addons/modules/config.cpp new file mode 100644 index 0000000000..7a721e681c --- /dev/null +++ b/addons/modules/config.cpp @@ -0,0 +1,28 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"Glowbal"}; + authorUrl = ""; + VERSION_CONFIG; + }; +}; + +class CfgVehicles { + class Logic; + class Module_F: Logic { + class ArgumentsBaseUnits { + }; + }; + class ACE_Module: Module_F { + class EventHandlers { + init = QUOTE(_this call DFUNC(moduleInit)); + }; + }; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/modules/functions/fnc_moduleInit.sqf b/addons/modules/functions/fnc_moduleInit.sqf new file mode 100644 index 0000000000..3c5f20f92c --- /dev/null +++ b/addons/modules/functions/fnc_moduleInit.sqf @@ -0,0 +1,19 @@ +/* + * Author: Glowbal + * IV Treatment local callback + * + * Arguments: + * 0: The logic object + * + * + * Return Value: + * nil + * + * Public: No + */ + +#include "script_component.hpp" + +if ((_this select 0) isKindOf "Module_F") then { + GVAR(moduleInitCollection) pushback (_this select 0); +}; diff --git a/addons/modules/functions/script_component.hpp b/addons/modules/functions/script_component.hpp new file mode 100644 index 0000000000..ffd50bc09b --- /dev/null +++ b/addons/modules/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\modules\script_component.hpp" diff --git a/addons/modules/script_component.hpp b/addons/modules/script_component.hpp new file mode 100644 index 0000000000..807540960b --- /dev/null +++ b/addons/modules/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT modules +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_MODULES + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_MODULES + #define DEBUG_SETTINGS DEBUG_SETTINGS_MODULES +#endif + +#include "\z\ace\addons\main\script_macros.hpp" From 73489a7795fee88047c703c27a9649d484115b3c Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 22 Mar 2015 12:39:49 +0100 Subject: [PATCH 02/10] PBOPREFIX --- addons/modules/$PBOPREFIX$ | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/modules/$PBOPREFIX$ b/addons/modules/$PBOPREFIX$ index 39789fcaba..4660d73776 100644 --- a/addons/modules/$PBOPREFIX$ +++ b/addons/modules/$PBOPREFIX$ @@ -1 +1 @@ -z\ace\addons\blank \ No newline at end of file +z\ace\addons\modules \ No newline at end of file From 281bad1e7ea70b784366dd49ad9f7872bccf9323 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 22 Mar 2015 12:44:26 +0100 Subject: [PATCH 03/10] Use of the ACE module instead of Module_F. --- addons/medical/CfgVehicles.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index 1efd4917fd..966663bc63 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -7,7 +7,7 @@ class CfgVehicles { }; }; // TODO localization for all the modules - class ACE_moduleMedicalSettings: Module_F { + class ACE_moduleMedicalSettings: ACE_Module { scope = 2; displayName = "Medical Settings [ACE]"; icon = QUOTE(PATHTOF(ui\moduleIcon.paa)); @@ -129,7 +129,7 @@ class CfgVehicles { }; }; - class ACE_moduleTreatmentConfiguration: Module_F { + class ACE_moduleTreatmentConfiguration: ACE_Module { scope = 2; displayName = "Treatment Configuration [ACE]"; icon = QUOTE(PATHTOF(ui\moduleIcon.paa)); From 7ceaf7907a7054694c6f1b3dfc59bedf5bb22fdb Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 22 Mar 2015 12:45:46 +0100 Subject: [PATCH 04/10] Indentation --- addons/modules/XEH_postInit.sqf | 64 ++++++++++----------- addons/modules/config.cpp | 6 +- addons/modules/functions/fnc_moduleInit.sqf | 2 +- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/addons/modules/XEH_postInit.sqf b/addons/modules/XEH_postInit.sqf index 72599b7cdc..b6aecf5f90 100644 --- a/addons/modules/XEH_postInit.sqf +++ b/addons/modules/XEH_postInit.sqf @@ -4,41 +4,41 @@ // TODO This is a basic and limited implementation that mimics some of the functionality from the A3 module framework, but not all of it. // We have to execute this in the postInit XEH because on object init, the parameters of the modules are not yet available. They are if we execute it at the start of postInit execution. { - [_x] call { - private ["_logic", "_logicType", "_config", "_isGlobal", "_isDisposable", "_isPersistent","_function"]; - _logic = _this select 0; - _logicType = typeof _logic; - _logic hideobject true; + [_x] call { + private ["_logic", "_logicType", "_config", "_isGlobal", "_isDisposable", "_isPersistent","_function"]; + _logic = _this select 0; + _logicType = typeof _logic; + _logic hideobject true; - if (_logic getvariable [QGVAR(initalized), false]) exitwith {}; - _config = (configFile >> "CfgVehicles" >> _logicType); - if !(isClass _config) exitwith {}; + if (_logic getvariable [QGVAR(initalized), false]) exitwith {}; + _config = (configFile >> "CfgVehicles" >> _logicType); + if !(isClass _config) exitwith {}; - // isGlobal = 1; - _isGlobal = getNumber (_config >> "isGlobal") > 0; - _isDisposable = getNumber (_config >> "isDisposable") > 0; - _isPersistent = getNumber (_config >> "isPersistent") > 0 || getnumber (_config >> "isGlobal") > 1; - _function = getText (_config >> "function"); - if (isnil _function) then { - _function = compile _function; - } else { - _function = missionNamespace getvariable _function; - }; + // isGlobal = 1; + _isGlobal = getNumber (_config >> "isGlobal") > 0; + _isDisposable = getNumber (_config >> "isDisposable") > 0; + _isPersistent = getNumber (_config >> "isPersistent") > 0 || getnumber (_config >> "isGlobal") > 1; + _function = getText (_config >> "function"); + if (isnil _function) then { + _function = compile _function; + } else { + _function = missionNamespace getvariable _function; + }; - if (_isGlobal) then { - [_logic, [], true] call _function; - } else { - if (isServer) then { - [_logic, [], true] call _function; - }; - }; + if (_isGlobal) then { + [_logic, [], true] call _function; + } else { + if (isServer) then { + [_logic, [], true] call _function; + }; + }; - if !(_isPersistent) then { - _logic setvariable [QGVAR(initalized), true]; - }; + if !(_isPersistent) then { + _logic setvariable [QGVAR(initalized), true]; + }; - if (_isDisposable) then { - deleteVehicle _logic; - }; - }; + if (_isDisposable) then { + deleteVehicle _logic; + }; + }; }foreach GVAR(moduleInitCollection); diff --git a/addons/modules/config.cpp b/addons/modules/config.cpp index 7a721e681c..bffcec4faf 100644 --- a/addons/modules/config.cpp +++ b/addons/modules/config.cpp @@ -19,9 +19,9 @@ class CfgVehicles { }; }; class ACE_Module: Module_F { - class EventHandlers { - init = QUOTE(_this call DFUNC(moduleInit)); - }; + class EventHandlers { + init = QUOTE(_this call DFUNC(moduleInit)); + }; }; }; diff --git a/addons/modules/functions/fnc_moduleInit.sqf b/addons/modules/functions/fnc_moduleInit.sqf index 3c5f20f92c..30d8046d81 100644 --- a/addons/modules/functions/fnc_moduleInit.sqf +++ b/addons/modules/functions/fnc_moduleInit.sqf @@ -15,5 +15,5 @@ #include "script_component.hpp" if ((_this select 0) isKindOf "Module_F") then { - GVAR(moduleInitCollection) pushback (_this select 0); + GVAR(moduleInitCollection) pushback (_this select 0); }; From be9c09b605445e95409486336961d934a7a4f9ee Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 22 Mar 2015 12:49:04 +0100 Subject: [PATCH 05/10] Added cfgPatches dependancy on ace_modules --- addons/medical/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical/config.cpp b/addons/medical/config.cpp index ab0f83fa9e..28e07fe4d4 100644 --- a/addons/medical/config.cpp +++ b/addons/medical/config.cpp @@ -5,7 +5,7 @@ class CfgPatches { units[] = {"ACE_medicalSupplyCrate", "ACE_fieldDressingItem", "ACE_packingBandageItem", "ACE_elasticBandageItem", "ACE_tourniquetItem", "ACE_morphineItem", "ACE_atropineItem", "ACE_epinephrineItem", "ACE_plasmaIVItem", "ACE_bloodIVItem", "ACE_salineIVItem", "ACE_quikclotItem", "ACE_personalAidKitItem", "ACE_surgicalKitItem", "ACE_bodyBagItem"}; weapons[] = {"ACE_fieldDressing", "ACE_packingBandage", "ACE_elasticBandage", "ACE_tourniquet", "ACE_morphine", "ACE_atropine", "ACE_epinephrine", "ACE_plasmaIV", "ACE_plasmaIV_500", "ACE_plasmaIV_250", "ACE_bloodIV", "ACE_bloodIV_500", "ACE_bloodIV_250", "ACE_salineIV", "ACE_salineIV_500", "ACE_salineIV_250", "ACE_quikclot", "ACE_personalAidKit", "ACE_surgicalKit", "ACE_bodyBag"}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {ace_common, ace_interaction}; + requiredAddons[] = {ace_common, ace_interaction, ace_modules}; author[] = {"Glowbal", "KoffienFlummi"}; authorUrl = ""; VERSION_CONFIG; From 8b4c0c0e366c4c91f9b105f6f6fc5efd33d7a04d Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 22 Mar 2015 15:16:42 +0100 Subject: [PATCH 06/10] fixed postInit depending on setting --- addons/medical/XEH_postInit.sqf | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index ee73d28318..006a8b5137 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -218,19 +218,21 @@ if (isNil QGVAR(level)) then { }, 0, []] call CBA_fnc_addPerFrameHandler; // broadcast injuries to JIP clients in a MP session -if (isMultiplayer and GVAR(level) >= 2) then { +if (isMultiplayer) then { [QGVAR(onPlayerConnected), "onPlayerConnected", { - if (isNil QGVAR(InjuredCollection)) then { - GVAR(InjuredCollection) = []; - }; + if (GVAR(level) >= 2) then { + if (isNil QGVAR(InjuredCollection)) then { + GVAR(InjuredCollection) = []; + }; - { - _unit = _x; - _openWounds = _unit getvariable [QGVAR(openWounds), []]; { - ["medical_propagateWound", [_id], [_unit, _x]] call EFUNC(common,targetEvent); - }foreach _openWounds; - }foreach GVAR(InjuredCollection); + _unit = _x; + _openWounds = _unit getvariable [QGVAR(openWounds), []]; + { + ["medical_propagateWound", [_id], [_unit, _x]] call EFUNC(common,targetEvent); + }foreach _openWounds; + }foreach GVAR(InjuredCollection); + }; }, []] call BIS_fnc_addStackedEventHandler; }; From e1200f875357dd01f8eb52fcce38b69cdafda8f6 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 22 Mar 2015 16:38:21 +0100 Subject: [PATCH 07/10] fix: release action didn't show up --- addons/dragging/functions/fnc_setCarryable.sqf | 6 +++--- addons/dragging/functions/fnc_setDraggable.sqf | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/dragging/functions/fnc_setCarryable.sqf b/addons/dragging/functions/fnc_setCarryable.sqf index 630f212b97..56bfa5bd7a 100644 --- a/addons/dragging/functions/fnc_setCarryable.sqf +++ b/addons/dragging/functions/fnc_setCarryable.sqf @@ -48,8 +48,8 @@ if (_type in _initializedClasses) exitWith {}; _initializedClasses pushBack _type; GVAR(initializedClasses_carry) = _initializedClasses; -_carryAction = [QGVAR(drag), localize "STR_ACE_Dragging_Carry", "", {[_player, _target] call FUNC(carryObject)}, {[_player, _target] call FUNC(canCarry)}] call EFUNC(interact_menu,createAction); -_dropAction = [QGVAR(drop), localize "STR_ACE_Dragging_Drop", "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}] call EFUNC(interact_menu,createAction); +_carryAction = [QGVAR(carry), localize "STR_ACE_Dragging_Carry", "", {[_player, _target] call FUNC(carryObject)}, {[_player, _target] call FUNC(canCarry)}] call EFUNC(interact_menu,createAction); +_dropAction = [QGVAR(drop_carry), localize "STR_ACE_Dragging_Drop", "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}] call EFUNC(interact_menu,createAction); [_type, 0, ["ACE_MainActions"], _carryAction] call EFUNC(interact_menu,addActionToClass); -[_type, 0, ["ACE_MainActions"], _dropAction] call EFUNC(interact_menu,addActionToClass); +[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/dragging/functions/fnc_setDraggable.sqf b/addons/dragging/functions/fnc_setDraggable.sqf index b6e26a6f0a..da2d0310b4 100644 --- a/addons/dragging/functions/fnc_setDraggable.sqf +++ b/addons/dragging/functions/fnc_setDraggable.sqf @@ -52,4 +52,4 @@ _dragAction = [QGVAR(drag), localize "STR_ACE_Dragging_Drag", "", {[_player, _ta _dropAction = [QGVAR(drop), localize "STR_ACE_Dragging_Drop", "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}] call EFUNC(interact_menu,createAction); [_type, 0, ["ACE_MainActions"], _dragAction] call EFUNC(interact_menu,addActionToClass); -[_type, 0, ["ACE_MainActions"], _dropAction] call EFUNC(interact_menu,addActionToClass); +[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass); From dd7dad1b90b79f6af0b4130b4bfac69fb93d1f79 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 22 Mar 2015 17:05:31 +0100 Subject: [PATCH 08/10] define base class --- addons/medical/CfgVehicles.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index 966663bc63..8b638a5127 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -6,6 +6,8 @@ class CfgVehicles { class ArgumentsBaseUnits { }; }; + class ACE_Module; + // TODO localization for all the modules class ACE_moduleMedicalSettings: ACE_Module { scope = 2; From 11bb1a050a673a1ed7d3bdc501a8ccba68b2c97a Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 22 Mar 2015 17:12:14 +0100 Subject: [PATCH 09/10] fix: could drag and carry object at the same time --- addons/dragging/functions/fnc_handleAnimChanged.sqf | 8 ++++++-- addons/dragging/functions/fnc_startDrag.sqf | 3 +++ addons/dragging/functions/fnc_startDragPFH.sqf | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/addons/dragging/functions/fnc_handleAnimChanged.sqf b/addons/dragging/functions/fnc_handleAnimChanged.sqf index b5eb4d4d8f..91fa3d681b 100644 --- a/addons/dragging/functions/fnc_handleAnimChanged.sqf +++ b/addons/dragging/functions/fnc_handleAnimChanged.sqf @@ -13,7 +13,9 @@ if (_unit getVariable [QGVAR(isDragging), false]) then { private "_draggedObject"; _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; - [_unit, _draggedObject] call FUNC(dropObject); + if (!isNull _draggedObject) then { + [_unit, _draggedObject] call FUNC(dropObject); + }; }; }; @@ -25,7 +27,9 @@ if (_unit getVariable [QGVAR(isCarrying), false]) then { private "_carriedObject"; _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull]; - [_unit, _carriedObject] call FUNC(dropObject_carry); + if (!isNull _carriedObject) then { + [_unit, _carriedObject] call FUNC(dropObject_carry); + }; }; }; diff --git a/addons/dragging/functions/fnc_startDrag.sqf b/addons/dragging/functions/fnc_startDrag.sqf index 1e286fb4a4..07ed7e5a90 100644 --- a/addons/dragging/functions/fnc_startDrag.sqf +++ b/addons/dragging/functions/fnc_startDrag.sqf @@ -40,4 +40,7 @@ _unit selectWeapon primaryWeapon _unit; // can't play action that depends on weapon if it was added the same frame [{_this playActionNow "grabDrag";}, _unit] call EFUNC(common,execNextFrame); +// prevents draging and carrying at the same time +_unit setVariable [QGVAR(isDragging), true, true]; + [FUNC(startDragPFH), 0.2, [_unit, _target, time + 5]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/dragging/functions/fnc_startDragPFH.sqf b/addons/dragging/functions/fnc_startDragPFH.sqf index b6515aa2d9..5c2aced5ef 100644 --- a/addons/dragging/functions/fnc_startDragPFH.sqf +++ b/addons/dragging/functions/fnc_startDragPFH.sqf @@ -10,6 +10,9 @@ _timeOut = _this select 0 select 2; // timeout. Do nothing. Quit. time, because anim length is linked to ingame time. if (time > _timeOut) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; + + // re-enable everything + _unit setVariable [QGVAR(isDragging), false, true]; }; // unit is ready to start dragging From 84dbeb19d118f46f83b36f455d90d470e6202065 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 22 Mar 2015 17:35:26 +0100 Subject: [PATCH 10/10] fix: timeout could cause being stuck with attached item --- addons/dragging/functions/fnc_startDragPFH.sqf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/dragging/functions/fnc_startDragPFH.sqf b/addons/dragging/functions/fnc_startDragPFH.sqf index 5c2aced5ef..1d8c6f89f1 100644 --- a/addons/dragging/functions/fnc_startDragPFH.sqf +++ b/addons/dragging/functions/fnc_startDragPFH.sqf @@ -11,6 +11,14 @@ _timeOut = _this select 0 select 2; if (time > _timeOut) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; + // drop if in timeout + private "_draggedObject"; + _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; + + if (!isNull _draggedObject) exitWith { + [_unit, _draggedObject] call FUNC(dropObject); + }; + // re-enable everything _unit setVariable [QGVAR(isDragging), false, true]; };