Skip to content

Feature request: Support for downloading workshop maps #153

@GekasD

Description

@GekasD

Note on workshop maps for CS2, CS:GO used to have a startup parameter +workshop_start_map id it would download/update the workshop map on server start and also load it, but this has been removed in CS2, a clunky workaround I have found is to load an "empty" map (literally a map called <empty>), and then starting the workshop map with host_workshop_map id, so if you could maybe account for <empty> being loaded first (when trying to autoload a config, just return the method I guess).

Get5 reference on workshop maps (click on + of maplist property): https://splewis.github.io/get5/latest/match_schema/#schema

Possible improvement over get5:
Change the way maps are passed into the match config into cleaner JSON objects, so instead of passing map file names we can pass:

{
    "maplist": [
        { "name": "Dust II", "id": "de_dust2", "type": 0 },
        { "name": "Biome", "id": "3075706807", "type": 1 },
        { "name": "Thera", "id": "3121217565", "type": 1 }
    ]
}

map.type could be a C# enum, could also be a string instead of a number, this is just an example:

enum MapType {
    Official,
    Workshop
}

map.name can be used in chat messages and such.

The above improvement would make it easier for the plugin to tell if a map is a workshop map without needing to split strings like get5 did.

C# example of handling a map change

public static async Task ChangeMap(Map map, int delay = 3) {
	Server.PrintToChatAll($"Changing to map: {map.Name}");
	if (map.Type == MapType.Workshop) {
		Server.PrintToChatAll($"Warning: Since {map.Name} is a workshop map");
		Server.PrintToChatAll("The server might need to download / update the map");
	}

	await Task.Delay(delay * 1000);
		
	Server.NextFrame(() => {
		if (map.Type == MapType.Official) {
			Server.ExecuteCommand($"changelevel {map.Id}");
		} else {
			Server.ExecuteCommand($"host_workshop_map {map.Id}");
		}
	});
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions