Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WorldGuard Region Entering/Leaving on TrainCart #442

Open
halofreak894 opened this issue Mar 29, 2022 · 6 comments
Open

WorldGuard Region Entering/Leaving on TrainCart #442

halofreak894 opened this issue Mar 29, 2022 · 6 comments
Labels
A. bug (traincarts) Issue is caused by a bug in TrainCarts C. help wanted More help from collaborators is needed to resolve/identify this issue C. issue confirmed Issue has been confirmed by collaborators

Comments

@halofreak894
Copy link

halofreak894 commented Mar 29, 2022

Info

Please provide the following information:

  • BkCommonLib Version (/train version): v1.18.2-v1 (build: 1087)
  • TrainCarts Version (/train version): v1.18.2-v2-SNAPSHOT (build: 1270)
  • Server Type and Version (/version): git-Paper-792 (1.16.5)

Bug

Description

After entering a TrainCart, and then the cart moves into the region from a speed sign, station, launch, or track animation, WorldGuard doesn't seem to detect you've entered that region. Using /rg info shows that the player has entered the region but none of the region flags work. For example, the greeting I've set to happen after the player enters is not appearing until they get out of the cart. Not sure if this has anything to do with TrainCarts or if that's more of a WG issue however.

Expected behaviour

What do you expect TrainCarts to do?
I expect TrainCarts to put the player into the region in a way that will allow WorldGuard to send the necessary things to the client.

Actual behaviour

What is TrainCarts doing instead?
Putting them into the region, but with none of the flags within the region being sent or working.

Steps to reproduce

Please list the steps to take, in order to reproduce the bug.

  1. Create a TrainCart track, or track animation that will lead into a separate WorldGuard region.
  2. /rg flag [region] greeting [greeting]
  3. Use a station or speedlimit sign to have the train go into the region

Additional Information

Any additional information we should know of?
N/A

@RyanHecht
Copy link
Contributor

Hmm I'm unable to reproduce this (with the greeting flag) on Paper 1.12.2/TC 1.18.1/WorldGuard 6.2.1

@bbayu123
Copy link
Collaborator

bbayu123 commented Jun 8, 2023

Can confirm that this is an issue, but only when the train is not moving, and a track animation is being played that causes the train to enter/leave a WG region.

@bbayu123 bbayu123 added A. bug (traincarts) Issue is caused by a bug in TrainCarts C. help wanted More help from collaborators is needed to resolve/identify this issue C. issue confirmed Issue has been confirmed by collaborators labels Jun 8, 2023
@bbayu123
Copy link
Collaborator

bbayu123 commented Jun 8, 2023

Details to reproduce are as follows:

WorldGuard Region
image

Coaster track
https://paste.traincarts.net/isenejeciv

Steps:

  1. Create the WorldGuard region and set the greeting and farewell flags
  2. Import the coaster track
  3. Place a cart on the only animated node on the track, enter the cart. (If the track is animated to move2, the greeting message should display)
  4. Animate between move and move2. The greeting and farewell messages do not get displayed.

@bergerkiller
Copy link
Member

bergerkiller commented Aug 26, 2023

The issue is that the server ticks the entity as well, and outside of the normal overrided tick() it calls entity.setOldPosAndRot(), which causes it to lose the 'last position' information. This in turn causes a vehicle move event to be fired with the wrong last position information, or not at all. TCC triggered this with animations because it moves the entity without a teleport event that WorldGuard would otherwise see.

I'm adding a change so that traincarts tracks the last position using its own field to avoid outside interference.

I should add: this was not easy to figure out

@bergerkiller
Copy link
Member

This fixes the situation outlined by bbayu for me. f86a2cd

https://ci.mg-dev.eu/job/TrainCarts/1431/

@bergerkiller
Copy link
Member

Another minor patch. c0691ca

https://ci.mg-dev.eu/job/TrainCarts/1433/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A. bug (traincarts) Issue is caused by a bug in TrainCarts C. help wanted More help from collaborators is needed to resolve/identify this issue C. issue confirmed Issue has been confirmed by collaborators
Projects
None yet
Development

No branches or pull requests

4 participants