Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug Console - Include vehicles in editable objects and Fix respawn curator assignment #700

Merged
merged 3 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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];
_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;