destination
if npc.Dead {
continue
}
if npc.MapID == player.MapID && npc.X == destX && npc.Y == destY {
deps.Log.Debug("阻擋: NPC 在目標格子", zap.String("player", player.Name), zap.Int32("npc_id", npc.NpcID))
return // Blocked by NPC
}
}
// Check if destination is blocked by map obstacles (walls, etc.)
if deps.MapData != nil && !deps.MapData.IsPassable(player.MapID, curX, curY, int(heading)) {
return // Block movement
if deps.MapData != nil {
isPassable := deps.MapData.IsPassable(player.MapID, curX, curY, int(heading))
deps.Log.Debug("移動檢查", zap.String("player", player.Name),
zap.Int32("curX", curX), zap.Int32("curY", curY),
zap.Int32("destX", destX), zap.Int32("destY", destY),
zap.Int16("mapID", player.MapID),
zap.Int("heading", heading),
zap.Bool("isPassable", isPassable))
if !isPassable {
return // Block movement
}
}
// Mark old tile passable, new tile impassable (for NPC pathfinding only).
// Java C_MoveChar does NOT validate IsPassable for player movement — client
頁:
[1]