Skript

Skript

743k Downloads

Make teleport location optional if direction is present

JakeGBLP opened this issue · 2 comments

commented

Suggestion

Within the teleport effect, if a direction is provided, the destination location should be optional.

figuring out how to modify the patten accordingly:
current pattern: [(force)] teleport %entities% (to|%direction%) %location%
possible solutions:

  1. 2 patterns: [(force)] teleport %entities% to %location% and [(force)] teleport %entities% %direction% [%location%], this is probably the best way to handle this
  2. this thing [(force)] teleport %entities% (to %location%|%direction% [%location%])
  3. (best option imo) separate to from the choice between itself and the direction and make it optional (or required, up to you, i'd rather have the option, read further to understand why):
    [(force)] teleport %entities% [to] %direction% [%location%]

making it optional would be better because the direction expression already has some tos laying around, like in these 2 patterns:
[%number% [(block|met(er|re))[s]]] (in[ ]front [of]|forward[s]|behind|backwards|[to the] (right|left) [of])
[%number% [(block|met(er|re))[s]]] horizontal[ly] (in[ ]front [of]|forward[s]|behind|backwards|to the (right|left) [of])
which is good with the current system because it allows something like teleport player to the right of player.
making to optional would technically allow for teleport player to to the right of player which isn't good but it's also very unlikely that someone will try it (unless they read this issue ofc)

some examples:
teleport all players to 1 above # teleports every online player 1 block up
passing multiple entities, a direction, but no location makes it so each entity is teleported to their location offset by the direction

teleport target forwards # teleports the target 1 block forward

Why?

Because then it would default to the location of the entity (the first object passed in this effect)

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this suggestion.
commented

I’m open to this idea, but not with your proposed implementation when it comes to teleport all players to 1 above as this means the destination location will be a list, which opens up a flaw when a user actually passes in different amount of entities and locations (see #5338 as reference).

commented

I’m open to this idea, but not with your proposed implementation when it comes to teleport all players to 1 above as this means the destination location will be a list, which opens up a flaw when a user actually passes in different amount of entities and locations (see #5338 as reference).

as far as i'm aware to teleport multiple entities you need to loop them, all that would need to be done is get the location of the entity, offset it and teleport