Implement the minimal downtime foundation on the Actor (PC) sheet. This includes storing the last active in-world time and computing available downtime days based on Foundry world time.
This step introduces both data storage and derived logic, while keeping the scope small and testable.
Scope
- Add a downtime data structure on Actor flags
- Add UI to view and set last active time
- Compute available downtime days (derived, not persisted)
- Keep implementation compatible with PF2e Actor sheets
Data Model
Stored on:
actor.flags.<moduleName>.downtime
{
"lastActiveTime": number | null
}
Notes:
lastActiveTime uses Foundry world time (in seconds)
availableDays must NOT be stored (derived only)
Logic
Implement a helper function:
computeDowntimeDays(lastActiveTime: number, currentTime: number): number
Behavior:
- Returns
Math.floor((currentTime - lastActiveTime) / 86400)
- If
lastActiveTime is null or undefined → return 0
UI
Add a “Downtime” section to the Actor sheet (tab or panel, PF2e sheet).
Display
- Last Active Date (formatted if possible, raw fallback otherwise)
- Available Days (derived value)
Controls
Behavior
Acceptance Criteria
- Clicking “Set as Active Now” stores current world time in flags
- Available Days is correctly computed from world time
- No stored value for
availableDays (derived only)
- UI reflects updated values after interaction
- No errors if
lastActiveTime is not set
Notes
- This is part of a new feature called "downtime"
- Keep implementation simple and isolated
- Prefer pure functions for computation
- Ensure compatibility with future extensions (activities, history, multi-actor views)
Implement the minimal downtime foundation on the Actor (PC) sheet. This includes storing the last active in-world time and computing available downtime days based on Foundry world time.
This step introduces both data storage and derived logic, while keeping the scope small and testable.
Scope
Data Model
Stored on:
actor.flags.<moduleName>.downtime{ "lastActiveTime": number | null }Notes:
lastActiveTimeuses Foundry world time (in seconds)availableDaysmust NOT be stored (derived only)Logic
Implement a helper function:
Behavior:
Math.floor((currentTime - lastActiveTime) / 86400)lastActiveTimeis null or undefined → return 0UI
Add a “Downtime” section to the Actor sheet (tab or panel, PF2e sheet).
Display
Controls
Button: Set as Active Now
lastActiveTime = game.time.worldTimeButton: Recalculate
Behavior
Available Days updates when:
lastActiveTimechangesAcceptance Criteria
availableDays(derived only)lastActiveTimeis not setNotes