Protected beds

Home Forums MeseCraft Discussion Support Protected beds

Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #3021
    keihdra
    Participant
    • Active Member

    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.

    #3023
    Kiopy7
    Participant
    • Well-Known Member

    Yeah 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.

    #3026
    mesecraft
    Keymaster
    • Well-Known Member

    I 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.

    #3028
    komodo
    Participant
    • Active Member

    It 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, @kiopythelma

    #3031
    komodo
    Participant
    • Active Member

    Actually, 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.

    #3035
    mistere
    Participant
    • Member

    No, 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.

    #3038
    keihdra
    Participant
    • Active Member

    Thanks 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.

    #3056
    Kiopy7
    Participant
    • Well-Known Member

    Same, I have absolutely no idea when it comes to coding.

    #3057
    mesecraft
    Keymaster
    • Well-Known Member

    Are 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.

    #3058
    keihdra
    Participant
    • Active Member

    So 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.

    #3060
    keihdra
    Participant
    • Active Member

    We just tested and by adding minekid to the protection block it allowed him to respawn here.

    #3062
    Kiopy7
    Participant
    • Well-Known Member

    Odie would sometimes add new players to the guest house that they could respawn there if they wanted to.

    #3116
    andyiii
    Participant
    • New Member

    The 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:

    1. Dug minekid’s bed (resets to world spawn)
    2. Place protected bed
    3. Sleep in protected bed (doesn’t affect spawn)
    4. 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:

    1. Dug minekid’s bed (resets to world spawn)
    2. Place protected bed
    3. Sleep in other bed (sets spawn)
    4. Sleep in protected bed (doesn’t affect spawn)
    5. Die (spawn at other bed)
    #3120
    keihdra
    Participant
    • Active Member

    I think this is exactly the case as once minekid slept in a different bed the spawn was set there.

    #3121
    mesecraft
    Keymaster
    • Well-Known Member

    @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.

    #3123
    andyiii
    Participant
    • New Member

    I’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.

    #3209
    keihdra
    Participant
    • Active Member

    The 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.

    #3210
    komodo
    Participant
    • Active Member

    So maybe a toggle to a public bed would be a way

    #3215
    andyiii
    Participant
    • New Member

    Possible, 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.

    #3219
    dcmenche
    Participant
    • New Member

    Perhaps 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?

Viewing 20 posts - 1 through 20 (of 20 total)
  • You must be logged in to reply to this topic.