RimWorld

RimWorld

Sensible Bed Ownership
136 Comments
Caek Nov 11 @ 10:01pm 
My god, this thing should've been in the base game. I'm trying to run a pirate gang using the gravship but coming back to my base, but constantly havign to move the crew back and forth was driving me absolutely mental. This completely fixes that 100%.

Thanks for making it - this is a huge help.
VITO1189 Nov 9 @ 5:47pm 
ok thank you!
1trickPwnyta  [author] Nov 9 @ 3:39pm 
@VITO1189 Safe to add, not sure about remove. But probably.
VITO1189 Nov 9 @ 3:07pm 
is it safe to add remove ingame?
1trickPwnyta  [author] Oct 20 @ 9:34pm 
@Yxklyx That's intentional - They will keep their gravship assigned beds wherever they go but will prefer their stationary beds. You can change this by setting the gravship bed to their favorite, if you wish.
Yxklyx Oct 20 @ 9:28pm 
This seems to work ok - but I've got a gravship that I send out from my main base and when I get back their names are assigned to both a bed on the gravship and one in the main base (though it looks like they end up in the appropriate bed in the base). I can just unassign the beds on the gravship and all is good.
Tekuromoto Oct 9 @ 11:05am 
@1trickPwnyta I've moved it into a discussion to avoid clutter here.
1trickPwnyta  [author] Oct 8 @ 11:13am 
@Tekuromoto Even without this mod, I'm unable to get a menu for force sleep with Reverse Commands. Are you thinking of the Go The Fork To Sleep mod? I know that mod does that as well. However, I tested it and it seems to work fine with Sensible Bed Ownership.
1trickPwnyta  [author] Oct 3 @ 12:13pm 
@Tekuromoto I'll see what I can do. If it's not a trivial fix it might take me a while to circle back to it. Thanks!
Tekuromoto Oct 3 @ 11:53am 
Hi there. Great mod, thanks!

There seems to be an incompatibility with Reverse Commands https://steamcommunity.com/sharedfiles/filedetails/?id=858744731

That mod lets you give orders in reverse by right clicking an item then selecting an action and colonist from the flyout menu. When right clicking a bed (without this mod) it gives the option to force sleep. With this mod, however, I get a red error in the log and nothing happens. The game doesn't crash or anything.

The rest of the functionality of both mods seems to be fine. So I'm avoiding right clicking on beds for the moment 😏

