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

Vectors + Push #6194

Closed
1 task done
TheAbsolutionism opened this issue Nov 17, 2023 · 2 comments
Closed
1 task done

Vectors + Push #6194

TheAbsolutionism opened this issue Nov 17, 2023 · 2 comments
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. good first issue An issue that would be good for a first-time contributor to make a PR for priority: lowest "Nice to have" updates that are not required (tiny low impact bug fixes or QoL enhancements).

Comments

@TheAbsolutionism
Copy link

Skript/Server Version

[Fri 22:25:19 INFO ] [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
  [Fri 22:25:19 INFO ] [Skript] Skript's documentation can be found here: https://docs.skriptlang.org/
  [Fri 22:25:19 INFO ] [Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials
  [Fri 22:25:19 INFO ] [Skript] Server Version: git-Paper-"f042be6" (MC: 1.20.1)
  [Fri 22:25:19 INFO ] [Skript] Skript Version: 2.7.2 (skriptlang-github)
  [Fri 22:25:19 INFO ] [Skript] Installed Skript Addons: 
  [Fri 22:25:19 INFO ] [Skript]  - skript-placeholders v1.5.2 (https://github.com/APickledWalrus/skript-placeholders)
  [Fri 22:25:19 INFO ] [Skript]  - Skellett v2.0.9 (https://forums.skunity.com/resources/skellett.24/)
  [Fri 22:25:19 INFO ] [Skript]  - SkUniversal v2.13
  [Fri 22:25:19 INFO ] [Skript]  - skript-reflect v2.3.1-for-Skript-2.7 (https://github.com/TPGamesNL/skript-reflect)
  [Fri 22:25:19 INFO ] [Skript]  - SkQuery v4.1.10
  [Fri 22:25:19 INFO ] [Skript]  - SkBee v2.18.3 (https://github.com/ShaneBeee/SkBee)
  [Fri 22:25:19 INFO ] [Skript]  - SkJson v2.9 (https://github.com/SkJsonTeam/SkJson)
  [Fri 22:25:19 INFO ] [Skript]  - SkJade v1.4.3 (https://www.github.com/Ankoki-Dev/SkJade)
  [Fri 22:25:19 INFO ] [Skript] Installed dependencies: 
  [Fri 22:25:19 INFO ] [Skript]  - WorldGuard v7.0.9+5934e49

Bug Description

I was making a functioning item, when right clicked on it would loop all entities in 20 radius around player and push them away.
I got the base skript from a friend where it works for them, but for me, it would error and not work properly.
Ive tested with 1 entity and multiple
Multiple entities varies, from all being pushed, some being pushed, 1 being pushed and none being pushed
1 entity only varied in being pushed or not being pushed.

Expected Behavior

It was supposed to push all entities (Mobs + Players) away from the player using it

Steps to Reproduce

loop all entities in radius 20 around player: push loop-enity (direction from player to location of loop-entity) at speed 2
^ Severe Error

loop all entities in radius 20 around player: set {_v} to normalized vector between player to loop-entity set loop-entity's velocity to {_v}
^ Severe Error

loop all entities in radius 20 around player: set {_v} to vector between player to loop-entity set loop-entity's velocity to {_v}
^ Now this one works, although not what my intention is for, since it pushes the entity the distance away you are from them

loop all entities in radius 20 around player: set {_v} to vector between player to loop-entity set vector length of {_v} to 2 set loop-entity's velocity to {_v}
^ And doing this, although similar to the other one, when changing the vector length = Severe Error

Errors or Screenshots

https://paste.gg/p/anonymous/8951e87a444e4c6d96c62c9785dff869

Other

At first I thought it was an Addon, because why not. But after disabling/removing from plugins folder 1 by 1, the error still continued. After being fed up, I removed all addons, and the error still continued. Now I'm here....

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
@sovdeeth
Copy link
Member

sovdeeth commented Nov 17, 2023

You are trying to push an entity towards itself, resulting in a vector with a length of 0, which causes infinite components due to division by 0.
This will obviously never be able to work, but we can add a check to ExprVelocity's changer to prevent non-finite vectors.

Another solution could be to return a zero vector from ExprVectorNormalize instead of the non-finite result or .normalize(), though that may be considered a breaking change.

@sovdeeth sovdeeth added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: lowest "Nice to have" updates that are not required (tiny low impact bug fixes or QoL enhancements). good first issue An issue that would be good for a first-time contributor to make a PR for labels Nov 17, 2023
@TheAbsolutionism
Copy link
Author

@sovdeeth So after showing someone in the SkUnity what you had said, they had came to the conclusion, the reason why it was erroring out was because in my loop all entities, the only thing that would be "0" is the player that activated it. I had assumed it wouldn't include the player it was looping around. So yeah....
All it takes is someone like me to find the most uncommon bug because my lack of knowledge, lol

Anywho Thank You!

@sovdeeth sovdeeth added the PR available Issues which have a yet-to-be merged PR resolving it label May 7, 2024
@APickledWalrus APickledWalrus added completed The issue has been fully resolved and the change will be in the next Skript update. and removed PR available Issues which have a yet-to-be merged PR resolving it labels Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. good first issue An issue that would be good for a first-time contributor to make a PR for priority: lowest "Nice to have" updates that are not required (tiny low impact bug fixes or QoL enhancements).
Projects
None yet
Development

No branches or pull requests

3 participants