mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
handle disconnection when dragging
This commit is contained in:
parent
5f39cf213b
commit
57becc203c
@ -8,6 +8,7 @@ class Extended_PreInit_EventHandlers {
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit));
|
||||
serverInit = QUOTE(call COMPILE_FILE(XEH_serverInit));
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -10,3 +10,17 @@ if (isNil QGVAR(maxWeight)) then {
|
||||
};
|
||||
|
||||
["isNotDragging", {!((_this select 0) getVariable [QGVAR(isDragging), false])}] call EFUNC(common,addCanInteractWithCondition);
|
||||
|
||||
// release object on player change. This does work when returning to lobby, but not when hard disconnecting.
|
||||
["playerChanged", {
|
||||
private ["_newPlayer", "_oldPlayer"];
|
||||
|
||||
_newPlayer = _this select 0;
|
||||
_oldPlayer = _this select 1;
|
||||
|
||||
{
|
||||
if (_x getVariable [QGVAR(isDragging), false]) then {
|
||||
[_x, _x getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject);
|
||||
};
|
||||
} forEach [_newPlayer, _oldPlayer];
|
||||
}] call EFUNC(common,addEventhandler);
|
||||
|
13
addons/dragging/XEH_serverInit.sqf
Normal file
13
addons/dragging/XEH_serverInit.sqf
Normal file
@ -0,0 +1,13 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
// release object on hard disconnection.
|
||||
addMissionEventHandler ["HandleDisconnect", {
|
||||
private "_unit";
|
||||
|
||||
_unit = _this select 0;
|
||||
|
||||
if (_unit getVariable [QGVAR(isDragging), false]) then {
|
||||
[_unit, _unit getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject);
|
||||
};
|
||||
}];
|
Loading…
Reference in New Issue
Block a user