Any chance of a compatibility patch from your end, since Brrainz doesn't accept comments on steam so I can't notify him.
WarKittyKat Sep 22 @ 1:02pm 
Just gonna leave a comment here in case other people need it - if you have royals, make sure that their preferred bed is the one that's suitable! I had my royal bedrooms on a gravship, and they would all start complaining unless I set the bed on the gravship to preferred.
Geojak Sep 8 @ 12:11pm 
seems to be the other mods fault, removed this and still get the error
Geojak Sep 8 @ 12:09pm 
seems to be some weird bug incompability with the poly bed mod
Geojak Sep 8 @ 12:09pm 
Varon threw exception in WorkGiver DoctorRescue: System.NullReferenceException: Object reference not set to an instance of an object
[]
at RimWorld.SpouseRelationUtility.GetLoveRelations (Verse.Pawn pawn, System.Boolean includeDead, System.Boolean orderByCommitmentLevel) [ in <>:0
at OneBedToSleepWithAll.PolygamyModeUtility.CheckIsHavePartnersPolygamyBedOccupied (
at OneBedToSleepWithAll.Patch.RestUtility__FindBedFor.Postfix () [] in <49f4dbaeffe44fa6ba819cb073663d00>:0
at RimWorld.RestUtility.FindBedFor (V
- TRANSPILER sensiblebedownership.1trickPwnyta: IEnumerable`1 SensibleBedOwnership.Patch_RestUtility:Transpiler(I)
- POSTFIX densevoid.hui.personalworkcat: Void OneBedToSleepWithAll.Patch.RestUtility__FindBedFor:Postfix(Building_Bed& __result, Pawn sleeper, Pawn traveler, Boolean checkSocialProperness, Boolean ignoreOtherReservations, Nullable`1 guestStatus)
at RimWorld.WorkGiver_TakeToBed.FindBed ()
Gabe Knight Sep 3 @ 6:44pm 
Really good mod. Thank you
1trickPwnyta  [author] Sep 3 @ 5:10pm 
@Kerpi @Ted I tried the Loft Bed mod and it was working fine for me, to my surprise. I added some extra logging to help troubleshoot the issue. The extra logging will only happen with dev mode enabled, so if you could try again with dev mode enabled (and make sure the mod is updated to version 1.2.6) and send me the log when it happens, that could help. Thanks!
Ted Sep 2 @ 10:39pm 
Can confirm @Kerpi comment based off what he said. I couldnt land my gravship but once I removed this mod I could. I also have Loft Beds mod.
Kerpi Sep 2 @ 3:04pm 
I was unable to land my gravship after takeoff and we identified this mod as the problem. Someone said it might be a "conflict between loft bed, bed ownership and odyssey". I removed this mod and the ship was able to land again. Here are my logs in case they can help!
https://gist.github.com/Kerpimon/9b3df053aede0f24a06a4d7434046620
horologium Aug 28 @ 11:20pm 
can't you just recreate the issue and get that log if its causing problems?
raz334 Aug 28 @ 10:32pm 
* i no longer have the logs, but i gave them to Grok and had it examine them after i experienced a > Game Freeze < , and it identified this mod alone and very sure of itself despite a long list of nearly 500 mods. I removed and tested, it was right. Game worked fine after that.

It occurred when my GravShip was coming in to land, as it said "preparing to land" then it froze.
Just letting you know. Sorry i don't have the logs anymore, they tend to get overwritten quickly..
SourceShard Aug 25 @ 6:07pm 
Test went well everything worked fine
IX Aug 21 @ 12:08am 
Hi, I uploaded the log file earlier, but after repeating my tests several times, I wasn’t able to reproduce the bug again.
It seems that some specific conditions might be required for the error to occur.
https://gist.github.com/HugsLibRecordKeeper/fe7084ef2ad5df16d4dfe91b57eca1c9
1trickPwnyta  [author] Aug 20 @ 1:27pm 
I fixed the gravship issues with beds in a new update that is NOT published yet. I'll need a bit more time to make sure there aren't any new issues. You can try out the new update here: https://github.com/1trickPwnyta/SensibleBedOwnership/releases/tag/v1.2.5
1trickPwnyta  [author] Aug 20 @ 1:22pm 
@IX I'm not getting the same error in my game. Are you able to provide the full log file?
1trickPwnyta  [author] Aug 20 @ 6:39am 
@IX Thanks for reporting! I'll look into that.
IX Aug 20 @ 3:38am 
Exception while recalculating SharedBed thought state for pawn 斯泰尔: System.NullReferenceException: Object reference not set to an instance of an object
[Ref 569775F5] Duplicate stacktrace, see ref for original
UnityEngine.StackTraceUtility:ExtractStackTrace ()
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Log.Error_Patch1 (string)
RimWorld.SituationalThoughtHandler:TryCreateThought (RimWorld.ThoughtDef)
RimWorld.SituationalThoughtHandler:UpdateAllMoodThoughts ()
RimWorld.SituationalThoughtHandler:SituationalThoughtInterval ()
RimWorld.ThoughtHandler:ThoughtInterval ()
RimWorld.Need_Mood:NeedInterval ()
RimWorld.Pawn_NeedsTracker:NeedsTrackerTickInterval (int)
Verse.Pawn:TickInterval (int)
Verse.Thing:DoTick ()
Verse.TickList:Tick ()
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.TickManager.DoSingleTick_Patch1 (Verse.TickManager)
Verse.TickManager:TickManagerUpdate ()
Verse.Game:UpdatePlay ()
Verse.Root_Play:Update ()
IX Aug 20 @ 3:36am 
Hi, I think I found a bug with the mod.

When pawns are out on temporary map without any bed, the game throws a related to the "SharedBed" thought calculation. It seems the mod is still trying to check bed ownership even though no bed exists on that map.NullReferenceException

Interestingly, this does not happen in the home base — if there are no beds there, pawns just sleep on the ground and no error appears. The issue seems specific to pawns on temporary maps without beds.

As a workaround, I assigned a sleeping spot to the pawn on the temporary map, and the error disappeared.

Thanks a lot for your work on this mod!
girlkisser Aug 18 @ 5:15pm 
Glad to hear it! Best of luck!
1trickPwnyta  [author] Aug 18 @ 5:07pm 
@girlkisser I'm planning a fix for this issue but it's taking a while for me to get to it, sadly. Hopefully soon!
girlkisser Aug 18 @ 4:51pm 
Hello, this mod seems to have odd behavior with gravships. When I send out some colonists in a gravship, they correctly have a bed both on the gravship and at the colony, and once the gravship is back home two beds are assigned to each colonist. Which is odd, but selecting the gravship beds and clicking "unassign all" is significantly easier than manually reassigning each bed, so I let it go.

Problem is, one of my colonists decided to randomly reclaim ownership of one of the gravship beds and go to sleep in it? They already had a colony bed prior. And when this happened, their colony bed was unassigned...

Would it be possible to have ownership on beds on gravship structure be wiped when the gravship lands on a tile that already has a bed assigned to the colonist? That's how I expected it to work, but instead it's... this?
SourceShard Aug 16 @ 2:33am 
@Hotshot53
I am going to risk the bisket and toss this in with One Be to test it out. However I cannot test Bunk Beds as I use Prison Commons.
Baccalon Aug 15 @ 5:18am 
Just what I was looking for, I had to reassign beds like 10 times just today :warmth_ats: You're a lifesaver
1trickPwnyta  [author] Aug 11 @ 3:18pm 
@Vinni Pukh Actually I have a theory as to what happened with the throne. It may have gotten out of sync with the pawn's ownership data due to it having been erased when the mod was broken. Seems like you fixed it, but if anyone else has this issue, a quick fix would be to use God mode to destroy the throne and recreate it. It shouldn't happen again since it's just an issue with the update from the old version to the current one.
JohnnyOffice Aug 11 @ 2:30pm 
You are a Prince among modders! Excellent bug fix turnaround :steamhappy:
Vinni Pukh Aug 11 @ 1:51pm 
The issue was the (vampire) pawn was assigned to the throne, the 'unassign' button did nothing, and he could not be removed from the throne either. Yet it said that he had no throneroom, he was not meditating on the throne, and the game was basically just not respecting that it was his throne at all lol. But I wasn't getting any errors popping up in the log like I was when pawns were trying to use their beds and failing.

Shuffling the load order around with some aggressive saving and reloading I *think* everything is working as it should now though. I built him a new throne and he's successfully claimed it , at least. I'm enjoying this colony a lot so I'm very grateful for all the help preserving it, thank you very much!
1trickPwnyta  [author] Aug 11 @ 10:30am 
@Vinni Pukh Thrones are definitely involved with this mod. What is the bug you're getting with the throne?
Vinni Pukh Aug 11 @ 8:47am 
The fixes have definitely improved things, my pawns can sleep in their beds again! No one has gotten ejected from a death casket yet! All is well!

However I'm still having issues with my throne, and I would normally think that there's nothing involved with this mod but... the unassign all gizmo that shows up on the beds also shows up on my bugged throne? And I'm wondering if that's somehow related? Is it possible that throne assignment somehow got wrapped up in all the caching stuff too?
Hotshot53 Aug 11 @ 7:06am 
Has anyone tried to use this mod in conjunction with Bunk Beds (https://steamcommunity.com/sharedfiles/filedetails/?id=2961752749) and with the One Bed to Sleep With All mods? (https://steamcommunity.com/sharedfiles/filedetails/?id=3244294636) I'm worried it would introduce conflicts but I'd love to have them all running if anyone's ever tried it.
JustofArc Aug 11 @ 6:24am 
Can confirm, 1.2.4 has resolved the issue. Thanks a bunch!
1trickPwnyta  [author] Aug 11 @ 5:16am 
Okay, I think I found the root problem, and I believe the previous update should have fixed it, or at least prevented it from occurring in the future anyway. However, it did not address the broken save file issue.

I've just released a new version (1.2.4 - please verify this is the version you have now) that should fix any broken save files and add extra protection against it happening again. Thanks for your help and patience with this, everyone!

Technical explanation: The new bed caching mechanic added to increase performance had an issue where the cache wasn't cleared upon loading a new save file under certain conditions. This would cause an exception to occur while loading the data for a pawn's ownership node, specifically when deathrest caskets were involved, which would cause the pawn to have a null Pawn_Ownership tracker. This would cause a lot of NREs, producing many, if not all, of the recently reported issues.
1trickPwnyta  [author] Aug 11 @ 3:59am 
@JohnnyOffice Since the issue persists after disabling the mod, it is likely to be a problem with how the mod affects saving. Do you have an affected save file I can look at?
JustofArc Aug 11 @ 3:57am 
Commenting again just to drop a couple logs for the issue. Unfortunately I can't confirm whether the issue is occurring without other mods enabled (I think that'd mess up my save a lot).

https://gist.github.com/HugsLibRecordKeeper/a8e8773c54c0caa8003f624eb10a17c4

The below log is after I tried changing the name of the sanguophage. Included a short clip of what the assign menu looks like after changing a sanguophage name to start with Z.

https://gist.github.com/HugsLibRecordKeeper/ac30d43d676cab46ad0790b5b481c67c

https://streamable.com/red48y
JustofArc Aug 11 @ 2:21am 
Chiming in to confirm the same issue as JohnnyOffice. My three sanguophages can no longer be assigned to beds and whenever they do spend time in bed they don't get any rest. They also can't rest in hospital beds to heal. Currently getting around this by temporarily enabling dev mode's godmode to fill the rest meter. Only had this issue after I sent one of my sanguophages on a gravship flight to a different map, seems to have triggered the issue for all 3 even though the remaining 2 never left the colony tile.

That issue aside, great work on the mod. Works like a charm besides that.
JohnnyOffice Aug 11 @ 1:59am 
Also, the error is persisting after disabling the mod. I have a save prior to the the problem luckily, but I'll have lost a bit of time so I'm holding off on rewinding.
JohnnyOffice Aug 10 @ 11:36pm 
I've started having the same problem as the other recent posts... guess I posted too soon. It appears to have something to do with the sanguophages. The Assign Bed list stops at a sanguophage whose name is "Lute". I changed her name to "Zute" and the list now goes all the way through all the pawns to my second sanguophage whose name is "Shaper." I've changer her name to "Zaper" and now I can see and assign beds to the rest of my 31 colonists except my 2 sangouphages who are at the very end of the list. I cannot use my mousewheel to scroll through the list.

I noticed this all started around when both sanguophages independently assigned themselves to a masterwork royal bed that was in my gravship (captain's quarters and all that).
celsius Aug 10 @ 11:12pm 
im having issues where people switching to others beds when that person is caravaning or killed etc
1trickPwnyta  [author] Aug 10 @ 9:52pm 
Thanks for the info and logs everyone! I just published a small update that fixes a potential file load bug I noticed when testing (I couldn't get it to happen a second time though). This might help with some of the issues everyone is facing, but please let me know if you're still having trouble. And if so, if you could confirm whether you get the same errors with no other mods enabled, that would be very helpful!
Vinni Pukh Aug 10 @ 6:09pm 
Tangram I'm having similar issues as you. Right now in my colony, my pawns cannot sleep in any beds. A couple have gotten exhausted and collapsed, which alerted to me that something was off. When I right click on their assigned bed, there's no option to sleep.

I've also got my sangos getting randomly ejected from their deathrests too.

I wouldn't be surprised if it was something to do with the one bed to sleep with all polycule mod. I really regret choosing the free love precept at this point lmao because trying to keep all these lil idiots from being upset about sleeping alone has been the woooorst. Unfortunately removing it, this mod, or both, has not restored functionality to beds.

Anyways here's my log I hope someone can make some sense of all this https://gist.github.com/HugsLibRecordKeeper/f0b6c1742f353252381373d3cd21b08a
Tangram7 Aug 10 @ 5:55pm 
I'm log is full of red errors and I don't know what to do. Removing the mod didn't help (I am using a previous save now). What can I do?
Tangram7 Aug 10 @ 5:44pm 
edit: I'm still having this issue. Will my log help? https://gist.github.com/HugsLibRecordKeeper/6f3debe063ee43d6ad5c63d76181046d