Constructor
new NPCSchedule(configopt)
| Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config | Object | <optional> | {} | Configuration options. Properties
|
- Source
Classes
Members
isInDanger
Whether NPC is currently in danger.
- Source
isSuspended
Whether schedule execution is currently suspended due to danger.
- Source
Methods
addSlot(slot) → {ScheduleSlot}
Adds a schedule slot to this NPC's routine.
| Name | Type | Description |
|---|---|---|
slot | ScheduleSlot | | Slot instance or config object. |
- Source
The added slot.
- Type:
- ScheduleSlot
getSlotForHour(hour) → {ScheduleSlot|null}
Finds the matching slot for a given hour based on priority and time interval.
| Name | Type | Description |
|---|---|---|
hour | number | | Game hour. |
- Source
Matching slot or null.
- Type:
- ScheduleSlot |
null
removeSlot(slotId) → {boolean}
Removes a slot by its identifier.
| Name | Type | Description |
|---|---|---|
slotId | string | Identifier of slot to remove. |
- Source
True if removed.
- Type:
- boolean
resolveDanger(optionsopt) → {string}
Resolves the danger condition and resumes scheduled activity. Evaluates current hour and seamlessly picks up the appropriate schedule slot.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options | Object | <optional> | {} | Resumption options. |
- Source
Resumed activity.
- Type:
- string
triggerDanger(dangerDataopt) → {NPCSchedule}
Suspends normal schedule execution in reaction to perceived danger.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
dangerData | Object | <optional> | {} | Details of the perceived threat. |
- Source
This instance.
- Type:
- NPCSchedule
update(time) → {string}
Updates the NPC schedule to the given hour. Handles slot transitions, danger suspension, and destination fallback.
| Name | Type | Description |
|---|---|---|
time | number | | Current game hour or clock. |
- Source
Current activity.
- Type:
- string