RimWorld

RimWorld

Sensible Bed Ownership
115 Comments
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
Tangram7 Aug 10 @ 5:31pm 
Hi. I'm having an issue where, first, the "Assign bed" button doesn't work (it literally doesn't let you click it). After that, when trying to hange ownership of a free bed, instead of my pawns list, I see only one, without their name, and the menu doesn´t work.

I don't know what caused this, but I fixed it by removing then adding the mod again.

I write this just in case someone runs into the same issue.

Great mod!!
LongJohnNoOne Aug 10 @ 4:51pm 
@Alphasaur i second your findings, mine is even more annoying, and i can't do anything with my pawn, he is just permanently incapacitated at the moment. I can probably fix with dev mode ofc :)

I can't even carry the pawn to deathrest casket, he gets dropped "on top" of the casket, not inside.
1trickPwnyta  [author] Aug 10 @ 12:48pm 
@Alphasaur Thanks for letting me know! Does anything appear in the log during either of these issues? And do you have other mods enabled as well?
Alphasaur Aug 10 @ 12:43pm 
I'll also add that before observing this UI issue, I observed an odd bug when this pawn was attempting to deathrest. He would periodically get ejected from his deathrest casket without any apparent cause, prompting me to rescue him and return him to the deathrest casket. This happened four or five times before deathrest was completed.
Alphasaur Aug 10 @ 12:41pm 
I have the same problem as Trinfinity, but I haven't been able to reproduce it in a test colony. I've confirmed that I have version 1.2.2 in my case. I'll describe what happens in my affected save.

Despite the mod being loaded, the bed assignment dialog is showing up without the pawn search tool. The scroll wheel is unresponsive, and there are several empty rows at the bottom of the list. Manually dragging the scrollbar works. All the visible assign/reassign buttons work. The button to close the dialog works. The very last pawn whose icon appears on the list is a sanguophage. His icon appears, but there is no associated assign/reassign button. The sanguophage has a bound deathrest casket. When I click on another unbound deathrest casket, the pawn search field appears normally. There are no other sanguophage pawns in the colony. When the problematic sanguophage leaves the map, the dialog appears normally again.
horologium Aug 9 @ 6:32pm 
I feel like primary bed/secondary bed(s) ownership might be worthwhile in separate mod. Just seems like a different function even if its related to beds. plus, i really like the performance added with the caching update, that would likely ruin this mod's performance again :steamsad:
JohnnyOffice Aug 9 @ 6:24pm 
Also, I'm not seeing Trinfinity's issue either with only 25 colonists showing up in in the Set Owner menu. I have 30 pawns from Ben to Yudoku and all of them are in the list. Also, my mouse wheel scrolls through the list.
JohnnyOffice Aug 9 @ 6:20pm 
@1trickPwnyta Thanks for the quick response and, again, for the great mod! Prior to Odyssey it was essential. A few tweaks and it will be essential for Odyssey, too. If a pawn has more than one bed, would it be possible to make one primary? My gravship barracks isn't nearly as nice mood-wise as the crew's bedrooms in port.
1trickPwnyta  [author] Aug 9 @ 5:53pm 
@Ascythian This mod doesn't let you assign beds for prisoners, so you would still need that one. I don't know how compatible it is though.
Ascythian Aug 9 @ 4:01pm 
Question - Set Owner For Prisoner Beds - https://steamcommunity.com/sharedfiles/filedetails/?id=2053931388&searchtext=prisoner+bed , is no longer needed when I have this installed. Correct?
1trickPwnyta  [author] Aug 9 @ 2:37am 
@Trinfinity Thanks for letting me know! I'm not seeing this issue on my end, but just in case, do you have the latest update for this mod? The mod version should show 1.2.2 when you look at it in the mod list in game.
Trinfinity Aug 8 @ 10:59pm 
Update: I unloaded the mod to see if the bug was still in effect, and it is. I didn't have this issue before I installed the mod, so I figure it's probably related. Just letting you know that it might be connected.
Trinfinity Aug 8 @ 10:55pm 
There is a bug where the assign bed menu only shows up to 25 possible colonists in alphabetical order before cutting off. Also, the scroll wheel does not work in the assign bed menu.

Specifically, I am trying to have a child room with her mother for a bit to save space. The mods I am running currently are this one, Harmony (of course), and Xenotype Spawn Control. I assigned the bed to the child first, but the mother's name starts with R, which is far down the alphabetical list. It shows every colonist with the button to assign, reassign, or ideoligion forbids next to each one, but on the 26th pawn, no button or indicator is shown and the list cuts off there, leaving me unable to assign the mother a bed anywhere. I tried this with single and double beds, both previously assigned and unassigned. I hope this helps, and thanks in advance.
1trickPwnyta  [author] Aug 8 @ 7:53pm 
@JohnnyOffice Since there are gravships now, I think it would make sense to allow more than one bed per map. Perhaps just one gravship bed and one land bed. I'll make an update that does that in the future. It's high on my list, but it's a big list...
1trickPwnyta  [author] Aug 8 @ 7:51pm 
The performance fixes are now published. Sorry for the delay!
1trickPwnyta  [author] Aug 7 @ 7:28pm 
@JohnnyOffice Thanks for letting me know! I'll look into that.
JohnnyOffice Aug 7 @ 7:12pm 
Seems to be an issue with gravships returning to a base with previously assigned beds when the gravship also has beds. Even when I unassign the beds, using the vanilla method or the modded method, the pawns will reclaim the gravship beds repeatedly. Thanks for the great mod!
horologium Aug 7 @ 4:29pm 
Yeah cache is spectacular for speed. Just ended a run so im definitely glad to have the update just in time to start a new one :)

thanks a ton for maintaining a bed ownership mod btw, its a feature i really get annoyed when i cant have something similar in a run
1trickPwnyta  [author] Aug 7 @ 3:18pm 
@Side1iner Awesome, thank you!
Side1iner Aug 7 @ 3:08pm 
@1trickPwnyta: Just wanted to pop in and say I've been running with your updated assembly for a while, and it's definitely a noticeable improvement! :steamthumbsup:
1trickPwnyta  [author] Aug 6 @ 7:24pm 
Update on the performance issue: I believe I have fixed it on my local copy, but I'm going to run with it for another day or two to make sure I didn't cause any new issues before publishing the update. If you want to test it yourself, it's currently available on GitHub: https://github.com/1trickPwnyta/SensibleBedOwnership/releases/tag/v1.2.2