Pryaxis / TShock

☕️⚡️TShock provides Terraria servers with server-side characters, anti-cheat, and community management tools.
GNU General Public License v3.0
2.41k stars 377 forks source link

Beds cannot be removed as spawn points #1849

Open QuiCM opened 4 years ago

QuiCM commented 4 years ago

Copy/pasted straight from https://github.com/Pryaxis/TShock/discussions/1845:

How it should work:

When you use Magic Mirror it teleports you back to spawn. How it does work:

You click on the bed and "Spawn point set!" text appears in the chat.
You use Magic Mirror and you are teleported to the bed.
You click on the bed and "Spawn point removed!" text appears in the chat.
You use Magic Mirror and you are teleported to the bed.

What I expected to happen:

You click on the bed and "Spawn point removed!" appears
Magic Mirror teleports you back to spawn.
iFocsy commented 4 years ago

This problem is still happening in the most recent commit 1eeb77d , The reproduction steps are:

  1. Have Spawn Erased to default.
  2. Put down a bed (Any Type).
  3. Set spawn point on bed. (Set OK)
  4. Use Cellphone /Magic Mirror = You get Teleported to the Bed. (OK)
  5. Click again the bed to remove Spawn (It shows it got Removed)
  6. You still goes to the Bed.

Optional steps:

  1. If you put a New bed and Set spawn, you are still returned to the previous bed.
  2. If you destroy the bed, your next spawn will be the following bed you tried, if not, return to worldspawn.

Note: No plugins, only SSC built-in enable.

sk9c00 commented 4 years ago

I can confirm this issue is still happening in SSC, albeit with a minor functional improvement.

  1. Yes, the right-click remove spawn point function is still broken. Has been even after the patch. (Though I suspect it's because the 'fix' was only to check if the bed still exists or not and not if the right-click to remove spawn action was completed or not. I'm beginning to suspect that this is a client side authoritative issue, and that without a special 'packet' or dedicated way to detect/track if this right-click action was completed legitimately, this 'SSC' loop-hole will continue to exist in eventually three states: either trust the client, disable/limit the functionality, or some sort of 'hack' using the warp system. Possible thing to ask the original game devs to improve/assist on?)

  2. The 'improvement' is basically as mentioned above by @iFocsy, if you remove the bed regardless of whether or not you've right-clicked on the bed, you will get teleported back to spawn. However, if the bed is placed back in it's location, you will get teleported back. This occurs regardless of logging out, restarting the server, etc. Short of manually editing the spawnX, spawnY of the player back to -1 during server downtime, the spawn location essentially persists.

hakusaro commented 4 years ago

https://github.com/Pryaxis/TShock/discussions/1845 also has people discussing this issue (throwing here to keep note)

hakusaro commented 4 years ago

@sk9c00 can you test on this build? https://github.com/Pryaxis/TShock/actions/runs/117511286

sk9c00 commented 4 years ago

Just tested the build 814801d. Bed function should be fixed?

Database Quirk Any action to unset the bed whether through right click unset, or to destroy the bed will not update the external SQL database (unsure about SQLite) to -1, -1, even after character update interval or server restart. The only time SpawnX, SpawnY is updated is when character update interval is triggered with a new spawn set. However, this new spawn location doesn't persist after any re-logins or server restarts.

Another thing of note is that according to the wiki:

If the bed is removed, or if the criteria for the bed to function properly are no longer met, the player's spawn point will revert to the world default. If the bed is removed and replaced in the same location it will still act as the spawn point, as long as it still meets the criteria mentioned.

SettingDust commented 4 years ago

Its seems that the status of bed set/unset cannot be saved correctly.

  1. Unset the bed. User the mirror and return to the world spawn
  2. /savessc or not
  3. exit
  4. login
  5. I spawn at the bed
  6. Right click the bed. And unset again

BTW, tried with tshock.ignore.ssc(*)and without.

QuiCM commented 4 years ago

This still exists. Rewritten SSC may help in diagnosing/fixing as the spawn code won't be lumped in all over the place