From 3fae8d47185640e63c74ef930da813a435a4df36 Mon Sep 17 00:00:00 2001 From: Taraman17 Date: Mon, 26 Feb 2024 13:50:07 +0000 Subject: [PATCH] Update readme --- MAPS.MD | 24 ++++++++++++++++++++++++ README.MD | 8 +++++--- 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100755 MAPS.MD diff --git a/MAPS.MD b/MAPS.MD new file mode 100755 index 0000000..532cde3 --- /dev/null +++ b/MAPS.MD @@ -0,0 +1,24 @@ +# Technical background on map handling + +## Read available maps +In the new CS2 dedicated server, there is no single function to list all maps available. +The internal maps are accessible as before with the ```maps *``` command. However there are lots of entries in the answer that are not real maps. +Workshop maps from a hosted collection are available by calling ```ds_workshop_listmaps```. This only lists the filenames of the maps and no workshop id. Unfortunately, the filenames are not available in the stamAPI, so there is currently no way to match the output fo ```ds_workshop_listmaps``` to preview pictures from the steamAPI. +For the Official maps the filenames are available in the API. + +Therefore I decided to work with a static list for the official maps and get the workshop maps of a collection directly via the steamAPI. + +```ds_workshop_listmaps``` is only a backup in case the API is not reachable for some reason. + +## Change maps +To change a map, there are also different commands whether it's a built in or a workshop map. + +- ```map ``` is used to change level to a built in map. +- ```ds_workshop_changelevel ``` is used to change level to a map present in the hosted workshop collection. +- ```host_workshop_map``` ist used to change to any workshop map. + +This cs2-api takes either the map-filename, the workshop-id or the title from the workshop details and matches it to a map-details object. Depending if it's an official of a workshop map, the respective command is called. If the workshop-id is not available for a workshop map, ```ds_workshop_changelevel``` is used. + +For that reason, a workshop collection id has to be set in the config if workshop maps are to be used. + +Alternatively one could call ```host_workshop_map``` via rcon command using the ```/rcon``` endpoint. \ No newline at end of file diff --git a/README.MD b/README.MD index 30a6316..80eb53d 100644 --- a/README.MD +++ b/README.MD @@ -24,7 +24,7 @@ I strongly adivise to use secure connections to prevent possible man-in-the-midd ## Prerequisites - steam CLI - CS2 dedicated server -- NodeJS 14.X or higher +- NodeJS 16.X or higher - screen ## Install @@ -47,6 +47,8 @@ sudo apt install screen ### API: - Edit the settings in config.js - at least the first 5. They are explained in the file. - The API uses steam authentication which returns a Steam ID as URL (https://steamcommunity.com/openid/id/{steamid}). The last part is the SteamID64, which can be calculated from the other SteamID formats - various online tools are available. In the configuration, an array needs to be filled with the comma separated IDs of your intended admins as strings (e.g. ['{steamid-1}', '{steamid-2}']). +- To display map preview images, a steamAPI key is needed. See https://steamcommunity.com/dev/apikey how to get one. +It must be copied to the respective config option. To learn more on how the map-handling works see [Maps TL;DR](https://github.com/Taraman17/nodejs-cs2-api/blob/master/MAPS.MD) ### Server update script If you want to use the update function, you need to provide a script to use with the steamcmd. @@ -69,11 +71,11 @@ Start the script with ```console node serverControl.js ``` -In your brower open http://:8090/gameserver.htm +In your brower open http://\:8090/gameserver.htm The API will detect a running server and connect to it. -To start the API on boot and have it running in the background, I recommend [Forever](https://github.com/foreversd/forever) +To start the API on boot and have it running in the background, I recommend [PM2](https://pm2.keymetrics.io/) ## Usage *NOTE: For API calls with basic http authentication see below.*