feat(world): add persistent citizen simulation with needs, jobs, and social features

- Adds Character model with survival needs (hunger, thirst, energy) and state machine
- Implements city:tick world ticker for offline progression every minute
- Adds city territory expansion and building construction system
- Introduces job economy, inventory, and transaction audit trail
- Adds social graph (friends, marriage, children) and character chat
- Implements admin approval workflow for new registrations
- Adds hospital admission system for traffic accidents
- Includes comprehensive feature tests and world seeders
This commit is contained in:
2026-10-17 21:46:23 -03:00
parent 79d12fa2f4
commit 79ce2a1825
132 changed files with 11809 additions and 1036 deletions
+47
View File
@@ -0,0 +1,47 @@
<?php
namespace Tests\Feature;
use App\Models\Character;
use App\Models\City;
use App\Models\User;
use Database\Seeders\CityWorldSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
/**
* World schema and seeding coverage.
*/
class CityWorldSeedingTest extends TestCase
{
use RefreshDatabase;
/**
* Seeder creates City10, jobs and a character for active users.
*/
public function test_seeder_bootstraps_city_jobs_and_characters(): void
{
$this->seed(CityWorldSeeder::class);
$city = City::query()->where('slug', 'city10')->first();
$this->assertNotNull($city);
$this->assertTrue($city->is_active);
$this->assertSame(4, $city->jobs()->count());
$user = User::factory()->create(['status' => User::STATUS_ACTIVE, 'is_active' => true]);
$this->seed(CityWorldSeeder::class);
$this->assertNotNull(Character::query()->where('user_id', $user->id)->first());
}
/**
* Migration backfills legacy is_active flags onto status.
*/
public function test_status_backfill_matches_is_active(): void
{
$this->seed(CityWorldSeeder::class);
$active = User::where('is_active', true)->where('status', '!=', User::STATUS_ACTIVE)->count();
$this->assertSame(0, $active);
}
}