feat(city): add plaza exercise system with health tracking
- Adds CityPlazas support class for deterministic public plaza generation with outdoor gym equipment - Implements exercise and stop-exercise actions with proximity validation to equipment - Introduces health (0-100) and exercise_count attributes to Character model - Reduces hospital stay duration from two game days to one game hour - Adds 3D gym equipment rendering (bench, bars, bike, treadmill) in city viewer - Includes exercise state machine handling in world ticker with energy drain - Adds comprehensive PlazaExerciseTest and updates HospitalAdmissionTest - Provides localized UI strings for health HUD and exercise prompts
This commit is contained in:
@@ -134,6 +134,13 @@ class CityTick extends Command
|
||||
$character->energy = max(0, (int) $character->energy - (int) round(0.8 * $elapsedMin));
|
||||
break;
|
||||
|
||||
case Character::STATE_EXERCISING:
|
||||
$character->energy = max(0, (int) $character->energy - (int) round(1.0 * $elapsedMin));
|
||||
if ((int) $character->energy <= 5) {
|
||||
$character->state = Character::STATE_AWAKE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$drain = $starving ? 0.8 : 0.4;
|
||||
$character->energy = max(0, (int) $character->energy - (int) round($drain * $elapsedMin));
|
||||
@@ -162,6 +169,13 @@ class CityTick extends Command
|
||||
return;
|
||||
}
|
||||
|
||||
// Offline exercise sessions end after the next tick so NPCs recover.
|
||||
if ($character->state === Character::STATE_EXERCISING) {
|
||||
$character->state = Character::STATE_AWAKE;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($character->energy < 20 && $character->house_id !== null) {
|
||||
$character->state = Character::STATE_SLEEPING;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user