cs:go, tf2 server sourcemod plugins
This is still very much a work in progress. Don’t try to use it unless you want to contribute to its development. Currently, this only targets python3 and unix-like systems
smbuilder is a build/package tool for managing SourceMod plugins and servers. It works as a command-line tool that:
The config files are just python files, so you can use any python syntax you want in them.
Consider a plugin (for example: my PugSetup plugin for CS:GO) that lives in the scripting directory.
scripting
You also might have some files under cfg, like server.cfg.
cfg
server.cfg
server.cfg:
hostname {{name}} sv_alltalk 1 mp_autokick 0
smbuild:
Plugin(name='pugsetup', source='scripting/pugsetup.sp') Package(name='pugsetup-server', plugins=['pugsetup'], args={ 'name': '10 man server', }, )
From the directory this all lives in, invoking smbuilder will
smbuilder
scripting/pugsetup.sp
pugsetup_cfgs
hostname
hostname 10 man server
This will produce the output package, which will live in builds/pugsetup-server, which will have both an addons directory and a cfg directory under it, matching the server file layout.
builds/pugsetup-server
addons
For a unix-style system, you should run:
git clone https://github.com/splewis/sm-builder
cd sm-builder
sudo apt-get install python-pip
sudo pip install -r requirements.txt
sudo python setup.py install
You may still need to configure a SourcePawn compiler, so read on below for how to do that.
Windows support may come later. It shouldn’t take much to get it to work, but there may be small issues to work out before I can claim it works on windows.
smbuilder <target>
Note that the output is always in the builds directory.
builds
The first time the program is run, it will produce a file in a user-config directory. For linux, this will generally be ~/.config/smbuilder.ini.
~/.config/smbuilder.ini
Example first run:
splewis-laptop csgo-retakes $ smbuilder Settings written to /home/splewis/.config/smbuilder.ini
You can also set things from command line flags (these overrule the config file settings):
--compiler (-c)
spcomp
You may want to add the path of of your sourcemod compiler to the system path, something like:PATH+=":/home/splewis/sm/addons/sourcemod/scripting"
PATH+=":/home/splewis/sm/addons/sourcemod/scripting"
You may define a Plugin or Package.
Plugin
Package
Registering a Plugin have the following named arguments:
source
binary
name
deps
Registering a Package has the following named arguments:
plugins
disabled_plugins
extends
configs
addons/sourcemod/configs
data
addons/sourcemod/data
gamedata
addons/sourcemod/gamedata
translations
addons/sourcemod/translations
sources
args
filegroups
You may also include plugins/packages from another directory using Include.
Include
Jinja2 is used for templating config files. Here is an brief example:
Package( name='mypackage', args={ 'name': 'myserver', 'competitive': True, }, )
some file in the cfg directory:
hostname {{name}} {% if competitive %} sv_alltalk 0 sv_deadtalk 1 {% else %} sv_alltalk 1 sv_deadtalk 0 {% endif %}
will produce a corresponding output file of:
hostname myserver sv_alltalk 0 sv_deadtalk 1
With this strategy you can reuse different configuration values and files in different packages, without making dozens of files.
There is a special arguments you can use in config files: plugin_binaries, which is set to the list of plugin binary filenames in the package.
plugin_binaries
[button url=”https://github.com/splewis/sm-builder/archive/master.zip”]Download[/button]
Your email address will not be published. Required fields are marked *
two + 8 =
This site uses Akismet to reduce spam. Learn how your comment data is processed.