Skip to content

Commit e069690

Browse files
committed
Fix issue that would prevent Ark servers from being added to servers.
Renamed migration file to force it to re-run on previously migrated systems.
1 parent b586fea commit e069690

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

database/migrations/2016_10_30_000949_add_ark_service_option.php renamed to database/migrations/2016_11_04_000949_add_ark_service_option_fixed.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Database\Migrations\Migration;
66

7-
class AddArkServiceOption extends Migration
7+
class AddArkServiceOptionFixed extends Migration
88
{
99
/**
1010
* Run the migrations.
@@ -15,10 +15,17 @@ public function up()
1515
{
1616
DB::transaction(function () {
1717
$service = DB::table('services')->select('id')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('name', 'Source Engine')->first();
18+
19+
// No SRCDS Service, Skipping
1820
if (!$service) {
1921
return;
2022
}
2123

24+
// Already have this service option installed.
25+
if (DB::table('service_options')->select('id')->where('name', 'Ark: Survival Evolved')->where('parent_service', $service->id)->first()) {
26+
return;
27+
}
28+
2229
$oid = DB::table('service_options')->insertGetId([
2330
'parent_service' => $service->id,
2431
'name' => 'Ark: Survival Evolved',

database/seeds/SourceServiceTableSeeder.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ private function addCoreOptions()
8787
'startup' => '-game {{SRCDS_GAME}} -console -port {{SERVER_PORT}} +map {{SRCDS_MAP}} -strictportbind -norestart'
8888
]);
8989

90+
$this->option['ark'] = Models\ServiceOptions::create([
91+
'parent_service' => $this->service->id,
92+
'name' => 'Ark: Survival Evolved',
93+
'description' => 'As a man or woman stranded, naked, freezing, and starving on the unforgiving shores of a mysterious island called ARK, use your skill and cunning to kill or tame and ride the plethora of leviathan dinosaurs and other primeval creatures roaming the land. Hunt, harvest resources, craft items, grow crops, research technologies, and build shelters to withstand the elements and store valuables, all while teaming up with (or preying upon) hundreds of other players to survive, dominate... and escape! — Gamepedia: ARK',
94+
'tag' => 'ark',
95+
'docker_image' => 'quay.io/pterodactyl/srcds:ark',
96+
'executable' => './ShooterGameServer',
97+
'startup' => 'TheIsland?listen?ServerPassword={{ARK_PASSWORD}}?ServerAdminPassword={{ARK_ADMIN_PASSWORD}}?Port={{SERVER_PORT}}?MaxPlayers={{SERVER_MAX_PLAYERS}}'
98+
]);
99+
90100
$this->option['custom'] = Models\ServiceOptions::create([
91101
'parent_service' => $this->service->id,
92102
'name' => 'Custom Source Engine Game',
@@ -102,6 +112,7 @@ private function addVariables()
102112
{
103113
$this->addInsurgencyVariables();
104114
$this->addTF2Variables();
115+
$this->addArkVariables();
105116
$this->addCustomVariables();
106117
}
107118

@@ -183,6 +194,45 @@ private function addTF2Variables()
183194
]);
184195
}
185196

197+
private function addArkVariables()
198+
{
199+
DB::table('service_variables')->insert([
200+
'option_id' => $this->option['ark']->id,
201+
'name' => 'Server Password',
202+
'description' => 'If specified, players must provide this password to join the server.',
203+
'env_variable' => 'ARK_PASSWORD',
204+
'default_value' => '',
205+
'user_viewable' => 1,
206+
'user_editable' => 1,
207+
'required' => 0,
208+
'regex' => '/^(\w\.*)$/'
209+
]);
210+
211+
DB::table('service_variables')->insert([
212+
'option_id' => $this->option['ark']->id,
213+
'name' => 'Admin Password',
214+
'description' => 'If specified, players must provide this password (via the in-game console) to gain access to administrator commands on the server.',
215+
'env_variable' => 'ARK_ADMIN_PASSWORD',
216+
'default_value' => '',
217+
'user_viewable' => 1,
218+
'user_editable' => 1,
219+
'required' => 0,
220+
'regex' => '/^(\w\.*)$/'
221+
]);
222+
223+
DB::table('service_variables')->insert([
224+
'option_id' => $this->option['ark']->id,
225+
'name' => 'Maximum Players',
226+
'description' => 'Specifies the maximum number of players that can play on the server simultaneously.',
227+
'env_variable' => 'SERVER_MAX_PLAYERS',
228+
'default_value' => 20,
229+
'user_viewable' => 1,
230+
'user_editable' => 1,
231+
'required' => 1,
232+
'regex' => '/^(\d{1,4})$/'
233+
]);
234+
}
235+
186236
private function addCustomVariables()
187237
{
188238
Models\ServiceVariables::create([

0 commit comments

Comments
 (0)