Skip to content

Commit

Permalink
#6095: hide Game Connection functionality except in Dark Mod
Browse files Browse the repository at this point in the history
Only the Dark Mod supports hot reload, so this functionality is now
gated by a hot_reload optional feature exposed only by the Dark Mod
.game file. In other games, neither the "Map → Game Connection" menu
item nor the associated camera toolbar buttons will appear.
  • Loading branch information
Matthew Mott committed Sep 21, 2022
1 parent 7862067 commit 2e57c21
Showing 1 changed file with 18 additions and 36 deletions.
54 changes: 18 additions & 36 deletions plugins/dm.gameconnection/GameConnection.cpp
Expand Up @@ -804,16 +804,15 @@ const StringSet& GameConnection::getDependencies() const

void GameConnection::initialiseModule(const IApplicationContext& ctx)
{
// Don't add any commands if the hot_reload feature is not enabled by the current Game
if (!GlobalGameManager().currentGame()->hasFeature("hot_reload"))
return;

// Show/hide GUI window
GlobalCommandSystem().addCommand(
"GameConnectionDialogToggle",
gameconn::GameConnectionDialog::toggleDialog
);
GlobalMenuManager().add(
"main/map", "GameConnectionDialog",
ui::menu::ItemType::Item, _("Game Connection..."), "",
"GameConnectionDialogToggle"
);
GlobalCommandSystem().addCommand("GameConnectionDialogToggle",
gameconn::GameConnectionDialog::toggleDialog);
GlobalMenuManager().add("main/map", "GameConnectionDialog", ui::menu::ItemType::Item,
_("Game Connection..."), "", "GameConnectionDialogToggle");

// Restart game
GlobalCommandSystem().addCommand(
Expand All @@ -836,23 +835,15 @@ void GameConnection::initialiseModule(const IApplicationContext& ctx)
return isCameraSyncEnabled() != oldEnabled;
}
);
GlobalCommandSystem().addCommand(
"GameConnectionBackSyncCamera",
[this](const cmd::ArgumentList&) {
backSyncCamera();
}
);
GlobalCommandSystem().addCommand("GameConnectionBackSyncCamera",
[this](const cmd::ArgumentList&) { backSyncCamera(); });
_event_backSyncCamera = GlobalEventManager().addCommand(
"GameConnectionBackSyncCamera", "GameConnectionBackSyncCamera", false
);

// Reload map
GlobalCommandSystem().addCommand(
"GameConnectionReloadMap",
[this](const cmd::ArgumentList&) {
reloadMap();
}
);
GlobalCommandSystem().addCommand("GameConnectionReloadMap",
[this](const cmd::ArgumentList&) { reloadMap(); });
GlobalEventManager().addAdvancedToggle(
"GameConnectionToggleAutoMapReload",
[this](bool v) {
Expand All @@ -863,12 +854,8 @@ void GameConnection::initialiseModule(const IApplicationContext& ctx)
);

// Update map
GlobalCommandSystem().addCommand(
"GameConnectionUpdateMap",
[this](const cmd::ArgumentList&) {
doUpdateMap();
}
);
GlobalCommandSystem().addCommand("GameConnectionUpdateMap",
[this](const cmd::ArgumentList&) { doUpdateMap(); });
GlobalEventManager().addAdvancedToggle(
"GameConnectionToggleAutoMapUpdate",
[this](bool v) {
Expand All @@ -882,17 +869,12 @@ void GameConnection::initialiseModule(const IApplicationContext& ctx)
// Respawn selected
GlobalCommandSystem().addCommand(
"GameConnectionRespawnSelected",
[this](const cmd::ArgumentList&) {
respawnSelectedEntities();
}
[this](const cmd::ArgumentList&) { respawnSelectedEntities(); }
);

// Pause game
GlobalCommandSystem().addCommand(
"GameConnectionPauseGame",
[this](const cmd::ArgumentList&) {
togglePauseGame();
}
);
GlobalCommandSystem().addCommand("GameConnectionPauseGame",
[this](const cmd::ArgumentList&) { togglePauseGame(); });

// Toolbar button(s)
GlobalMainFrame().signal_MainFrameConstructed().connect(
Expand Down

0 comments on commit 2e57c21

Please sign in to comment.