Home › Forums › MeseCraft Discussion › Support › Protected beds
- This topic has 19 replies, 7 voices, and was last updated 1 year, 5 months ago by dcmenche.
-
AuthorPosts
-
March 18, 2023 at 2:07 pm #3021
Noticed what I believe is a bug today. Sleeping in a bed that is protected by someone other than you sets your respawn to spawn. Not sure if it was always this way, but I made the long hike from spawn to my place twice today. Once by accident, the second time to test. Sleeping in a bed that is unprotected or protected by self is fine.
March 18, 2023 at 3:51 pm #3023Yeah this has always happened, happens in non-mesecraft games as well. We had someone working on it, but it appears that they haven’t done much to it so far.
March 19, 2023 at 4:39 pm #3026I think maybe this is the function responsible?
https://github.com/MeseCraft/MeseCraft/blob/unstable/mods/mesecraft_beds/api.lua#L16-L25
Looks like it can remove spawn points, which then probably the spawn point reverts back to the server default spawn.
I don’t have time this weekend to fix it, sorry.
I have no idea what reverse is supposed to do. It looks like it might be a check so that the bed properly removes itself to fix a bug that happens sometimes. If anyone who can code can take a look when convienant, that’d be awesome. If there isnt an issue for this filed on github, we’ll need to file it.
Busy with my baby this weekend and have lots of adulting going on this week.
March 19, 2023 at 4:47 pm #3028It sets the variable reverse to TRUE
then does a check if the variable is true and if it is, it sets it to reverse and removes the spawn point being set on the bed?
@mistere, did you make this code? maybe if @andyiii is free he can help too. Otherwise, I will dig into it more when I have availability. Thank you for reporting it @keihdra and for the help/context about the bug, @kiopythelmaMarch 19, 2023 at 5:18 pm #3031Actually, I think it’s a bit more likely its something on this page? https://github.com/MeseCraft/MeseCraft/blob/unstable/mods/mesecraft_beds/functions.lua
As the other one just runs on destruction of the bed.
March 19, 2023 at 6:34 pm #3035No, I think this is just standard beds code.
spawns.lua will be relevant.Theoretically, this shouldn’t happen, beds.set_spawns() seems to avoid changing the spawn if the bed is protected. A brief review of the code does not show any obvious errors that would reset the spawn, so it must be more subtle.
March 19, 2023 at 11:20 pm #3038Thanks all for checking this out. I’m lost when it comes to reading the code, so to me it’s like you guys have superpowers.
March 20, 2023 at 11:43 am #3056Same, I have absolutely no idea when it comes to coding.
March 20, 2023 at 11:52 am #3057Are you sure these are the circumstances that reset the spawn? Maybe it’s if you try to sleep in the bed without it being nighttime? or did you unset your other bed? Anything like that? I’m not sure how it happens and wasnt aware of this until today but it sounds like its frustrating.
March 20, 2023 at 12:34 pm #3058So best as I can remember this is what happened. minekid and I had been using the same bed, no problem. We have recently got our house up to the point where we made bedrooms so we moved the bed. I also in this time added protection blocks. minekid was not added to the protection block where the new bed is (oversight on my part). Anyway, I made sure that we both slept in the new bed to set our spawn point since the old bed had been moved. Then because we like to do stupid stuff, we were jumping off the roof of our house aiming for a slime block, about 20 something blocks high. We both actually died doing this, it happens. I respawned in the new bed, minekid respawned at spawn some 3000 blocks away. After trekking all the way home, now I was signed in on minekid’s account btw, I slept in the bed again, then recreated the accident. Died and respawned again back at spawn. When I finally got home, I placed a new bed where there were no protection blocks, slept in it, jumped to my death once again, and respawned in the newest bed.
I guess I could still test to see if sleeping in the protected bed but adding minekid to the protection would allow me to spawn at that bed.
I don’t remember this being the case before as I had used the guest house in Old Ael Post that was protected by Odie and I seem to remember having spawned there. Maybe not. Anyway, that was what happened this time. Hope that helps recreate the situation.
March 20, 2023 at 1:23 pm #3060We just tested and by adding minekid to the protection block it allowed him to respawn here.
March 20, 2023 at 3:48 pm #3062Odie would sometimes add new players to the guest house that they could respawn there if they wanted to.
March 24, 2023 at 6:15 am #3116The reverse flag seems to be used when destructing a bed so that it isn’t removed twice (since there are two bed nodes “top” and “bottom”). The actual spawn point is set/reset in
beds.set_spawns()
which is called just after laying down, but it affects all people who are in bed. I don’t see where it would delete a spawn point, except when destroying the bed. I think this may be what happened:- Dug minekid’s bed (resets to world spawn)
- Place protected bed
- Sleep in protected bed (doesn’t affect spawn)
- Die (spawn at world spawn)
If minekid had slept in a diggable (not protected or with minekid on the protection block) bed prior to sleeping in the protected bed, I think things would have been different:
- Dug minekid’s bed (resets to world spawn)
- Place protected bed
- Sleep in other bed (sets spawn)
- Sleep in protected bed (doesn’t affect spawn)
- Die (spawn at other bed)
March 24, 2023 at 9:20 am #3120I think this is exactly the case as once minekid slept in a different bed the spawn was set there.
March 24, 2023 at 11:43 am #3121@andyiii, awesome response. Thanks.
Should protected beds set non-protected players spawn to the location? Any thoughts on this? I can see merits to both ways.
March 24, 2023 at 12:58 pm #3123I’m kind of used to it the way it works now. If I have a protected area, I might let someone visit, but I don’t think I’d want them to “live” there by consistently respawning there. That said, I like being able to offer the ability to sleep for guests. The way it works now is kind of a middle-of-the-road solution to this dilemma.
March 25, 2023 at 10:40 am #3209The way it works now is good. I agree that I wouldn’t want people setting their spawn to my base. The exception would be in a place that was set up as a public hotel or guest house. I had a couple different places set up last map that were guest houses as did other players. In a place like that you want to protect from griefing, but wouldn’t be bad to have players spawning there. I guess it’s not the worst thing either way, I was just surprised when this happened to minekid the other day. Now that we know how it works, it’s not an issue.
March 25, 2023 at 11:35 am #3210So maybe a toggle to a public bed would be a way
March 27, 2023 at 4:27 am #3215Possible, but perhaps not the best idea. I had a similar idea about the drink silos recently. I imagined that some might want to make a public juice station, where everyone could come and get cups of juice, but not buckets. Perhaps even rate-limiting to x per day or such. I eventually decided against it and protected the purge button only. The purge button allows anyone without any special item, to remove all the work you’ve spent making the juice. All other options require either glass or steel, which isn’t something you can get until you actually do some work. This means brand new players cannot drain the work you’ve spent. For a bed, this is even less of an issue, since the primary function of the bed is to make it day. The current public use of a protected bed still allows that and can aid the owner just as much as the guest. Setting the spawn point is a secondary effect and is part of the benefit of making your own bed. I think a public-set-spawn checkbox might discourage working to create your own bed.
Perhaps a notice on protected beds indicating that the spawn point is not set would be helpful. Also, currently the spawn point can only be set at night. Is this desired, or should we allow setting the spawn point even during the day without laying down? I know other bed mods allow this action.
March 27, 2023 at 3:18 pm #3219Perhaps beds could permit a player to get in them at any time of day, with the “Skip night” button only showing up at night, and a new “Set spawnpoint” button only showing up if the owner allows it.
Chests have standard, locked, and protected variants that permit everyone, only the placer, and only players with protection access to use them; maybe such variants could be added for beds?
-
AuthorPosts
- You must be logged in to reply to this topic.