feat(api): implement Pawn Social subsystem and REST endpoints#74
Open
IlyaChichkov wants to merge 3 commits intodevelopfrom
Open
feat(api): implement Pawn Social subsystem and REST endpoints#74IlyaChichkov wants to merge 3 commits intodevelopfrom
IlyaChichkov wants to merge 3 commits intodevelopfrom
Conversation
jkbennitt
suggested changes
Apr 9, 2026
Contributor
jkbennitt
left a comment
There was a problem hiding this comment.
Review
Comprehensive social API — interactions, relations, opinions, force/add/remove. Follows the established controller pattern (direct service calls, main-thread execution via the request queue pipeline). One compilation blocker.
1. Compilation error in GetPawnOpinions — st vs t (blocker)
Line 297: foreach (var st in socialThoughts) but line 299 uses if (t is Thought_SituationalSocial ss ...). Loop variable is st, body references t. This won't compile. Likely needs st throughout (or rename the loop variable to t).
Minor / Suggestions
- Hardcoded 120-tick cooldown (line 276): Magic number — worth a comment documenting the source in RimWorld's interaction system.
- Reflection fragility:
PlayLogEntry_Interactionfields (initiator,recipient,intDef) accessed via reflection. If field names change across RimWorld versions, entries silently return null. A one-time log warning when field resolution fails would help. - No pagination on interaction log:
GetPawnInteractionLogiterates allPlayLog.AllEntries. On long colonies this could be hundreds of entries. A?limit=Nquery param (defaulting to e.g. 50) would be useful. - DELETE with JSON body:
RemoveRelationuses DELETE with a request body. Some proxies/clients strip bodies from DELETE requests. Query params would be more portable.
What's good
- Comprehensive scope — 8 endpoints covering the full social subsystem
- Reflection fields cached outside loops in interaction log parsing
entry.Concerns(pawn)fast-path filter before heavier reflection work- Graceful empty-list handling when PlayLog is null
- Bruno collection covers all endpoints
- Follows established DDD controller pattern
8ad2cc7 to
6a9bf92
Compare
2d371f8 to
bfc9ec5
Compare
Adds `PawnSocialController` to expose REST endpoints for RimWorld's pawn social systems. Supported capabilities include: - Fetching available interaction defs, pawn interaction status, and recent interaction logs. - Retrieving established pawn relations and detailed opinion breakdowns. - Forcing specific social interactions between pawns. - Dynamically adding or removing direct social relations.
Add API macro macroses for PawnSocialController in English and Russian. Include endpoints for interactions, relations, and opinions. Update pawn documentation index.
bfc9ec5 to
443ca66
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces the PawnSocialController and its backing service, exposing RimWorld's social and relationship systems to the REST API. It allows clients to query real-time interaction readiness, extract deep historical interaction logs, view opinion breakdowns, and actively manipulate relationships or force interactions.
New Endpoints
Queries (GET)
Actions (POST/DELETE)