The-Aether icon indicating copy to clipboard operation
The-Aether copied to clipboard

Slider Fixes and Improvements

Open Zepalesque opened this issue 1 year ago • 1 comments

  • [ ] Fixes #787

Changes:

  • The Slider stays on the dungeon floor if the player is not high enough for it to need to move (fixes issues 2 and 5 from the bug report)
  • The Slider will align with four blocks on the floor when spawned with a spawn egg, because previously it spawned on the center of the block, which caused the actual dungeon to be offset from where the blocks were. This fix will also make it easier to respawn the slider in the generated bronze dungeons, once they are added (fixes issue 4 from the bug report)
  • The Slider AI code is easier to read/understand (separated into multiple methods with explanations of what they do), and is simpler in some spots
  • The non-pickaxe tool message timer cooldown works correctly (before the timer only decreased when hit, and the message only played again after being hit 15 times)
  • The Slider no longer tries to break the dungeon floor, which caused it to get stuck in the air (fixes issue 1 from the bug report)
  • The Slider no longer tries to push creative players upwards, which resulted in bubble-column-like movement
  • There are a few things to make it easier for addons to make new Slider AI without using lots of reflection
  • Issue 3 from the bug report is not fixed, because I couldn't figure out how to make it work correctly, and I realized that it probably doesn't need to be fixed, and it's not really any more of an exploit than aoiding its attacks the conventional way of circing around it slower

Fix demonstration (The resource changes are not part of the pull request, I was using a resource pack while recording these):

  • Jumping around the Slider no longer makes it move upwards: https://user-images.githubusercontent.com/60141811/187801018-355bae72-d0a7-4a73-8890-e9a6bc2d1a63.mp4

  • The slider moves to the floor instead of the player's foot level if they are low enough for the slider to reach https://user-images.githubusercontent.com/60141811/187801298-d7a82b9d-6e11-4286-a1f7-3553f7175e73.mp4

  • The slider tries to stay on the floor: https://user-images.githubusercontent.com/60141811/187801426-47940dd8-f59a-4f53-8dda-130465328a6a.mp4

  • Slider spawn position alignment (Pay attention to where the block outline is): https://user-images.githubusercontent.com/60141811/187788900-21d736af-78ab-4199-a302-a231a9b117b4.mp4

  • Message cooldown (the message isn't changed, that's from the resource pack) https://user-images.githubusercontent.com/60141811/187794025-32d75f77-2d6a-4e23-8983-fa443dd86516.mp4


I agree to the Contributor License Agreement (CLA)

Zepalesque avatar Sep 01 '22 00:09 Zepalesque

In the latest commit, I somehow accidentially deleted the slider without realizing until a while after I made the commit, and I won’t be able to fix it for a few days, but the previous commit, e66973e, has the problems with the platform and one-block upward movement fixed. There are still a few more things that I want to fix, including redoing the modified slider spawn egg behavior I had added and then removed in the latest commit, but the movement is pretty much done in the latest commit, but if there are any more issues I will be able to fix them in a couple of days.

Here is the fix for the center platform issue:

https://user-images.githubusercontent.com/60141811/187997778-5acc7001-8f0e-4b87-8936-8cd6bcabd372.mp4

With this fix, I think it might also be a good idea to make the slider slightly faster, since it sometimes has to move up to go over the pedestal, which can make it take longer to reach the player, but that probably would be fixed when the boss balancing happens, so I didn’t change it since it will be rebalanced later anyway.

Zepalesque avatar Sep 01 '22 19:09 Zepalesque

I reverted the commit which deleted the slider file, fixed the rest of the things I wanted to fix, and made those fields private, so as long as there aren't any more issues or bugs, this is done now.

Zepalesque avatar Sep 05 '22 00:09 Zepalesque

For the spawn egg, the custom item is so that the slider will spawn on the intersection of blocks closest to where the player clicked, and the mob doesn't know where the player clicked to spawn it, so it can't be set in the entity class. Like this: https://user-images.githubusercontent.com/60141811/188497658-904d4b78-1c28-4c21-94e0-098e15dffe53.mp4 so that these (when clicked on the corner closest to the middle of the platform) will all spawn on the center of the platform, similar to how doors are placed with the hinge on the side of the block the player clicked on: https://user-images.githubusercontent.com/60141811/188498283-89efac5e-43ff-4ce1-88fa-b0e67df5c68f.mp4

With the hardcoded spawn platform issue, would adding an NBT tag which can have any number of bounding boxes which the slider tries to go over work as a fix? (I haven't done this yet, since I don't know if that's what you mean or not, but if it is then I will do that soon)

Zepalesque avatar Sep 05 '22 18:09 Zepalesque

I see, the custom spawn-egg makes sense then. For the spawn platform thing I'd personally just not use any checks for bounding boxes at all and instead have the slider be able to scale any obstacles if it can if it just detects it is hitting a block or some other checks. The only potential solution I can think of though to making that work while also not having the Slider move up in any instance where the player is above it (like jumping) is to have it be timer based, like if the player's minY is above the middle of the Slider's hitbox for a certain amount of time, then it will choose to move upwards, and if its below it could automatically default to moving downwards. However I guess there is still the issue in that of the Slider being able to choose whether to move horizontally or vertically so it doesn't get stuck going down into the floor if the player is at a lower elevation. Could be collision based to run the timer or something.

bconlon1 avatar Sep 05 '22 18:09 bconlon1

There are a couple of problems with doing it that way that I'm not sure how to fix (this is starting to go past my current modding/coding knowledge, so trying to figure out how to code some parts of this is getting pretty difficult):

  • If the player goes around the center platform (or any obstacle) instead of over it, and stays on the ground the whole time, the slider wouldn't know that it should go above that obstacle, since the player never went above halfway to the top of it's hitbox.
  • I'm not sure how to make the slider know when to stop going up, for obstacles taller than one block.
  • If a custom dungeon has pillars then the slider wouldn't know how to go around them.
  • If it goes up based on collision, then it would be slower and take more movements to go over something, because it would do something like this: _|¯¯| (4 movements) instead of this: |¯¯¯| (3 movements)

Zepalesque avatar Sep 06 '22 22:09 Zepalesque

Maybe it'd be better then to get rid of the platform functionality for this PR, we can look into improving any other parts of the Slider AI that have been discussed but not fixed in this PR at a later date.

bconlon1 avatar Sep 07 '22 05:09 bconlon1

Ok, I removed it for now. Also, I found something that might work with the slider for navigation (but I'm not 100% sure): PathNavigation and PathFinder, since the slider already extends PathfinderMob (I haven't looked a lot at them, but I think they could possibly be useful)

Zepalesque avatar Sep 07 '22 23:09 Zepalesque

We attempted to look into path navigation previously but it was hard to get working with the Slider's unique movement so we went with using the old method of AI they used.

bconlon1 avatar Sep 08 '22 02:09 bconlon1

I changed everything else I still wanted to, so as long as there aren't any bugs I missed (which I didn't find any of while playtesting, so there hopefully aren't any more of), this is complete now.

Zepalesque avatar Sep 09 '22 00:09 Zepalesque

I'll try getting around to re-reviewing this during the weekend.

bconlon1 avatar Sep 10 '22 04:09 bconlon1