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
+68
View File
@@ -0,0 +1,68 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Player-constructed structure placed on free terrain inside a city.
*
* Construction advances through build_progress on each world tick until the
* building is complete; finished houses become the owner's residence.
*/
#[Fillable([
'city_id', 'owner_character_id', 'type', 'name',
'pos_x', 'pos_z', 'width', 'depth', 'height',
'is_complete', 'build_progress',
])]
class Building extends Model
{
public const TYPE_HOUSE = 'house';
/**
* Public hospital where accident victims are admitted.
*
* @var string
*/
public const TYPE_HOSPITAL = 'hospital';
/**
* City containing this building.
*
* @return BelongsTo<City, $this>
*/
public function city(): BelongsTo
{
return $this->belongsTo(City::class);
}
/**
* Character that commissioned the building.
*
* @return BelongsTo<Character, $this>
*/
public function owner(): BelongsTo
{
return $this->belongsTo(Character::class, 'owner_character_id');
}
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'pos_x' => 'float',
'pos_z' => 'float',
'width' => 'float',
'depth' => 'float',
'height' => 'float',
'is_complete' => 'boolean',
'build_progress' => 'integer',
];
}
}