modules/needs/needs.service
Needs service using the reactive observable system.
This service handles:
- Server-side needs decay (hunger, thirst decrease over time)
- Client-side vitals sampling from ped
- Automatic bidirectional sync via observables
- Persistence to database
Observable Architecture
- Per-player
serverOwnedobservables for needs (server has R/W, clients have RO) - Global
clientOwnedobservable for vitals (client has R/W, server has RO per-player)
Observables are the right choice here because:
- Hunger/thirst decay continuously on the server
- Client needs real-time updates for HUD display
- Values change frequently
Classes
| Class | Description |
|---|---|
| NeedsService | Needs service handling hunger, thirst, health, and armor. |