Kruptein / PlanarAlly

A companion tool for when you travel into the planes.
https://www.planarally.io/
MIT License
395 stars 73 forks source link

[BUG] Teleport Zones don't work in build mode #1216

Closed rexy712 closed 1 year ago

rexy712 commented 1 year ago

Describe the bug Teleport zones attempt to function in build mode but don't actually complete the teleport. A popup appears (if not in immediate mode) asking if you want to use the teleport. Hitting 'Use' moves the player's view to the target, but the token remains where it started.
Then the following error comes up in the server log:

2023-02-21 12:28:55,148 - CRITICAL - Uncaught async exception <Model: Shape> instance matching query does not exist:
SQL: SELECT "t1"."uuid", "t1"."layer_id", "t1"."type_", "t1"."x", "t1"."y", "t1"."name", "t1"."name_visible", "t1"."fill_colour", "t1"."stroke_colour", "t1"."vision_obstruction", "t1"."movement_obstruction", "t1"."is_token", "t1"."annotation", "t1"."draw_operator", "t1"."index", "t1"."options", "t1"."badge", "t1"."show_badge", "t1"."default_edit_access", "t1"."default_vision_access", "t1"."is_invisible", "t1"."is_defeated", "t1"."default_movement_access", "t1"."is_locked", "t1"."angle", "t1"."stroke_width", "t1"."asset_id", "t1"."group_id", "t1"."annotation_visible", "t1"."ignore_zoom_size", "t1"."is_door", "t1"."is_teleport_zone" FROM "shape" AS "t1" WHERE ("t1"."uuid" = ?) LIMIT ? OFFSET ?
Params: ['11f87a79-1e46-4fc3-ba2b-662606fe2d6c', 1, 0] (logs.py:38)
Task exception was never retrieved
future: <Task finished name='Task-937201' coro=<AsyncServer._handle_event_internal() done, defined at .../server/venv/lib/python3.9/site-packages/socketio/asyncio_server.py:506> exception=ShapeDoesNotExist('<Model: Shape> instance matching query does not exist:\nSQL: SELECT "t1"."uuid", "t1"."layer_id", "t1"."type_", "t1"."x", "t1"."y", "t1"."name", "t1"."name_visible", "t1"."fill_colour", "t1"."stroke_colour", "t1"."vision_obstruction", "t1"."movement_obstruction", "t1"."is_token", "t1"."annotation", "t1"."draw_operator", "t1"."index", "t1"."options", "t1"."badge", "t1"."show_badge", "t1"."default_edit_access", "t1"."default_vision_access", "t1"."is_invisible", "t1"."is_defeated", "t1"."default_movement_access", "t1"."is_locked", "t1"."angle", "t1"."stroke_width", "t1"."asset_id", "t1"."group_id", "t1"."annotation_visible", "t1"."ignore_zoom_size", "t1"."is_door", "t1"."is_teleport_zone" FROM "shape" AS "t1" WHERE ("t1"."uuid" = ?) LIMIT ? OFFSET ?\nParams: [\'11f87a79-1e46-4fc3-ba2b-662606fe2d6c\', 1, 0]')>
Traceback (most recent call last):
  File ".../server/venv/lib/python3.9/site-packages/peewee.py", line 6970, in get
    return clone.execute(database)[0]
  File ".../server/venv/lib/python3.9/site-packages/peewee.py", line 4339, in __getitem__
    return self.row_cache[item]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".../server/venv/lib/python3.9/site-packages/socketio/asyncio_server.py", line 508, in _handle_event_internal
    r = await server._trigger_event(data[0], namespace, sid, *data[1:])
  File ".../server/venv/lib/python3.9/site-packages/socketio/asyncio_server.py", line 542, in _trigger_event
    ret = await handler(*args)
  File ".../server/src/auth.py", line 48, in wrapped
    return await fn(*args, **kwargs)
  File ".../server/src/api/socket/shape/__init__.py", line 372, in move_shapes
    shapes = [Shape.get_by_id(sh) for sh in data["shapes"]]
  File ".../server/src/api/socket/shape/__init__.py", line 372, in <listcomp>
    shapes = [Shape.get_by_id(sh) for sh in data["shapes"]]
  File ".../server/venv/lib/python3.9/site-packages/peewee.py", line 6533, in get_by_id
    return cls.get(cls._meta.primary_key == pk)
  File ".../server/venv/lib/python3.9/site-packages/peewee.py", line 6522, in get
    return sq.get()
  File ".../server/venv/lib/python3.9/site-packages/peewee.py", line 6973, in get
    raise self.model.DoesNotExist('%s instance matching query does '
src.models.shape.ShapeDoesNotExist: <Model: Shape> instance matching query does not exist:
SQL: SELECT "t1"."uuid", "t1"."layer_id", "t1"."type_", "t1"."x", "t1"."y", "t1"."name", "t1"."name_visible", "t1"."fill_colour", "t1"."stroke_colour", "t1"."vision_obstruction", "t1"."movement_obstruction", "t1"."is_token", "t1"."annotation", "t1"."draw_operator", "t1"."index", "t1"."options", "t1"."badge", "t1"."show_badge", "t1"."default_edit_access", "t1"."default_vision_access", "t1"."is_invisible", "t1"."is_defeated", "t1"."default_movement_access", "t1"."is_locked", "t1"."angle", "t1"."stroke_width", "t1"."asset_id", "t1"."group_id", "t1"."annotation_visible", "t1"."ignore_zoom_size", "t1"."is_door", "t1"."is_teleport_zone" FROM "shape" AS "t1" WHERE ("t1"."uuid" = ?) LIMIT ? OFFSET ?
Params: ['11f87a79-1e46-4fc3-ba2b-662606fe2d6c', 1, 0]

To Reproduce Steps to reproduce the behavior:

  1. Create a shape with teleport zone enabled and a target set, permissions enabled for the test user.
  2. Create a token and allow a player movement access.
  3. Have the player enter Build mode.
  4. Have the player move the token onto the teleport zone.
  5. Hit 'Use' on the popup.
  6. Player's viewport moves to the destination but the token does not. Error is printed from server.

Expected behavior Teleport zone should either work in Build mode as they do in Play mode, or be nonfunctional when in build mode the same as doors.

Screenshots

https://user-images.githubusercontent.com/2442544/220455792-e82e699c-6ede-4d0d-a15d-8bdb51783ed6.mp4

Desktop: