Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Taraman17 committed Feb 26, 2024
1 parent 317351a commit 3fae8d4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
24 changes: 24 additions & 0 deletions MAPS.MD
Original file line number Diff line number Diff line change
@@ -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 <mapfilename>``` is used to change level to a built in map.
- ```ds_workshop_changelevel <mapfilename>``` 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.
8 changes: 5 additions & 3 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -69,11 +71,11 @@ Start the script with
```console
node serverControl.js
```
In your brower open http://<yourIP>:8090/gameserver.htm
In your brower open http://\<yourIP>: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.*
Expand Down

0 comments on commit 3fae8d4

Please sign in to comment.