Skip to content

Add Sit schedule action and duration support#52

Merged
ifBars merged 1 commit intoifBars:stablefrom
HazDS:haz/NPCSitFix
Mar 7, 2026
Merged

Add Sit schedule action and duration support#52
ifBars merged 1 commit intoifBars:stablefrom
HazDS:haz/NPCSitFix

Conversation

@HazDS
Copy link
Collaborator

@HazDS HazDS commented Mar 6, 2026

Track and emit sit actions for NPC prefabs and add configurable duration to Sit specs. NPCPrefabBuilder now counts SitSpec instances and ensures a corresponding prefab action (NPCEvent_Sit). SitSpec gained a DurationMinutes property and sets action.Duration (defaulting to 60 minutes when not positive); StartTime doc was clarified to 24-hour format. PrefabScheduleBuilder.SitAtSeatSet was updated to accept a durationMinutes parameter and pass it into the SitSpec.

Release Notes

  • Added sit action tracking for NPC prefabs by counting SitSpec instances and ensuring a corresponding NPCEvent_Sit prefab action is created
  • Introduced configurable duration support for sit actions via the new DurationMinutes property on SitSpec, with a default duration of 60 minutes when a non-positive value is provided
  • Updated PrefabScheduleBuilder.SitAtSeatSet() method signature to accept a durationMinutes parameter (defaults to 60)
  • Clarified SitSpec.StartTime documentation to specify 24-hour format input
Author Files Changed Lines Added Lines Removed
HazDS 3 15 4

Track and emit sit actions for NPC prefabs and add configurable duration to Sit specs. NPCPrefabBuilder now counts SitSpec instances and ensures a corresponding prefab action (NPCEvent_Sit). SitSpec gained a DurationMinutes property and sets action.Duration (defaulting to 60 minutes when not positive); StartTime doc was clarified to 24-hour format. PrefabScheduleBuilder.SitAtSeatSet was updated to accept a durationMinutes parameter and pass it into the SitSpec.
@HazDS HazDS requested a review from ifBars March 6, 2026 22:32
@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

📝 Walkthrough

Walkthrough

The changes introduce configurable duration for NPC sit actions. A new DurationMinutes property is added to SitSpec, exposed via the NPCScheduleBuilder.SitAtSeatSet method signature with a default of 60 minutes, and integrated into the prefab action builder to properly create sit action specifications.

Changes

Cohort / File(s) Summary
Sit Action Duration Configuration
S1API/Entities/Schedule/ActionSpecs/SitSpec.cs, S1API/Entities/Schedule/NPCScheduleBuilder.cs
Added DurationMinutes property to SitSpec with default behavior (60 min fallback). Updated SitAtSeatSet method signature to accept durationMinutes parameter and wire it to the spec.
Prefab Action Wiring
S1API/Entities/NPCPrefabBuilder.cs
Extended PrecreateActionsForSpecs to handle SitSpec alongside existing action types, incrementing a sit counter and ensuring corresponding NPCEvent_Sit prefab actions are created.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A rabbit adds some restful grace,
Sit duration finds its place!
Through builders' hands, the minutes flow,
Now NPCs can rest just so! 🪑

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 70.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add Sit schedule action and duration support' is concise (44 characters, under 50), descriptive, and directly matches the main changes in the pull request—adding sit action handling and duration support.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@S1API/Entities/Schedule/ActionSpecs/SitSpec.cs`:
- Around line 33-37: The XML doc for SitSpec.DurationMinutes is inaccurate: the
summary claims non-positive values default to "the time remaining until the next
scheduled action" but the implementation uses a hard-coded 60-minute fallback;
update the DurationMinutes summary to state that non-positive values default to
60 minutes (or alternatively change the implementation to derive from the next
scheduled action if that behavior is desired). Specifically, edit the XML
comment on the DurationMinutes property in SitSpec to reflect the actual
fallback of 60 minutes (or make the implementation and any helper method that
reads DurationMinutes conform to the documented behavior).

