Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion Maple2.Server.Game/Manager/Field/FieldManager/FieldManager.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,6 +27,7 @@
using Maple2.Tools.DotRecast;
using Maple2.Tools.Extensions;
using Maple2.Tools.Scheduler;
using Maple2.Tools.VectorMath;
using Serilog;

namespace Maple2.Server.Game.Manager.Field;
Expand DownExpand Up@@ -550,7 +551,21 @@ public bool UsePortal(GameSession session, int portalId, string password) {

if (srcPortal.TargetMapId == MapId) {
if (TryGetPortal(srcPortal.TargetPortalId, out FieldPortal? dstPortal)) {
session.Send(PortalPacket.MoveByPortal(session.Player, dstPortal));
Vector3 position = dstPortal.Position;
Vector3 rotation = dstPortal.Rotation;

if (dstPortal.Value.ActionType is PortalActionType.Touch) {
// add one blocks or use offset in the direction of front axis
float offset = Constant.BlockSize;
if (dstPortal.Value.FrontOffset != 0) {
offset = dstPortal.Value.FrontOffset;
}

Vector3 forward = dstPortal.Transform.FrontAxis;

position += forward * offset;
}
session.Send(PortalPacket.MoveByPortal(session.Player, position, rotation));
}

return true;
Expand Down