diff --git a/addons/debug_console/XEH_PREP.hpp b/addons/debug_console/XEH_PREP.hpp index cea4c9a6..81383079 100644 --- a/addons/debug_console/XEH_PREP.hpp +++ b/addons/debug_console/XEH_PREP.hpp @@ -1,4 +1,5 @@ PREP(addButton); PREP(addCurator); PREP(handleDisconnect); +PREP(handleRespawn); PREP(initDebugConsole); diff --git a/addons/debug_console/XEH_postInit.sqf b/addons/debug_console/XEH_postInit.sqf index 63d93998..c870bb90 100644 --- a/addons/debug_console/XEH_postInit.sqf +++ b/addons/debug_console/XEH_postInit.sqf @@ -2,6 +2,7 @@ if (isServer) then { addMissionEventHandler ["HandleDisconnect", FUNC(handleDisconnect)]; + addMissionEventHandler ["EntityRespawned", FUNC(handleRespawn)]; [QGVAR(createCurator), FUNC(addCurator)] call CBA_fnc_addEventHandler; [QGVAR(stopRain), { params ["_caller"]; diff --git a/addons/debug_console/functions/fnc_addCurator.sqf b/addons/debug_console/functions/fnc_addCurator.sqf index 496cd681..ecc94d14 100644 --- a/addons/debug_console/functions/fnc_addCurator.sqf +++ b/addons/debug_console/functions/fnc_addCurator.sqf @@ -35,9 +35,12 @@ for "_i" from 0 to (count _configFile - 1) do { _allAddons pushBack _cfgName; }; +private _entities = entities [[], [], true, true]; // Players, AI and Vehicles. + _curatorModule addCuratorAddons _allAddons; _curatorModule setVariable ["showNotification", false]; -_curatorModule addCuratorEditableObjects [allUnits, true]; // all Players and AI. +_curatorModule setVariable ["BIS_fnc_initModules_activate", true, true]; // Manually activate module, 1.86 didnt activate modules when created via script, unsure if still true. +_curatorModule addCuratorEditableObjects [_entities, true]; { _curatorModule setCuratorCoef [_x, 0]; diff --git a/addons/debug_console/functions/fnc_handleRespawn.sqf b/addons/debug_console/functions/fnc_handleRespawn.sqf new file mode 100644 index 00000000..d5300092 --- /dev/null +++ b/addons/debug_console/functions/fnc_handleRespawn.sqf @@ -0,0 +1,30 @@ +#include "..\script_component.hpp" +/* + * Author: Mike + * Handles respawn of players. + * + * Arguments: + * 0: New Unit + * 1: Old Unit (Unused) + * + * Return Value: + * None + * + * Public: No +*/ + +params ["_newUnit", "_oldUnit"]; + +if (GVAR(playerCurators) isEqualTo []) exitWith {}; + +private _playerUID = getPlayerUID _newUnit; +private _moduleData = GVAR(playerCurators) select {_playerUID in _x}; + +if (_moduleData isEqualTo []) exitWith {}; + +// Break old curator assignment +private _module = (_moduleData select 0) select 0; +unassignCurator _module; + +// Reassign curator back to original player +_module assignCurator _newUnit;