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

Enhancement: Show "Custom" game mode if a map is added to the Maps/Custom/ folder while the client is running #352

Open
alexlambson opened this issue Jul 27, 2022 · 4 comments · May be fixed by #358

Comments

@alexlambson
Copy link
Contributor

I noticed that the Custom gamemode doesn't appear if the Maps/Custom folder was empty at client start, even if I use /downloadmap and it downloads successfully or I add a map file to the folder using my OS.

Perhaps we should add some kind of file-watcher to the Maps/Custom folder to constantly check if we need to update the Custom maps list and game mode dropdown.

Reproduction:

  • Move or delete all files from Maps/Custom
  • Start the client
  • Start a multiplayer lobby. Custom should not be an available game mode.
  • Use /downloadmap HASH to download a map, or add a .map file to Maps/Custom/ using your Operating System.
  • Open the game mode drop down again.

Expected: Custom is added to the game mode dropdown after a successful map download or adding a .map file to the Maps/Custom folder. The newly added map is listed as an option in the Custom map list.

Actual: Custom remains hidden even though there are maps in the folder now.

@Metadorius
Copy link
Member

Yeah this would be a good improvement, I actually suggested that too some time before. Could set up a file watcher that would update the custom map list.

@alexlambson
Copy link
Contributor Author

I can give it a shot after work if everyone else is okay with adding this. I think we'd only need it for Custom

@Metadorius
Copy link
Member

Yeah previously everyone else agreed it would be a nice addition. Non-custom maps are loaded from a pre-made list anyway.

@alexlambson
Copy link
Contributor Author

I'll definitely give it a shot then

alexlambson added a commit to alexlambson/xna-cncnet-client that referenced this issue Aug 2, 2022
- Add a file watcher that will detect when a map is added or deleted, then update the game mode dropdown according to the new map list
- Add and use `CustomMapsDirectory` field to `MapLoader` to avoid hard coded strings.
- Add `GetLoadedMapBySha1` to remove some duplicate `GameModeMaps.Find()`.
- Add a function `RefreshGameModeDropdown` to modify the dropdown after client is loaded. The function is a bit complicated due to doing inline modifications to the items and keeping the selected mode.

Issue: CnCNet#352
@alexlambson alexlambson linked a pull request Aug 2, 2022 that will close this issue
alexlambson added a commit to alexlambson/xna-cncnet-client that referenced this issue Aug 2, 2022
- Add a file watcher that will detect when a map is added or deleted, then update the game mode dropdown according to the new map list
- Add and use `CustomMapsDirectory` field to `MapLoader` to avoid hard coded strings.
- Add `GetLoadedMapBySha1` to remove some duplicate `GameModeMaps.Find()`.
- Add a function `RefreshGameModeDropdown` to modify the dropdown after client is loaded. The function is a bit complicated due to doing inline modifications to the items and keeping the selected mode.

Issue: CnCNet#352
PR: CnCNet#358
alexlambson added a commit to alexlambson/xna-cncnet-client that referenced this issue Aug 2, 2022
- Add a file watcher that will detect when a map is added or deleted, then update the game mode dropdown according to the new map list
- Add and use `CustomMapsDirectory` field to `MapLoader` to avoid hard coded strings.
- Add `GetLoadedMapBySha1` to remove some duplicate `GameModeMaps.Find()`.
- Add a function `RefreshGameModeDropdown` to modify the dropdown after client is loaded. The function is a bit complicated due to doing inline modifications to the items and keeping the selected mode.

Issue: CnCNet#352
PR: CnCNet#358
alexlambson added a commit to alexlambson/xna-cncnet-client that referenced this issue Sep 26, 2022
… then update the game mode dropdown according to the new map list

- Add and use `CustomMapsDirectory` field to `MapLoader` to avoid hard coded strings.
- Add `GetLoadedMapBySha1` to remove some duplicate `GameModeMaps.Find()`.
- Add a function `RefreshGameModeDropdown` to modify the dropdown after client is loaded. The function is a bit complicated due to doing inline modifications to the items and keeping the selected mode.

Issue: CnCNet#352
PR: CnCNet#358
alexlambson added a commit to alexlambson/xna-cncnet-client that referenced this issue Sep 26, 2022
… then update the game mode dropdown according to the new map list

