Skip to content

Commit 4c63990

Browse files
ygtrippsDaneEveritt
authored andcommitted
Add CS:GO to Source Service Option (pterodactyl#538)
* Added CS:GO This allows users to select rather or not to use cs:go for a server. * Removed debugging outputs * Replace tabs with spaces to pass StyleCI * Remove more pesky tabs I apparently missed them the first time. * Fix pesky issues with starts This fix is to repair the startup for csgo and remove the required accounts. * Better explanation for STEAM_ACC * Removed dupe ips * Added and fixed lines * Set a default map to be loaded in. * Set the variables rules to match what they would need to be * Removed a pesky space
1 parent 3e3da89 commit 4c63990

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

database/seeds/SourceServiceTableSeeder.php

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,58 @@ private function addCoreOptions()
192192
'script_entry' => 'bash',
193193
'script_container' => 'ubuntu:16.04',
194194
]);
195+
196+
$script = <<<'EOF'
197+
#!/bin/bash
198+
# CSGO Installation Script
199+
#
200+
# Server Files: /mnt/server
201+
apt -y update
202+
apt -y --no-install-recommends install curl lib32gcc1 ca-certificates
203+
204+
cd /tmp
205+
curl -sSL -o steamcmd.tar.gz http://media.steampowered.com/installer/steamcmd_linux.tar.gz
206+
207+
mkdir -p /mnt/server/steamcmd
208+
tar -xzvf steamcmd.tar.gz -C /mnt/server/steamcmd
209+
cd /mnt/server/steamcmd
210+
211+
# SteamCMD fails otherwise for some reason, even running as root.
212+
# This is changed at the end of the install process anyways.
213+
chown -R root:root /mnt
214+
215+
export HOME=/mnt/server
216+
./steamcmd.sh +login anonymous +force_install_dir /mnt/server +app_update 740 +quit
217+
218+
mkdir -p /mnt/server/.steam/sdk32
219+
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so
220+
EOF;
221+
222+
$this->option['csgo'] = ServiceOption::updateOrCreate([
223+
'service_id' => $this->service->id,
224+
'tag' => 'csgo',
225+
], [
226+
'name' => 'Counter-Strike: Global Offensive',
227+
'description' => 'Counter-Strike: Global Offensive is a multiplayer first-person shooter video game developed by Hidden Path Entertainment and Valve Corporation.',
228+
'docker_image' => 'quay.io/pterodactyl/core:source',
229+
'config_startup' => '{"done": "VAC secure mode is activated.", "userInteraction": []}',
230+
'config_files' => null,
231+
'config_logs' => '{"custom": true, "location": "logs/latest.log"}',
232+
'config_stop' => 'quit',
233+
'config_from' => $this->option['source']->id,
234+
'startup' => './srcds_run -game csgo -console -port {{SERVER_PORT}} +ip 0.0.0.0 +map {{SRCDS_MAP}} -strictportbind -norestart +sv_setsteamaccount {{STEAM_ACC}}',
235+
'script_install' => $script,
236+
'script_entry' => 'bash',
237+
'script_container' => 'ubuntu:16.04',
238+
]);
195239
}
196240

197241
private function addVariables()
198242
{
199243
$this->addInsurgencyVariables();
200244
$this->addTF2Variables();
201245
$this->addArkVariables();
246+
$this->addCSGOVariables();
202247
$this->addCustomVariables();
203248
}
204249

@@ -319,6 +364,33 @@ private function addArkVariables()
319364
]);
320365
}
321366

367+
private function addCSGOVariables()
368+
{
369+
ServiceVariable::updateOrCreate([
370+
'option_id' => $this->option['csgo']->id,
371+
'env_variable' => 'SRCDS_MAP',
372+
], [
373+
'name' => 'Map',
374+
'description' => 'The default map for the server.',
375+
'default_value' => 'de_dust2',
376+
'user_viewable' => 1,
377+
'user_editable' => 1,
378+
'rules' => 'required|string|alpha_dash',
379+
]);
380+
381+
ServiceVariable::updateOrCreate([
382+
'option_id' => $this->option['csgo']->id,
383+
'env_variable' => 'STEAM_ACC',
384+
], [
385+
'name' => 'Steam Account Token',
386+
'description' => 'The Steam Account Token required for the server to be displayed publicly.',
387+
'default_value' => '',
388+
'user_viewable' => 1,
389+
'user_editable' => 1,
390+
'rules' => 'required|string|alpha_num|size:32',
391+
]);
392+
}
393+
322394
private function addCustomVariables()
323395
{
324396
ServiceVariable::updateOrCreate([

0 commit comments

Comments
 (0)