Projectile debugging
This commit is contained in:
@@ -1144,11 +1144,14 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
||||
Console.WriteLine($"[HandleFireProjectile] Added projectile {projectile.Id} to simulation. Total projectiles: {dungeon.Simulation.Projectiles.Count}");
|
||||
|
||||
// Broadcast projectile spawned
|
||||
Console.WriteLine($"[HandleFireProjectile] Broadcasting projectile {projectile.Id} to {dungeon.Simulation.Players.Count} players");
|
||||
foreach (var dungeonPlayer in dungeon.Simulation.Players.Values)
|
||||
{
|
||||
Console.WriteLine($"[HandleFireProjectile] Checking player CharId={dungeonPlayer.CharacterId}");
|
||||
var playerSession = _playerSessions.Values.FirstOrDefault(p => p.CharacterId == dungeonPlayer.CharacterId);
|
||||
if (playerSession != null)
|
||||
{
|
||||
Console.WriteLine($"[HandleFireProjectile] Sending EVENT_PROJECTILE_SPAWNED (504) to player {playerSession.Character.Name} (CharId={playerSession.CharacterId})");
|
||||
_ = SendAsync(playerSession.Connection, DungeonOpCodes.EVENT_PROJECTILE_SPAWNED, new
|
||||
{
|
||||
id = projectile.Id,
|
||||
@@ -1166,6 +1169,10 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
||||
backY = projectile.BackY
|
||||
}, CancellationToken.None);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"[HandleFireProjectile] WARNING: No session found for player CharId={dungeonPlayer.CharacterId}");
|
||||
}
|
||||
}
|
||||
|
||||
_log.LogDebug("Player {Name} fired projectile with {Weapon} using {Ammo} for {Damage} damage",
|
||||
@@ -1228,11 +1235,13 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
||||
|
||||
dungeon.Simulation.Projectiles.TryAdd(projectile.Id, projectile);
|
||||
|
||||
Console.WriteLine($"[HandleThrowableProjectile] Broadcasting projectile {projectile.Id} to {dungeon.Simulation.Players.Count} players");
|
||||
foreach (var dungeonPlayer in dungeon.Simulation.Players.Values)
|
||||
{
|
||||
var playerSession = _playerSessions.Values.FirstOrDefault(p => p.CharacterId == dungeonPlayer.CharacterId);
|
||||
if (playerSession != null)
|
||||
{
|
||||
Console.WriteLine($"[HandleThrowableProjectile] Sending EVENT_PROJECTILE_SPAWNED (504) to player {playerSession.Character.Name}");
|
||||
_ = SendAsync(playerSession.Connection, DungeonOpCodes.EVENT_PROJECTILE_SPAWNED, new
|
||||
{
|
||||
id = projectile.Id,
|
||||
|
||||
Reference in New Issue
Block a user