- Add and use `CustomMapsDirectory` field to `MapLoader` to avoid hard coded strings.
- Add `GetLoadedMapBySha1` to remove some duplicate `GameModeMaps.Find()`.
- Add a function `RefreshGameModeDropdown` to modify the dropdown after client is loaded. The function is a bit complicated due to doing inline modifications to the items and keeping the selected mode.

Issue: CnCNet#352
PR: CnCNet#358
alexlambson added a commit to alexlambson/xna-cncnet-client that referenced this issue Oct 1, 2022
- Address review fedback
- Use safe path everywhere
- Remove maps if they are renamed and their file extension changes

Issue: CnCNet#352
PR: CnCNet#358
alexlambson added a commit to alexlambson/xna-cncnet-client that referenced this issue Oct 1, 2022
- Address review fedback
- Use safe path everywhere
- Remove maps if they are renamed and their file extension changes

Issue: CnCNet#352
PR: CnCNet#358
alexlambson added a commit to alexlambson/xna-cncnet-client that referenced this issue Oct 16, 2022
- Address review feedback
- Use safe path everywhere
- Remove maps if they are renamed and their file extension changes
- Remove unnecessary file watcher filters
- sha1 -> SHA-1

Issue: CnCNet#352
PR: CnCNet#358
alexlambson added a commit to alexlambson/xna-cncnet-client that referenced this issue Nov 4, 2022
- Address review feedback to fix comments, make handlers private, and switch one-liners to expressions
- Switch MapSharer to download zip to a temp directory to avoid race condition with map file watcher.

Issue: CnCNet#352
PR: CnCNet#358
alexlambson added a commit to alexlambson/xna-cncnet-client that referenced this issue Nov 4, 2022
- Address review feedback to fix comments, make handlers private, and switch one-liners to expressions
- Switch MapSharer to download zip to a temp directory to avoid race condition with map file watcher.
- Add https://mapdb.cncnet.org/search/ to `downloadmap` help message

Issue: CnCNet#352
PR: CnCNet#358
alexlambson added a commit to alexlambson/xna-cncnet-client that referenced this issue Nov 4, 2022
… then update the game mode dropdown according to the new map list

- Add and use `CustomMapsDirectory` field to `MapLoader` to avoid hard coded strings.
- Add `GetLoadedMapBySha1` to remove some duplicate `GameModeMaps.Find()`.
- Add a function `RefreshGameModeDropdown` to modify the dropdown after client is loaded. The function is a bit complicated due to doing inline modifications to the items and keeping the selected mode.

Issue: CnCNet#352
PR: CnCNet#358
alexlambson added a commit to alexlambson/xna-cncnet-client that referenced this issue Nov 4, 2022
- Address review feedback
- Use safe path everywhere
- Remove maps if they are renamed and their file extension changes
- Remove unnecessary file watcher filters
- sha1 -> SHA-1

Issue: CnCNet#352
PR: CnCNet#358
alexlambson added a commit to alexlambson/xna-cncnet-client that referenced this issue Nov 4, 2022
- Address review feedback to fix comments, make handlers private, and switch one-liners to expressions
- Switch MapSharer to download zip to a temp directory to avoid race condition with map file watcher.
- Add https://mapdb.cncnet.org/search/ to `downloadmap` help message

Issue: CnCNet#352
PR: CnCNet#358
alexlambson added a commit to alexlambson/xna-cncnet-client that referenced this issue Nov 4, 2022
- Address review feedback to fix comments, make handlers private, and switch one-liners to expressions
- Switch MapSharer to download zip to a temp directory to avoid race condition with map file watcher.
- Add https://mapdb.cncnet.org/search/ to `downloadmap` help message

Issue: CnCNet#352
PR: CnCNet#358
alexlambson added a commit to alexlambson/xna-cncnet-client that referenced this issue Nov 4, 2022
- Address review feedback to fix comments, make handlers private, and switch one-liners to expressions
- Switch MapSharer to download zip to a temp directory to avoid race condition with map file watcher.
- Add https://mapdb.cncnet.org/search/ to `downloadmap` help message

Issue: CnCNet#352
PR: CnCNet#358
@SadPencil SadPencil linked a pull request Feb 3, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants