Skip to content

Commit

Permalink
Add planet delete option to developer shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
lanedirt committed Jan 6, 2025
1 parent ede21e2 commit 1769f6e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions app/Http/Controllers/Admin/DeveloperShortcutsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,19 @@ public function createAtCoords(Request $request, PlanetServiceFactory $planetSer
return redirect()->back()->with('success', 'Moon deleted successfully at ' . $coordinate->asString());
}

if ($request->has('delete_planet')) {
// Check if there's a moon at these coordinates.
$planet = $planetServiceFactory->makePlanetForCoordinate($coordinate);

if (!$planet) {
return redirect()->back()->with('error', 'No planet exists at ' . $coordinate->asString());
}

// Delete the planet.
$planet->abandonPlanet();
return redirect()->back()->with('success', 'Planet deleted successfully at ' . $coordinate->asString());
}

if ($request->has('create_planet')) {
// Create planet for current admin user
$planetServiceFactory->createAdditionalPlanetForPlayer($player, $coordinate);
Expand Down
3 changes: 2 additions & 1 deletion resources/views/ingame/admin/developershortcuts.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ class="textInput w100 textCenter textBeefy"
</div>
</div>
<div class="fieldwrapper" style="text-align: center; margin-bottom: 20px;">
<input type="submit" class="btn_blue" name="create_planet" value="@lang('Create Planet (For Myself)')">
<input type="submit" class="btn_blue" name="create_planet" value="@lang('Create Planet')">
<input type="submit" class="btn_blue" name="create_moon" value="@lang('Create Moon')">
<input type="submit" class="btn_blue" name="delete_planet" value="@lang('Delete Planet')">
<input type="submit" class="btn_blue" name="delete_moon" value="@lang('Delete Moon')">
</div>
</div>
Expand Down

0 comments on commit 1769f6e

Please sign in to comment.