Source-Python-Dev-Team / Source.Python

This plugin aims to use boost::python and create an easily accessible wrapper around the Source Engine API for scripter use.
http://forums.sourcepython.com
GNU General Public License v3.0
163 stars 31 forks source link

[TF2] Entity.teleport broken after update #449

Closed laurirasanen closed 2 years ago

laurirasanen commented 2 years ago

Entity.teleport doesn't work (for Players at least). Player loses all weapons and is unable to move after calling teleport.

sp info
[Source.Python]
IMPORTANT: Please copy the full output.
--------------------------------------------------------
Checksum      : b9ab18d02d2d57865788b80b30244db2
Date          : 2022-07-09 18:26:54.948099
OS            : Windows-10-10.0.19041
Game          : tf2
SP version    : 714
Github commit : d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
Server plugins:
   00: Source.Python, (C) 2012-2021, Source.Python Team.
SP plugins:
   00: testplugin
--------------------------------------------------------

testplugin:

from events import Event
from players.entity import Player
from mathlib import Vector
from listeners.tick import Delay

@Event("player_spawn")
def on_player_spawn(game_event):
    player = Player.from_userid(game_event["userid"])
    player.teleport(Vector(0,0,0))
    # same happens with:
    # Delay(1, player.teleport)
jordanbriere commented 2 years ago

Game data is likely outdated. I will try to update them tonight, or tomorrow. In the meantime, you could use Player.snap_to_position which is, not only much faster, but also not relying on any offset/signature.

laurirasanen commented 2 years ago

Player.snap_to_position works. Thanks!

jordanbriere commented 2 years ago

Untested, but all offsets should now be updated to the latest server binary.