fix: the player cannot attack when teleport in same scene

This commit is contained in:
Somebody
2025-05-17 15:20:43 +08:00
parent dd855017b5
commit 8ab97ffa52

View File

@@ -821,10 +821,11 @@ public class PlayerInstance(PlayerData data)
Data.Pos = pos;
Data.Rot = rot;
var notSendMove = true;
SceneInstance instance = new(this, plane, floorId, entryId);
InvokeOnPlayerLoadScene(this, instance);
if (planeId != Data.PlaneId || floorId != Data.FloorId || entryId != Data.EntryId)
{
SceneInstance instance = new(this, plane, floorId, entryId);
InvokeOnPlayerLoadScene(this, instance);
SceneInstance = instance;
Data.PlaneId = planeId;
Data.FloorId = floorId;
Data.EntryId = entryId;
@@ -835,14 +836,12 @@ public class PlayerInstance(PlayerData data)
notSendMove = false;
}
SceneInstance = instance;
if (MissionManager != null)
await MissionManager.OnPlayerChangeScene();
Connection?.SendPacket(CmdIds.SyncServerSceneChangeNotify);
if (sendPacket && notSendMove)
await SendPacket(new PacketEnterSceneByServerScNotify(instance));
await SendPacket(new PacketEnterSceneByServerScNotify(SceneInstance!));
else if (sendPacket && !notSendMove) // send move packet
await SendPacket(new PacketSceneEntityMoveScNotify(this));