Initial commit

This commit is contained in:
root
2026-05-09 17:28:23 +02:00
commit 9d73f82529
5575 changed files with 281989 additions and 0 deletions
+88
View File
@@ -0,0 +1,88 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
class FixGamedataSymlinks extends Command
{
#[\Override]
protected $signature = 'atom:fix-gamedata-symlinks {--dry-run : Show what would be done without making changes}';
#[\Override]
protected $description = 'Create symlinks in gamedata directory for bundled assets';
private array $symlinks = [
'effect' => 'bundled/effect',
'furniture' => 'bundled/furniture',
'generic' => 'bundled/generic',
'pet' => 'bundled/pet',
'figure' => 'bundled/figure',
'generic_custom' => 'bundled/generic',
];
public function handle(): int
{
$gamedataPath = base_path('../Gamedata');
if (! File::exists($gamedataPath)) {
$this->error('Gamedata directory not found at: ' . $gamedataPath);
return Command::FAILURE;
}
$this->info('Checking gamedata symlinks...');
$this->newLine();
$created = 0;
$skipped = 0;
$fixed = 0;
foreach ($this->symlinks as $link => $target) {
$linkPath = $gamedataPath . '/' . $link;
$targetPath = $gamedataPath . '/' . $target;
if (! File::exists($targetPath)) {
$this->warn(" ⚠️ Target does not exist: $target");
continue;
}
if (File::exists($linkPath)) {
if (is_link($linkPath)) {
$currentTarget = readlink($linkPath);
if ($currentTarget === $target) {
$this->line("$link$target (already correct)");
$skipped++;
} elseif ($this->option('dry-run')) {
$this->warn(" → Would fix: $link (currently points to: $currentTarget)");
} else {
unlink($linkPath);
symlink($target, $linkPath);
$this->info(" ✨ Fixed: $link$target");
$fixed++;
}
} elseif ($this->option('dry-run')) {
$this->warn(" → Would replace: $link (is a regular file/directory)");
} else {
$this->warn(" ⚠️ Cannot create symlink, $link exists as file/directory");
}
} elseif ($this->option('dry-run')) {
$this->warn(" → Would create: $link$target");
} else {
symlink($target, $linkPath);
$this->info(" ✓ Created: $link$target");
$created++;
}
}
$this->newLine();
$this->info('Summary:');
$this->line(" Created: $created");
$this->line(" Fixed: $fixed");
$this->line(" Already correct: $skipped");
return Command::SUCCESS;
}
}