Table of Contents

Class NPCSchedule

Namespace
S1API.Entities
Assembly
S1API.dll

Modder-facing scheduling wrapper for an NPC. Exposes the underlying schedule manager to enable, disable, and manage scheduled actions and curfew modes. Schedule configuration must be done in ConfigurePrefab(NPCPrefabBuilder).

public sealed class NPCSchedule
Inheritance
NPCSchedule
Inherited Members
Extension Methods

Remarks

Use this to control NPC movement patterns, building visits, and timed activities. Schedules are defined in ConfigurePrefab(NPCPrefabBuilder) using NPCPrefabBuilder.WithSchedule(...) and managed at runtime via this wrapper.

Properties

CurfewModeEnabled

Whether the schedule is currently in curfew mode.

public bool CurfewModeEnabled { get; }

Property Value

bool

IsEnabled

Whether the schedule is currently enabled.

public bool IsEnabled { get; }

Property Value

bool

Methods

ClearActions(bool, bool)

Removes all actions under the schedule manager with optional filtering by action type.

public void ClearActions(bool includeSignals = true, bool includeEvents = true)

Parameters

includeSignals bool

Whether to remove signal-type actions (e.g., WalkTo, DriveToCarPark). Default is true.

includeEvents bool

Whether to remove event-type actions (e.g., StayInBuilding, LocationDialogue). Default is true.

Remarks

This method removes all schedule actions from the NPC's schedule manager. Actions are disabled and reset instead of being destroyed to maintain FishNet network component indices and avoid network synchronization issues.

After clearing actions, the schedule manager is re-initialized to update the action order and timing.

Use with caution as this will completely reset the NPC's scheduled behavior.

Disable()

Disables the NPC's schedule.

public void Disable()

Enable()

Enables the NPC's schedule.

public void Enable()

EnforceState()

Forces the manager to enforce state immediately (e.g., after toggles or time jumps).

public void EnforceState()

EnsureDealSignal()

Retained for source compatibility with game versions that used a deal-wait schedule signal.

[Obsolete("NPCSignal_WaitForDelivery was removed in game version 0.4.6. Override NPC.IsCustomer; customer deal attendance is configured automatically.")]
public void EnsureDealSignal()

Remarks

Schedule I 0.4.6 removed NPCSignal_WaitForDelivery. Customer deal attendance is configured automatically when IsCustomer is true. This method now performs no runtime work and logs one compatibility warning per process.

GetActionNames()

Returns the names of all currently configured actions, including inactive and disabled ones.

public IReadOnlyList<string> GetActionNames()

Returns

IReadOnlyList<string>

A read-only list of action names. Returns an empty list if no schedule manager exists.

Remarks

This method retrieves the names of all schedule actions currently configured on the NPC, regardless of their active state. This can be useful for debugging or monitoring the NPC's schedule configuration.

The returned list includes both signal-type and event-type actions.

GetActiveActionName()

Returns the active action label, if any.

public string GetActiveActionName()

Returns

string

SetCurfewMode(bool)

Sets or clears curfew mode.

public void SetCurfewMode(bool enabled)

Parameters

enabled bool