Add collision teleport portals and ledge-safe movement in VNext dungeons
This commit is contained in:
@@ -854,9 +854,12 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
||||
frame = o.FrameIndex,
|
||||
blocks = o.BlocksMovement,
|
||||
interact = o.IsInteractable,
|
||||
triggeredByWalk = o.TriggeredByWalk,
|
||||
interactionType = o.InteractionType,
|
||||
trap = o.IsTrap,
|
||||
damage = o.TrapDamage,
|
||||
loot = o.LootTableId
|
||||
loot = o.LootTableId,
|
||||
metadataJson = o.MetadataJson
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
@@ -921,7 +924,11 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
||||
id = p.Id,
|
||||
x = p.X,
|
||||
y = p.Y,
|
||||
type = p.Type.ToString().ToLower()
|
||||
type = p.Type.ToString().ToLower(),
|
||||
triggerOnCollision = p.TriggerOnCollision,
|
||||
triggerRadius = p.TriggerRadius,
|
||||
destinationX = p.DestinationX,
|
||||
destinationY = p.DestinationY
|
||||
}),
|
||||
// V3 visual tile data
|
||||
tileSheets,
|
||||
@@ -1351,6 +1358,30 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
||||
return;
|
||||
}
|
||||
|
||||
if (portal.DestinationX.HasValue && portal.DestinationY.HasValue)
|
||||
{
|
||||
if (!dungeon.Simulation.CanActorMoveTo(portal.DestinationX.Value, portal.DestinationY.Value))
|
||||
{
|
||||
_log.LogDebug("Player {Name} tried to use portal {Id} with blocked destination", session.Character.Name, portal.Id);
|
||||
return;
|
||||
}
|
||||
|
||||
player.X = portal.DestinationX.Value;
|
||||
player.Y = portal.DestinationY.Value;
|
||||
player.InputX = 0f;
|
||||
player.InputY = 0f;
|
||||
|
||||
await SendAsync(connection, DungeonOpCodes.PORTAL_USED, new
|
||||
{
|
||||
portalId = portal.Id,
|
||||
type = portal.Type.ToString().ToLower(),
|
||||
teleported = true,
|
||||
x = player.X,
|
||||
y = player.Y
|
||||
}, ct);
|
||||
return;
|
||||
}
|
||||
|
||||
_log.LogInformation("Player {Name} using exit portal", session.Character.Name);
|
||||
|
||||
// Send portal used confirmation
|
||||
|
||||
Reference in New Issue
Block a user