You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Within LInuxGSM there are many commands that a user will run to complete tasks such as start, stop, monitor, and details. Command scripts are stored will all other modules and are always named something like `command_install.sh`.
3
+
Within LinuxGSM there are many commands that a user will run to complete tasks such as start, stop, monitor, and details. Command scripts are stored with all other modules and are always named something like `command_install.sh`.
4
4
5
-
Here are the command functions you might need to alter when adding a new server:
6
-
7
-
* command\_install.sh - Server installation must work properly
8
-
* command\_update.sh - if the given game supports updates (might required to add a file for that matter, for now, we use to add a single file for install and update, like for TeamSpeak 3).
9
-
* command\_details.sh - Server details need to be displayed properly
10
-
* command\_monitor.sh & monitor\_gsquery.sh, query\_gsquery.py & query\_gsquery.py - You'll need to read carefully and understand this code before altering it.
11
-
* core\_getopt.sh - You will define available commands in this one, displayed when the user runs `./gameserver` without an argument. Either use an existing opt or make a new one if needed.
12
-
* command\_start.sh & command\_stop.sh - Of course, your server needs to be able to start and stop properly.
13
-
* command\_debug.sh & command\_console.sh - Those commands usually work out of the box, but might require some more work. If not using tmux, then console should be disabled for this server in core\_getopt.sh.
14
-
* info\_config.sh - You might need to read variables out of configuration files such as Rcon information in the case of Squad.
5
+
Some game servers may require bespoke commands to complete tasks. Examples of this include Teamspeak 3 and Unreal Tournament 2004. Take a look at the `core_getopts.sh` module for examples of how to add commands.
Functions are groupings of code that complete a task \(function\). These functions can be called upon anywhere within the code. Creating a function prevents having to replicat the same code over and over.
3
+
Functions are groupings of code that complete a task (function). These functions can be called upon anywhere within the code. Creating a function prevents having to replicate the same code over and over.
4
4
5
5
## LinuxGSM Functions
6
6
7
-
All functions within LinuxGSM begin with an prefix `fn_` and should be descriptive of what the function is doing. Words are separated by an underscore `_`.
7
+
All functions within LinuxGSM begin with the prefix `fn_` and should be descriptive of what the function is doing. Words are separated by an underscore `_`.
8
8
9
-
For LinuxGSM development, it is important that developers understand what a function does which is why all function names must describes the propose of the function. A longer function name that describes the function is prevered over a short one that does not.
9
+
For LinuxGSM development, it is important that developers understand what a function does which is why all function names must describe the purpose of the function. A longer function name that describes the function is preferred over a short one that does not.
10
10
11
11
### Examples
12
12
13
-
```text
13
+
```
14
14
fn_stop_graceful_cmd
15
15
```
16
16
17
-
```text
17
+
```
18
18
fn_update_ts3_dl
19
19
```
20
20
21
21
### Syntax
22
22
23
23
All functions should be formatted with the following syntax.
Copy file name to clipboardExpand all lines: code-standards/modules.md
+9-10Lines changed: 9 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,21 +6,21 @@ Modules are individual bash scripts containing code and functions that complete
6
6
7
7
A command will call upon modules to complete various command tasks. Modules are normally created if a task needs to be called upon by multiple commands, or as a logical way to split large commands and modules into smaller sub-modules.
8
8
9
-
Modules are located in the `functions` directory,
9
+
Modules are located in the `modules` directory,
10
10
11
-
```text
12
-
lgsm/functions
11
+
```
12
+
lgsm/modules
13
13
```
14
14
15
15
### Module Groups
16
16
17
-
Modules are split into logical groups depending upon the type of task is being carried out.
17
+
Modules are split into logical groups depending on the type of task being carried out.
18
18
19
19
* alert – Sending alert notifications
20
20
* check – completes checks before a command runs.
21
21
* command – the command module that runs specific command tasks.
22
22
* core – core modules that are required to run LinuxGSM.
23
-
* fix – apply game serverspecific fixes to allow the game server to run correctly.
23
+
* fix – apply game server-specific fixes to allow the game server to run correctly.
24
24
* info – gathers info from sources such as the OS and game server.
25
25
* install - modules related to installation
26
26
* mods – handles game server mods
@@ -41,7 +41,7 @@ Core modules handle vital are required by LinuxGSM. These include download, geto
41
41
42
42
Modules will launch in sequence as they are required by commands. The following modules will normally run in the following order when a command is executed:
43
43
44
-
```text
44
+
```
45
45
core
46
46
command
47
47
check
@@ -52,7 +52,7 @@ It is possible to see the order that modules run by enabling `./gameserver dev`.
52
52
53
53
Example output of `./gameserver stop`
54
54
55
-
```text
55
+
```
56
56
+ core_functions.sh
57
57
++ core_legacy.sh
58
58
++ core_messages.sh
@@ -83,14 +83,13 @@ Example output of `./gameserver stop`
83
83
84
84
## How Modules are Called
85
85
86
-
In bash to call another bash script the `source` command is used. However, in LinuxGSM this is handled by the `core_functions.sh` module. This allows LinuxGSM automatically download a module the first time it is used then call the script.
86
+
In bash to call another bash script, the `source` command is used. However, in LinuxGSM this is handled by the `core_modules.sh` module. This allows LinuxGSM to automatically download a module the first time it is used and then call the script.
87
87
88
88
To call a module simply add the name of the module file e.g `info_config.sh` and the module will be called. If a new module is being added it must be added to the list of modules in `core_functions.sh` like so.
Copy file name to clipboardExpand all lines: getting-started/adding-a-new-game-server.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,11 +24,11 @@ Some common variables that will need updating:
24
24
* Game Server Details `gamename` , `engine`, `glibc`.
25
25
* Various directory and config variables.
26
26
27
-
###Add the new server to serverlist.csv
27
+
## Add the new server to serverlist.csv
28
28
29
29
Add the new server details to `serverlist.csv` as well as add any dependency requirements to all the distro csv files found in `lgsm/data` directory.
30
30
31
-
###Add any fixes to a fix file
31
+
## Add any fixes to a fix file
32
32
33
33
Some game servers require alterations before they can start common examples include:
34
34
@@ -44,31 +44,31 @@ If this is required a fix module will need to be created.
44
44
3. Add the module to `fix.sh`
45
45
4. Add the fix to `core_modules.sh` list
46
46
47
-
###Server Querying
47
+
## Server Querying
48
48
49
49
Game servers can often be queried to check the server is running and return useful info. LinuxGSM uses gsquery.py to complete simple pings and [gamedig](https://github.com/gamedig/node-gamedig) to get detailed info returned in json format. 
50
50
51
51
Most game servers use the valve protocol for allowing queries, however, others are available. Look for any developer documentation to try and find out if querying is supported. 
52
52
53
53
Use the `query-raw` command to assist in testing the querying of the new game server. 
54
54
55
-
###Stop Mode
55
+
## Stop Mode
56
56
57
57
Game servers will be able to gracefully exit using various methods. Figure out the method the new game server uses. See [stop mode](https://docs.linuxgsm.com/features/stop-mode).
58
58
59
-
###Glibc Version
59
+
## Glibc Version
60
60
61
61
Most game servers require a minimum glibc version. Use the `detect-glibc` command to find out the minimum glibc version required.
62
62
63
-
###Details
63
+
## Details
64
64
65
65
Various game server info will need to be parsed from game server configs or variables. Use the info\_\*.sh modules to add this info. 
66
66
67
-
###Custom Updater
67
+
## Custom Updater
68
68
69
69
Not all game servers use SteamCMD. If this is the case a custom update module will need to be created. There are a number of examples in the code that can be used as a baseline.
70
70
71
-
Custom Commands
71
+
## Custom Commands
72
72
73
73
Some game servers may require bespoke commands to complete tasks. Examples of this include Teamspeak 3 and Unreal Tournament 2004. Take a look at the `core_getopts.sh` module for examples of how to add commands.
0 commit comments