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:
Executable
+46
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Social edge between two characters (friend, spouse, parent-child).
|
||||
*
|
||||
* For parent_child links character_a is the child and character_b is the parent.
|
||||
*/
|
||||
#[Fillable(['character_a_id', 'character_b_id', 'type', 'status'])]
|
||||
class Relationship extends Model
|
||||
{
|
||||
public const TYPE_FRIEND = 'friend';
|
||||
|
||||
public const TYPE_SPOUSE = 'spouse';
|
||||
|
||||
public const TYPE_PARENT_CHILD = 'parent_child';
|
||||
|
||||
public const STATUS_PENDING = 'pending';
|
||||
|
||||
public const STATUS_ACCEPTED = 'accepted';
|
||||
|
||||
/**
|
||||
* First character participant.
|
||||
*
|
||||
* @return BelongsTo<Character, $this>
|
||||
*/
|
||||
public function characterA(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Character::class, 'character_a_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Second character participant.
|
||||
*
|
||||
* @return BelongsTo<Character, $this>
|
||||
*/
|
||||
public function characterB(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Character::class, 'character_b_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user