Skip to content

Commit

Permalink
Debug Console - Include vehicles in editable objects and Fix respawn …
Browse files Browse the repository at this point in the history
…curator assignment (#700)
  • Loading branch information
Mike-MF authored Jul 2, 2024
1 parent d6364b1 commit 6ccad44
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions addons/debug_console/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PREP(addButton);
PREP(addCurator);
PREP(handleDisconnect);
PREP(handleRespawn);
PREP(initDebugConsole);
1 change: 1 addition & 0 deletions addons/debug_console/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down
5 changes: 4 additions & 1 deletion addons/debug_console/functions/fnc_addCurator.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
30 changes: 30 additions & 0 deletions addons/debug_console/functions/fnc_handleRespawn.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "..\script_component.hpp"
/*
* Author: Mike
* Handles respawn of players.
*
* Arguments:
* 0: New Unit <OBJECT>
* 1: Old Unit <OBJECT> (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;

0 comments on commit 6ccad44

Please sign in to comment.