In `@S1API/Entities/Schedule/NPCScheduleBuilder.cs`:
- Around line 67-68: The XML docs for startTime are inconsistent:
PrefabScheduleBuilder describes startTime as HHmm while other scheduling methods
use "minutes from midnight"; update all related XML <param name="startTime">
comments (including in PrefabScheduleBuilder and NPCScheduleBuilder scheduling
overloads that feed the shared StartTime concept) to use the same
format—preferably HHmm to match the new overload—so mod authors see a consistent
contract; locate all methods that set or accept StartTime (e.g.,
PrefabScheduleBuilder.* overloads, NPCScheduleBuilder methods referencing
StartTime, and any overloads with durationMinutes) and change their param text
to the unified HHmm description.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ca515e71-a739-42db-8bda-a7de2c52a6e6

📥 Commits

Reviewing files that changed from the base of the PR and between 54cc2d8 and 4085da9.

📒 Files selected for processing (3)
  • S1API/Entities/NPCPrefabBuilder.cs
  • S1API/Entities/Schedule/ActionSpecs/SitSpec.cs
  • S1API/Entities/Schedule/NPCScheduleBuilder.cs

Comment on lines +33 to +37
/// <summary>
/// Gets or sets the duration of the sit action in minutes.
/// If not set (0 or negative), defaults to the time remaining until the next scheduled action.
/// </summary>
public int DurationMinutes { get; set; }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix the DurationMinutes XML docs.

The summary here says non-positive values fall back to "the time remaining until the next scheduled action", but Line 107 hard-codes a 60 minute fallback. That makes the public contract misleading for anyone constructing SitSpec directly.

📝 Proposed doc fix
 /// <summary>
 /// Gets or sets the duration of the sit action in minutes.
-/// If not set (0 or negative), defaults to the time remaining until the next scheduled action.
+/// If not set (0 or negative), defaults to 60 minutes.
 /// </summary>
 public int DurationMinutes { get; set; }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// <summary>
/// Gets or sets the duration of the sit action in minutes.
/// If not set (0 or negative), defaults to the time remaining until the next scheduled action.
/// </summary>
public int DurationMinutes { get; set; }
/// <summary>
/// Gets or sets the duration of the sit action in minutes.
/// If not set (0 or negative), defaults to 60 minutes.
/// </summary>
public int DurationMinutes { get; set; }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@S1API/Entities/Schedule/ActionSpecs/SitSpec.cs` around lines 33 - 37, The XML
doc for SitSpec.DurationMinutes is inaccurate: the summary claims non-positive
values default to "the time remaining until the next scheduled action" but the
implementation uses a hard-coded 60-minute fallback; update the DurationMinutes
summary to state that non-positive values default to 60 minutes (or
alternatively change the implementation to derive from the next scheduled action
if that behavior is desired). Specifically, edit the XML comment on the
DurationMinutes property in SitSpec to reflect the actual fallback of 60 minutes
(or make the implementation and any helper method that reads DurationMinutes
conform to the documented behavior).

Comment on lines +67 to +68
/// <param name="startTime">The time when this action should start, in 24-hour time (e.g. 830 for 8:30 AM).</param>
/// <param name="durationMinutes">Duration of the sit action in minutes. Defaults to 60.</param>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Align the startTime docs across PrefabScheduleBuilder.

This overload now documents HHmm, but the other scheduling methods in this same public API still say "minutes from midnight (0-1439)". Since they all feed the same StartTime concept, the mixed contract is easy for mod authors to misread and can lead to silently mis-scheduled actions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@S1API/Entities/Schedule/NPCScheduleBuilder.cs` around lines 67 - 68, The XML
docs for startTime are inconsistent: PrefabScheduleBuilder describes startTime
as HHmm while other scheduling methods use "minutes from midnight"; update all
related XML <param name="startTime"> comments (including in
PrefabScheduleBuilder and NPCScheduleBuilder scheduling overloads that feed the
shared StartTime concept) to use the same format—preferably HHmm to match the
new overload—so mod authors see a consistent contract; locate all methods that
set or accept StartTime (e.g., PrefabScheduleBuilder.* overloads,
NPCScheduleBuilder methods referencing StartTime, and any overloads with
durationMinutes) and change their param text to the unified HHmm description.

Copy link
Owner

@ifBars ifBars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR as always ❤️

@ifBars ifBars merged commit e5a58b2 into ifBars:stable Mar 7, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants