Skip to content

Sync bookcase and outfit stand#847

Merged
notfood merged 4 commits intorwmt:devfrom
Sakura-TA:fix/sync-bookcase-and-outfit-stand
Mar 25, 2026
Merged

Sync bookcase and outfit stand#847
notfood merged 4 commits intorwmt:devfrom
Sakura-TA:fix/sync-bookcase-and-outfit-stand

Conversation

@Sakura-TA
Copy link
Copy Markdown
Contributor

@Sakura-TA Sakura-TA commented Mar 24, 2026

Fix for #805
-Register SyncMethod for outfit stand.
-Used transpiler to sync bookcase. It's not very elegant solution though.

@Sakura-TA Sakura-TA mentioned this pull request Mar 24, 2026
@notfood notfood added fix Fixes for a bug or desync. 1.6 Fixes or bugs relating to 1.6 (Not Odyssey). labels Mar 24, 2026
@notfood notfood moved this to In review in 1.6 and Odyssey Mar 24, 2026
@notfood notfood linked an issue Mar 24, 2026 that may be closed by this pull request
@mibac138
Copy link
Copy Markdown
Member

From my testing both of those methods are now synced, so good job on that! They diverge a little from vanilla RimWorld though as the dropped items aren't forbidden (in vanilla they are forbidden). This isn't a major issue, but if you'd want to fix it, you can see DraftedMove_GotoFeedbackPatch for a similar case.
Also I'm not sure if adding a SyncWorker for ThingOwner and only handling one case is a good idea. I think I'd rather have the SyncMethod work on a Building_Bookcase instead of ThingOwner. You can probably achieve this by removing GetDirectlyHeldThings from this.Bookcase.GetDirectlyHeldThings().TryDrop(...). It's pretty hacky but then, a lot of the transpilation is.

    IL_00af: ldarg.0      // this
    IL_00b0: call         instance class RimWorld.Building_Bookcase RimWorld.ITab_ContentsBooks::get_Bookcase()
// remove callvirt GetDirectlyHeldThings
    IL_00b5: callvirt     instance class Verse.ThingOwner RimWorld.Building_Bookcase::GetDirectlyHeldThings()
    IL_00ba: ldarg.1      // book
    IL_00bb: ldloc.3      // result
    IL_00bc: ldarg.0      // this
    IL_00bd: call         instance class RimWorld.Building_Bookcase RimWorld.ITab_ContentsBooks::get_Bookcase()
    IL_00c2: callvirt     instance class Verse.Map Verse.Thing::get_Map()
    IL_00c7: ldc.i4.1
    IL_00c8: ldc.i4.1
    IL_00c9: ldloca.s     resultingThing
    IL_00cb: ldnull
    IL_00cc: ldnull
    IL_00cd: callvirt     instance bool Verse.ThingOwner::TryDrop(class Verse.Thing, valuetype Verse.IntVec3, class Verse.Map, valuetype Verse.ThingPlaceMode, int32, class Verse.Thing&, class [mscorlib]System.Action`2<class Verse.Thing, int32>, class [mscorlib]System.Predicate`1<valuetype Verse.IntVec3>)
    IL_00d2: pop

}
}

[HarmonyPatch(typeof(ITab_ContentsBooks), "DoRow")]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nameof(ITab_ContentsBooks.DoRow)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for review. Fixed.

@Sakura-TA
Copy link
Copy Markdown
Contributor Author

I think you're right on both counts, I'll try to handle them later.

@Sakura-TA
Copy link
Copy Markdown
Contributor Author

Not pretty sure about set forbidden. Maybe I can just set it forbidden to all player factions?

@notfood
Copy link
Copy Markdown
Member

notfood commented Mar 25, 2026

Player should be able to set it to forbidden individually. Would be weird if one toggles it and another gets it forbidden.

@Sakura-TA
Copy link
Copy Markdown
Contributor Author

Sorry for misleading. here the problem is that whether we set it forbidden to all factions when drop book/outfit on the ground. for now the code leads to forbidden to all players but the one clicked drop button. You can unforbid it later when the book/clothes is on the ground though.

@notfood notfood merged commit 3923808 into rwmt:dev Mar 25, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from In review to Done in 1.6 and Odyssey Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.6 Fixes or bugs relating to 1.6 (Not Odyssey). fix Fixes for a bug or desync.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1.6.4633 Bookcase

3 participants